目
录
使用帮助...........................................................................................................................................1
1.计算机命令: .........................................................................................................................1
2.交换机支持的命令: .............................................................................................................1
3.路由器支持的命令: .............................................................................................................2
4.PIX防火墙命令 ......................................................................................................................6
理论学习...........................................................................................................................................7
网络的发展与应用 .......................................................................................................................7
网络互联基础 ...............................................................................................................................8
交换机原理与应用 .....................................................................................................................13
路由器原理与应用 .....................................................................................................................17
常见广域网协议及特点 .............................................................................................................23
PIX 防火墙特点与应用..............................................................................................................24
五、PIX 防火墙举例..................................................................................................................29
PIX 防火墙应用举例.................................................................................................................29
常见操作操作错误:.....................................................................................................................31
实验一 口令和主机名设置...........................................................................................................31
实验二 计算机与交换机 IP 地址设置 .........................................................................................36
实验三 交换机 VLAN 实验..........................................................................................................38
实验四 路由器的升级...................................................................................................................41
实验五 路由器接口 ip 及直联路由..............................................................................................44
实验六 一个 vlan 下的单臂路由..................................................................................................46
实验七 子接口单臂路由...............................................................................................................48
实验八 静态路由...........................................................................................................................50
实验九 动态路由...........................................................................................................................53
实验十 交换机和路由器组合实验...............................................................................................56
实验十一 访问控制列表...............................................................................................................59
实验十二 综合实验.......................................................................................................................62
实验十三《三层交换机实验》.....................................................................................................64
实验十四《三层交换与二层交换机结合》.................................................................................66
实验十五《三层交换机与路由器的连接》.................................................................................67
实验十六《交换机的通道技术》.................................................................................................68
实验十七 《交换机与路由器间的端口聚合》...........................................................................70
实验十八《静态 NAT 配置》.......................................................................................................71
实验十九《 常见 NAT 配置 》.................................................................................................72
实验二十 防火墙设置...................................................................................................................75
实验二十一 点到点联接时 OSPF 的配置 ...................................................................................77
实验二十二 广播方式的 OSPF 配置 ...........................................................................................79
实验二十三 非广播方式的 OSPF 配置 .......................................................................................80
实验二十四 PPP 配置实验 ..........................................................................................................82
实验二十五 实验室条件下点对点帧中继配置...........................................................................83
实验二十六 点对点的帧中继配置.............................................................................................84
实验二十七 子接口帧中继配置.................................................................................................85
0
实验二十八 配置 BGP................................................................................................................87
实验二十九 GRE VPN 的配置...................................................................................................88
实验三十 ipsec site-to-site VPN 配置.........................................................................................90
使用帮助
1.计算机命令:
;使用 root用户
PCAlogin:root
;口令是 linux
password:linux
;同 init0关机
#shutdown-hnow
;退出登录
#logout
;登录
#login
;显示 IP地址
#ifconfig
;设置 IP地址
#ifconfigeth0netmask
#ifconfigeth0netmaskdown;删除 IP地址
#routeadd0.0.0.0gw
#routedel0.0.0.0gw
#routeadddefaultgw
#routedeldefaultgw
#route
#ping
#telnet
;设置网关
;删除网关
;设置网关
;删除网关
;显示网关
;测试网络
;远程登录
2.交换机支持的命令:
交换机基本状态:
switch:
rommon>
hostname>
hostname#
hostname(config)#
hostname(config-if)#
交换机口令设置:
switch>enable
switch#configterminal
switch(config)#hostname
switch(config)#enablesecretxxx
switch(config)#enablepasswordxxa
switch(config)#lineconsole0
switch(config-line)#linevty04
switch(config-line)#login
switch(config-line)#passwordxx
switch#exit
1
;交换机的 ROM状态
;路由器的 ROM状态
;用户模式
;特权模式
;全局配置模式
;接口状态
;进入特权模式
;进入全局配置模式
;设置交换机的主机名
;设置特权加密口令
;设置特权非密口令
;进入控制台口
;进入虚拟终端
;允许登录
;设置登录口令 xx
;返回命令
交换机 VLAN设置:
switch#vlandatabase
switch(vlan)#vlan2
switch(vlan)#novlan2
switch(vlan)#vtpdomain
switch(vlan)#vtppassword
switch(vlan)#vtpserver
switch(vlan)#vtpclient
switch(vlan)#vtppruning
switch(config)#intf0/1
switch(config-if)#switchportaccessvlan2
switch(config-if)#switchportmodetrunk
switch(config-if)#switchporttrunkallowedvlan1,2;设置允许的 vlan
switch(config-if)#switchporttrunkencapdot1q
switch(config-if)#speed
switch(config-if)#duplex
;进入 VLAN设置
;建 VLAN2
;删 vlan2
;设置发 vtp域名
;设置发 vtp密码
;设置发 vtp模式
;设置发 vtp模式
;设置 vtp 允许
;进入端口 1
;当前端口加入 vlan2
;设置为干线
;设置 vlan中继
;设置接口速度
;设置接口作方式
交换机设置 IP地址:
switch(config)#interfacevlan1
switch(config-if)#ipaddress
switch(config)#ipdefault-gateway
switch#dirflash:
交换机显示命令:
switch#write
switch#showvtp
switch#showrun
switch#showvlan
switch#showinterface
switch#showintf0/0
3.路由器支持的命令:
路由器显示命令:
router#showrun
router#showinterface
router#showiproute
router#showcdpnei
router#reload
路由器口令设置:
router>enable
router#configterminal
router(config)#hostname
2
;进入 vlan1
;设置 IP地址
;设置默认网关
;查看闪存
;保存配置信息
;查看 vtp配置信息
;查看当前配置信息
;查看 vlan配置信息
;查看端口信息
;查看指定端口信息
;显示配置信息
;显示接口信息
;显示路由信息
;显示邻居信息
;重新起动
;进入特权模式
;进入全局配置模式
;设置交换机的主机名
router(config)#enablesecretxxx
router(config)#enablepasswordxxb
router(config)#lineconsole0
router(config-line)#linevty04
router(config-line)#login
router(config-line)#passwordxx
router(config)#(Ctrl+z)
router#exit
;设置特权加密口令
;设置特权非密口令
;进入控制台口
;进入虚拟终端
;要求口令验证
;设置登录口令 xx
; 返回特权模式
;返回命令
;进入 Serail接口
;激活当前接口
;设置同步时钟
;设置 IP地址
路由器配置:
router(config)#ints0/0
router(config-if)#noshutdown
router(config-if)#clockrate64000
router(config-if)#ipaddress
router(config-if)#ipaddresssecond ;设置第二个 IP
router(config-if)#intf0/0.1
router(config-subif.1)#ipaddress ;设置子接口 IP
router(config-subif.1)#encapsulationdot1q
router(config)#config-register0x2142
router(config)#config-register0x2102
router#reload
;进入子接口
;绑定 vlan中继协议
;跳过配置文件
;正常使用配置文件
;重新引导
路由器文件操作:
router#copyrunning-configstartup-config
router#copyrunning-configtftp
router#copystartup-configtftp
router#copytftpflash:
router#copytftpstartup-config
ROM状态:
Ctrl+Break
rommon>confreg0x2142
rommon>confreg0x2102
rommon>reset
rommon>copyxmodem:flash:
rommon>IP_ADDRESS=10.65.1.2
rommon>IP_SUBNET_MASK=255.255.0.0
rommon>TFTP_SERVER=10.65.1.1
rommon>TFTP_FILE=c2600.bin
rommon>tftpdnld
rommon>dirflash:
rommon>boot
3
;保存配置
;保存配置到 tftp
;开机配置存到 tftp
;下传文件到 flash
;下载配置文件
;进入 ROM监控状态
;跳过配置文件
;恢复配置文件
;重新引导
;从 console传输文件
;设置路由器 IP
;设置路由器掩码
;指定 TFTP服务器 IP
;指定下载的文件
;从 tftp下载
;查看闪存内容
;引导 IOS
静态路由:
iproute
router(config)#iproute2.0.0.0255.0.0.01.1.1.2 ;静态路由举例
router(config)#iproute0.0.0.00.0.0.01.1.1.2 ;默认路由举例
;命令格式
动态路由:
router(config)#iprouting
router(config)#routerrip
router(config-router)#network
router(config-router)#negihbor
;启动路由转发
;启动 RIP路由协议。
;设置发布路由
;点对点帧中继用。
帧中继命令:
router(config)#frame-relayswitching
router(config-s0)#encapsulationframe-relay
router(config-s0)#fram-relaylmi-typecisco
router(config-s0)#frame-relayintf-typeDCE
router(config-s0)#frame-relaydlci16
router(config-s0)#frame-relaylocal-dlci20
router(config-s0)#frame-relayinterface-dlci16 ;
router(config)#log-adjacency-changes
router(config)#ints0/0.1point-to-point
router#showframepvc
router#showframemap
;使能帧中继交换
;使能帧中继
;设置管理类型
;设置为 DCE
;
;设置虚电路号
;记录邻接变化
;设置子接口点对点
;显示永久虚电路
;显示映射
基本访问控制列表:
router(config)#access-listpermit|deny
router(config)#interface
;default:denyany
router(config-if)#ipaccess-groupin|out ;default:out
例 1:
router(config)#access-list1denyhost10.65.1.1
router(config)#access-list1permitany
router(config)#intf0/0
router(config-if)#ipaccess-group4in
例 2:
router(config)#access-list4permit10.8.1.1
router(config)#access-list4deny10.8.1.00.0.0.255
router(config)#access-list4permit10.8.0.00.0.255.255
router(config)#access-list4deny10.0.0.00.255.255.255
router(config)#access-list4permitany
router(config)#intf0/1
router(config-if)#ipaccess-group4in
4
扩展访问控制列表:
access-listpermit|denyicmp[type]
access-listpermit|denytcp[port]
例 1:
router(config)#access-list101denyicmpany10.64.0.20.0.0.0echo
router(config)#access-list101permitipanyany
router(config)#ints0/0
router(config-if)#ipaccess-group101in
例 2:
router(config)#access-list102denytcpany10.65.0.20.0.0.0eq80
router(config)#access-list102permitipanyany
router(config)#interfaces0/1
router(config-if)#ipaccess-group102out
删除访问控制例表:
router(config)#noaccess-list102
router(config-if)#noipaccess-group101in
;当前接口指定为内部接口
;当前接口指定为外部接口
路由器的 nat配置
Router(config-if)#ipnatinside
Router(config-if)#ipnatoutside
Router(config)#ipnatinsidesourcestatic[p]<私有 IP><公网 IP>[port]
Router(config)#ipnatinsidesourcestatic10.65.1.260.1.1.1
Router(config)#ipnatinsidesourcestatictcp10.65.1.38060.1.1.180
Router(config)#ipnatpoolp160.1.1.160.1.1.20255.255.255.0
Router(config)#ipnatinsidesourcelist1poolp1
Router(config)#ipnatinsidedestinationlist2poolp2
Router(config)#ipnatinsidesourcelist2interfaces0/0overload
Router(config)#ipnatpoolp210.65.1.210.65.1.4255.255.255.0typerotary
Router#showipnattranslation
rotary参数是轮流的意思,地址池中的 IP轮流与 NAT分配的地址匹配。
overload参数用于 PAT将内部 IP映射到一个公网 IP不同的端口上。
外部网关协议配置
routerA(config)#routerbgp100
routerA(config-router)#network19.0.0.0
routerA(config-router)#neighbor8.1.1.2remote-as200
配置 PPP验证:
RouterA(config)#usernamepassword
RouterA(config)#ints0
RouterA(config-if)#pppauthentication{chap|pap}
5
4.PIX防火墙命令
Pix525(config)#nameifethernet0outsidesecurity0
Pix525(config)#interfaceethernet0auto
Pix525(config)#interfaceethernet1100full
Pix525(config)#interfaceethernet1100fullshutdown
Pix525(config)#ipaddressinside192.168.0.1255.255.255.0
Pix525(config)#ipaddressoutside133.0.0.1255.255.255.252
;命名接口和级别
;设置接口方式
;设置接口方式
Pix525(config)#global(if_name)natidip-ip
Pix525(config)#global(outside)17.0.0.1-7.0.0.15
Pix525(config)#global(outside)1133.0.0.1
Pix525(config)#noglobal(outside)1133.0.0.1
;定义公网 IP区间
;例句
;例句
;去掉设置
Pix525(config)#nat(if_name)nat_idlocal_ip[netmark]
Pix525(config)#nat(inside)100
内网所有主机(0代表 0.0.0.0)可以访问 global1指定的外网。
Pix525(config)#nat(inside)1172.16.5.0255.255.0.0
内网 172.16.5.0/16网段的主机可以访问 global1指定的外网。
;命令格式
Pix525(config)#routeif_name00gateway_ip[metric]
;例句
Pix525(config)#routeoutside00133.0.0.11
Pix525(config)#routeinside10.1.0.0255.255.0.010.8.0.11;例句
Pix525(config)#static(inside, outside)133.0.0.1192.168.0.8
表示内部 ip地址 192.168.0.8,访问外部时被翻译成 133.0.0.1全局地址。
Pix525(config)#static(dmz, outside)133.0.0.1172.16.0.8
中间区域 ip地址 172.16.0.8,访问外部时被翻译成 133.0.0.1全局地址。
router#configure ?
router#configure terminal ?
router(config)# ?
router(config)#ip ?
router(config)#interface ?
router(config)#interface serial ?
router(config)#interface fastEthernet ?
router(config)#interface fastEthernet 0 ?
router(config)#interface fastEthernet 0/ ?
router(config)#interface fastEthernet 0/0 ?
router(config-if)#ip ?
router(config-if)#ip address ?
6
router(config-if)#ip address 1.1.1.1 ?
router(config-if)#ip address 1.1.1.1 255.0.0.0 ?
router(config)#router ?
router(config)#router rip ?
router(config)#router ospf ?
router(config)#router ospf 1 ?
router(config)#ip route ?
router(config)#ip route 2.0.0.0 ?
router(config)#ip route 2.0.0.0 255.0.0.0 ?
router(config)#ip route 2.0.0.0 255.0.0.0 3.3.3.3 ?
router(config)#access-list ?
router(config)#access-list 1 ?
router(config)#access-list 1 permit ?
router(config)#access-list 1 permit 1.1.1.1 ?
router(config)#access-list 1 permit host ?
router(config)#access-list 1 permit host 1.1.1.1 ?
router(config)#access-list 1 permit 2.2.2.2 ?
router(config)#access-list 1 permit 2.2.2.2 0.0.0.255?
router(config)#access-list 111 ?
router(config)#access-list 111 permit ?
router(config)#access-list 111 permit icmp ?
router(config)#access-list 111 permit icmp host ?
router(config)#access-list 111 permit icmp 1.1.1.1 ?
router(config)#access-list 111 permit icmp 1.1.1.1 0.0.0.255 ?
router(config)#access-list 111 permit icmp 1.1.1.1 0.0.0.255 2.2.2.2 ?
router(config)#access-list 111 permit icmp 1.1.1.1 0.0.0.255 2.2.2.2 0.0.0.255 ?
router(config)#access-list 111 permit icmp 1.1.1.1 0.0.0.255 2.2.2.2 0.0.0.255 eq ?
router(config-if)#ip ?
router(config-if)#ip access-group ?
router(config-if)#ip access-group xxx ?
router(config-if)#ip access-group xxx in ?
===============================================end.
理论学习
网络的发展与应用
一、计算机网络发展的三个阶段
1、研究阶段 (68 年~84 年)
主要特征:
TCP/IP 协议的研制成功。
Client/Server 工作方式的实现。
实现了资源共享和分散控制等。
7