IP技术初级实验手册

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

IP技术初级实验手册
IP技术初级实验手册 (1)
前言: (1)
模拟器的使用: (1)
实验1:路由器直连telnet (13)
实验2:帧中继和静态路由 (17)
实验3:配置Vtp, Vlan, Trunk (21)
实验4:单臂路由,不同Vlan间通信 (27)
实验5:配置RIP协议 (33)
实验6:配置单区域OSPF协议 (38)
实验7:配置NAT , ACL访问控制列表 (45)
实验8:配置PPP,DHCP (51)
实验9:综合实验 (58)
前言:
此手册作为初级实验参考,试验环境为dynamips,CCNA-LAB。

对于设备提示信息和输入命令,以不同颜色标注。

显示的报告需要关注的地方以高亮方式标注,过长的报告则以省略符表示。

除了接口名称以简写方式,其余命令没有简略。

由于时间仓促,难免出现错误。

此文档权限设定为允许添加批注,如果有发现错误的地方,请以批注的方式添加进文档,发邮件回馈给本人,我将及时修改。

模拟器的使用:
1. Dynamips模拟器介绍
Dynamip s是一款Cisco路由器模拟器,可以模拟2600,3600,3700,和7200硬件平台,并且可以运行思科公司标准的IOS镜像文件(.bin格式文件)。

通过软件的方式模拟使用真实环境中的设备, 它虽然不能替代真实的路由器,但是可以让大家熟悉Cisco的设备以及配置命令,通过配置模拟实验更好的理解技术原理。

Dynamips对于交换机的模拟是在路由器中插一块16口的网络模块,使其具备交换功能,利用这个模块我们可以在路由器上进行一些交换的试验。

但有很多交换机的特性在这个模块上是不能完全实现的,在试验中可能会遇到一些问题。

2.实验环境的搭建
使用Dynamips模拟器需要下载一个Cisco的IOS镜像,并且自己构建一个网络拓扑图。

我们已经将一个Cisco的3640路由器IOS和一个全连通的网络拓扑压缩打包为一个文件,方便大家使用。

如图1所示,CCNA-LAB文件为初级实验压缩包,共有2台路由器和2台交换机,CCNP-LAB文件为中级实验压缩包,共有5台路由器和4台交换机。

图1
由于是使用PC模拟多台路由器或者交换机,因此对于PC的配置要求较高。

初级实验环境要求PC的CPU主频≥1.5GHz,内存≥512M,硬盘预留空间≥600M。

中级实验环境要求PC的CPU主频≥1.7GHz,内存≥1G,硬盘预留空间≥1.3G。

解压缩CCNA-LAB文件后,文件目录如图2所示。

图2
运行模拟器前需要安WinPcap程序。

进入ethreal文件夹下,如图3所示。

双击安装WinPcap_3_0.exe,弹出窗口,如图4所示。

图3
双击安装WinPcap_3_0.exe,弹出窗口,如图4所示。

图4 弹出提示对话框,如图5所示。

图5 按照提示完成安装,如图6所示。

图6
完成WinPcap安装后,退回到CCNA-LAB文件夹下,如图7所示。

图7
双击Router.bat脚本文件即是运行路由器,双击Switch.bat脚本文件即是运行交换机,如图8所示。

图8
依次双击各个脚本文件就将依次开启各个设备。

由于每运行一个脚本时,Dynamips模拟器会解压缩并加载一次IOS镜像文件,因此建议每次开启两台设备,等模拟器解压缩并加载完成后,再开启其它设备。

(注意:如果需要用到帧中继网络,必须先运行Router1.bat,因为路由器R1加载帧中继脚本)。

3.设置idle-pc值
在运行LAB的时候可能会导致系统的CPU高居100%,这是因为dynamips不知道虚拟路由器什么时候应该处于空闲状态,什么时候应该处于使用状态。

Idle-pc测试分析正在运行的镜像文件,在IOS中寻找一个空闲循环周期。

应用之后,dynamips在空闲循环周期的时候偶尔”休眠”虚拟路由器,当然这不会降低虚拟路由器的实际处理能力,却可以大幅度的降低主机的CPU消耗。

如何应用Idle-pc呢?在模拟器关闭状态下,右键编辑.bat脚本文件。

如图9所示。

图9
脚本文件中会有一项关于idle-pc的设置,如图10中所示:--idle-pc=0x60fe8088。

图10
模拟器根据IOS计算出几个可用的idle-pc值,分别代入各个值,运行所有设备,选取一个CPU占用率最低的值即可。

此过程比较麻烦,且不同的IOS适用的值不相同,因此推荐初级LAB使用idle-pc值0x60fe8088,中级LAB使用idle-pc值0x604c8878。

将idle-pc值代入所有设备的.bat脚本文件,保存后双击启动设备即可,如果本来没有idle-pc项的,一定要填入。

4.配置Telnet客户端
模拟器设备启动后,连接设备需要使用telnet客户端。

客户端软件有很多种,最方便实用的是SecureCRT软件。

安装SecrueCRT后,双击运行SecrueCRT.exe,弹出窗口如图11所示。

图11
在SecureCRT运行窗口中,为能够分页式查看各设备,点击在标签中连接,如图11所示。

弹出新建会话向导,选择连接类型为telnet,如图12所示,点击下一步。

图12
在主机名选项中填入地址127.0.0.1,端口选项中填入3001,如图13所示。

由于是用PC模拟路由器,因此主机名填写的是本地环回地址,连接路由器R1就填入端口号为3001,路由器R2的端口号为3002,依次类推。

交换机SW1的端口号为3007,SW2的端口号为3008。

端口号在.bat脚本文件中可以修改,但不推荐修改端口号。

图13
在会话名称中填入R1,此项填入的是连接设备名,方便自己查看,如图14所示。

图14
描述信息可以按自己的需要填写,一般不填。

各选项填写完后,单击完成,与路由器R1的会话就建立完。

如图15所示。

图15
按之前建立会话步骤,同样建立与路由器R2,交换机SW1、SW2的会话。

如图16所示。

图16
分别点击连接会话即可以加载登入设备,如图17所示。

图17
会话的属性可以在选项栏中会话选项中修改,如图18所示。

图18
点击会话选项后,进行会话属性的修改。

我们一般常用的是修改连接会话的外观属性,将颜色方案修改为传统,将字体设置为Courier New,并设置为粗体,当然这些按照自己的需求设置即可,如图19所示。

图19
修改了会话属性后,重新连接会话,所修改属性即已改变,如图20所示。

图20
加载完镜像文件后,弹出提示报告,询问是否初始化配置,输入n,不初始化,然后敲击回车键即可进入用户模式。

提示符为Router> ,输入enable后回车即可进入全局模式,提示符为Router#,输入configure termina l后回车即可进入配置模式,提示符为Router(config)#,如下所示。

Router>enable
Router#configure terminal
Router(config)#
切换会话窗口有快捷键,Ctrl+Tab组合键是按顺序依次切换窗口,Alt+数字键的组合是直接切换到会话窗口,比如Alt+2是直接切换到第二个会话窗口。

5.拓扑图的使用
在CCNA-LAB文件夹下有一个CCNA-拓扑.jpg的文件,如图21所示。

图21
打开拓扑图后,我们可以看到一张路由器以及交换机的全连通拓扑,如图22所示。

图中有各个连接接口的标识,我们可以按照此图,根据自己的需求设计出我们需要的拓扑图。

在实验过程中如果有不确定的端口,也可以根据此图查找。

图22
实验1:路由器直连telnet
【实验目的】:
在本实验中,要求路由器R1与R2以串口S1/1直接连接,R1可以远程telnet到R2的S1/1接口,远程登陆不需要用户名,密码为cisco。

R2的全局配置模式密码为cisco,明文方式。

•实验拓扑如图所示,路由器R1和R2以各自的S1/1口直连,直连所在网段12.12.12.0/30。

•R1的S1/1口地址为12.12.12.1/30,R2的S1/1口地址为12.12.12.2/30。

【实验拓扑】:
【实验过程】:
第一步:模版化初始配置。

1.模版化配置R1,并将路由器的名称设置为R1。

Would you like to enter the initial configuration dialog? [yes/no]:n Router>enable
Router#configure terminal
Router(config)#hostname R1
R1(config)#no ip domain-lookup
R1(config)#line console 0
R1(config-line)#exec-timeout 0 0
R1(config-line)#logging synchronous
R1(config-line)#exit
R1(config)#
2.同理配置R2,并将路由器的名称设置为R2。

Would you like to enter the initial configuration dialog? [yes/no]:n Router>enable
Router#configure terminal
Router(config)#hostname R2
R2(config)#no ip domain-lookup
R2(config)#line console 0
R2(config-line)#exec-timeout 0 0
R2(config-line)#logging synchronous
R2(config-line)#exit
R2(config)#
第二步:配置R1和R2的接口IP地址,并且激活各自S1/1口。

1.给R1的S1/1口配置IP地址12.12.12.1,掩码255.255.255.252,并且激活S1/1口。

R1(config)#interface serial 1/1
R1(config-if)#ip address 12.12.12.1 255.255.255.252
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#
2.给R2的S1/1口配置IP地址12.12.12.2,掩码255.255.255.252,并且激活S1/1口。

R2(config)#interface serial 1/1
R2(config-if)#ip address 12.12.12.2 255.255.255.252
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#
第三步:使用ping命令验证R1和R2之间连通性,但R1不能telnet到R2。

R1#ping 12.12.12.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.12.12.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/49/64 ms R1#telnet 12.12.12.2
Trying 12.12.12.2 ... Open
Password required, but none set
[Connection to 12.12.12.2 closed by foreign host]
R1#
第四步:配置R2的远程登陆VTY线路,telnet密码为cisco。

R2(config)#line vty 0 4
R2(config-line)#password cisco
R2(config-line)#exit
R2(config)#
第五步:从R1远程登陆到R2的S1/1口,telnet密码为cisco。

1.从R1远程telnet到R2,但登入R2后不能进入全局模式。

R1#telnet 12.12.12.2
Trying 12.12.12.2 ... Open
User Access Verification
Password:cisco
R2>
R2>enable
% No password set
R2>exit
[Connection to 12.12.12.2 closed by foreign host]
R1#
2.配置R2的全局模式密码,密码为cisco,明文方式。

R2(config)#enable password cisco
R2(config)#exit
R2#show running-config
Building configuration...
!
hostname R1
!
boot-start-marker
boot-end-marker
!
enable password cisco
......
R2#
3.从R1远程登陆到R2的S1/1口,登入R2可以进入全局模式,密码为cisco,并显示远程登陆的用户线路号。

R1#telnet 12.12.12.2
Trying 12.12.12.2 ... Open
User Access Verification
Password:cisco
R2>enable
Password:cisco
R2#
R2#show users
Line User Host(s) Idle Location
0 con 0 idle 00:05:25
*130 vty 0 idle 00:00:00 12.12.12.1
Interface User Mode Idle Peer Address
R2#
第六步:在R2将远程登入的R1清除,远程登陆到R2的R1将会自动退回到R1的全局模式。

1.在R2上清除线路130。

R2#clear line 130
[confirm]
[OK]
R2#show users
Line User Host(s) Idle Location
* 0 con 0 idle 00:00:00
Interface User Mode Idle Peer Address R2#
2.在R1上查看,已登入R2的R1自动退回到R1本机。

R1#telnet 12.12.12.2
Trying 12.12.12.2 ... Open
.....
R2#
R2#
[Connection to 192.168.1.2 closed by foreign host]
R1#
实验2:帧中继和静态路由
【实验目的】:
在本实验中,要求路由器R1与R2以帧中继连接,R1通过静态路由学习到R2的Loopback0口网段路由,R2通过静态路由学习到R1的Loopback0口网段路由,且R1和R2的Loopback0口可以互相ping通。

•实验拓扑如图所示,路由器R1的 Loopback0口地址为1.1.1.1/32,R2的 Loopback0口地址为
2.2.2.2/32。

•R1和R2以各自的S1/0口连帧中继,帧中继所在网段为12.12.12.0/30。

•R1的S1/0口地址为12.12.12.1/30,R2的S1/0口地址为12.12.12.2/30。

•R1封装DLCI号102,R2封装DLCI号201。

【实验拓扑】:
【实验过程】:
第一步:模版化初始配置R1和R2。

1.模版化配置R1,并将路由器的名称设置为R1。

Router>enable
Router#configure terminal
Router(config)#no ip domain-lookup
Router(config)#line console 0
Router(config-line)#exec-timeout 0 0
Router(config-line)#logging synchronous
Router(config-line)#exit
Router(config)#line vty 0 4
Router(config-line)#exec-timeout 0 0
Router(config-line)#logging synchronous
Router(config-line)#exit
Router(config)#hostname R1
R1(config)#
2.模版化配置R2,并将路由器的名称设置为R2。

Router>enable
Router#configure terminal
Router(config)#no ip domain-lookup
Router(config)#line console 0
Router(config-line)#exec-timeout 0 0
Router(config-line)#logging synchronous
Router(config-line)#exit
Router(config)#line vty 0 4
Router(config-line)#privilege level 15
Router(config-line)#no login
Router(config-line)#exec-timeout 0 0
Router(config-line)#logging synchronous
Router(config-line)#exit
Router(config)#hostname R2
R2(config)#
第二步:配置路由器R1和R2的Loopback口IP地址。

1.R1的Loopback0口地址为1.1.1.1/32。

R1(config)#interface loopback 0
R1(config-if)#ip address 1.1.1.1 255.255.255.255
R1(config-if)#exit
R1(config)#
2.R2的Loopback0口地址为2.2.2.2/32。

R2(config)#interface loopback 0
R2(config-if)#ip address 2.2.2.2 255.255.255.255
R2(config-if)#exit
R2(config)#
第三步:配置路由器R1和R2的帧中继连接以及接口IP地址。

1.R1的S1/0口IP地址为12.12.12.1/30,封装帧中继。

R1(config)#interface serial 1/0
R1(config-if)#ip address 12.12.12.1 255.255.255.252
R1(config-if)#encapsulation frame-relay
R1(config-if)#no frame-relay inverse-arp
R1(config-if)#frame-relay map ip 12.12.12.2 102 broadcast R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#
2.R2的S1/0口IP地址为12.12.12.2/30,封装帧中继。

R2(config)#interface serial 1/0
R2(config-if)#ip address 12.12.12.2 255.255.255.252
R2(config-if)#encapsulation frame-relay
R2(config-if)#no frame-relay inverse-arp
R2(config-if)#frame-relay map ip 12.12.12.1 201 broadcast R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#
3.测试R1和R2帧中继直连ping通。

R1#ping 12.12.12.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.12.12.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/45/88 ms
R1#
第四步:配置路由器R1到R2的Loopback0口的静态路由,并查看路由表。

R1(config)#ip route 2.2.2.2 255.255.255.255 s1/0
R1(config)#exit
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
S 2.2.2.2 is directly connected, Serial1/0
12.0.0.0/30 is subnetted, 1 subnets
C 12.12.12.0 is directly connected, Serial1/0
R1#
第五步:测试R1到R2的Loopback0口是否可达。

1.R1上ping不通2.2.2.2,添加到2.2.2.2的帧中继封装后可以ping通。

R1#ping 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds: .....
Success rate is 0 percent (0/1)
R1#configure terminal
R1(config)#interface serial 1/0
R1(config-if)#frame-relay map ip 2.2.2.2 102 broadcast
R1(config-if)#exit
R1(config)#exit
R1#ping 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 52/64/80 ms R1#
2.以R1的Loopback0口为源ping不通2.2.2.2。

R1#ping 2.2.2.2 source loopback 0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
.....
Success rate is 0 percent (0/5)
R1#
3.添加R2到R1的Loopback0口的回向路由,以及到R1的Loopback0的帧中继封装。

R2(config)#ip route 1.1.1.1 255.255.255.255 s1/0
R2(config)#interface serial 1/0
R2(config-if)#frame-relay map ip 1.1.1.1 201 broadcast
R2(config-if)#exit
R2(config)#
4.测试R1和R2的loopback0口互相可达。

R1#ping 2.2.2.2 source loopback 0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/64/120 ms R1#
实验3:配置Vtp, Vlan, Trunk
【实验目的】:
在本实验中,要求路由器R1与R2模拟PC,路由器名称分别为PC-R1和PC-R2。

PC-R1和PC-R2都属于Vlan12, 且PC0-R1和PC-R2可以互相ping通。

SW1和SW2为二层交换机, 通过Trunk口相连,SW1为vtp server端,SW2为vtp client端,所在domain域名称为VTP,密码为cisco。

SW1添加Vlan12,名称为test,SW2能从SW1学到Vlan12。

SW1和SW2可以通过SVI1口互相telnet。

•实验拓扑如图所示,PC-R1和PC-R2以各自的以太口连二层交换机。

•PC-R1的 F0/0口地址为192.168.1.1/24, PC-R2的 F2/0口地址为192.168.1.2/24,且PC-R1和PC-R2都属于Vlan12。

•SW1的F0/1口连接PC-R1,SW2的F0/2口连接PC-R2。

•SW1和SW2通过各自Trunk口F0/0直连,SW1为vtp server,SW2为vtp client。

•SW1的三层SVI1管理口地址为12.12.12.1/24,SW2的三层SVI1管理口地址为12.12.12.2/24。

【实验拓扑】:
【实验过程】:
第一步:模版化初始配置R1、R2、SW1和SW2,设备名称分别为PC-R1、PC-R2、SW1和SW2。

1.模版化配置R1,并将路由器的名称设置为PC-R1。

Router>enable
Router#configure terminal
Router(config)#no ip domain-lookup
Router(config)#line console 0
Router(config-line)#exec-timeout 0 0
Router(config-line)#logging synchronous
Router(config-line)#exit
Router(config)#line vty 0 4
Router(config-line)#privilege level 15
Router(config-line)#no login
Router(config-line)#exec-timeout 0 0
Router(config-line)#logging synchronous
Router(config-line)#exit
Router(config)#hostname PC-R1
PC-R1(config)#
2.同理模版化配置PC-R2、SW1和SW2,在此不赘述。

第二步:将路由器R1和R2模拟为PC。

1.关闭R1的路由功能,将R1模拟为PC,IP地址为192.168.1.1/24。

PC-R1(config)#no ip routing
PC-R1(config)#interface fastEthernet 0/0
PC-R1(config-if)#ip address 192.168.1.1 255.255.255.0
PC-R1(config-if)#speed 100
PC-R1(config-if)#duplex full
PC-R1(config-if)#no shutdown
PC-R1(config-if)#exit
PC-R1(config)#
2.同理配置R2,IP地址为192.168.1.2/24。

PC-R2(config)#no ip routing
PC-R2(config)#interface fastEthernet 2/0
PC-R2(config-if)#ip address 192.168.1.2 255.255.255.0
PC-R2(config-if)#speed 100
PC-R2(config-if)#duplex full
PC-R2(config-if)#no shutdown
PC-R2(config-if)#exit
PC-R2(config)#
第二步:配置二层交换机SW1和SW2之间Trunk互联口F0/0。

1.关闭SW1的路由功能,使其只起二层交换作用,配置F0/0为Trunk,封装方式为dot1q。

SW1(config)#no ip routing
SW1(config)#interface fastEthernet 0/0
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#speed 100
SW1(config-if)#duplex full
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#exit
SW1#show interfaces fastEthernet 0/0 trunk
Port Mode Encapsulation Status Native vlan Fa0/0 on 802.1q trunking 1
Port Vlans allowed on trunk
Fa0/0 1-1005
Port Vlans allowed and active in management domain
Fa0/0 1
Port Vlans in spanning tree forwarding state and not pruned
Fa0/0 1
SW1#
2.同理配置SW2,关闭路由功能,配置F0/0为Trunk。

SW2(config)#no ip routing
SW2(config)#interface fastEthernet 0/0
SW2(config-if)#switchport mode trunk
SW2(config-if)#switchport trunk encapsulation dot1q
SW2(config-if)#speed 100
SW2(config-if)#duplex full
SW2(config-if)#no shutdown
SW2(config-if)#exit
SW2(config)#
第三步:配置SW1和SW2的vtp协议。

1.配置SW1为vtp server端,所在domain域名称为VTP,密码为cisco,开启vtp修剪。

SW1#vlan database
SW1(vlan)#vtp domain VTP
SW1(vlan)#vtp server
SW1(vlan)#vtp pruning
SW1(vlan)#vtp password cisco
SW1(vlan)#apply
SW1(vlan)#exit
SW1#show vtp status
VTP Version : 2
Configuration Revision : 0
Maximum VLANs supported locally : 256
Number of existing VLANs : 5
VTP Operating Mode : Server
VTP Domain Name : VTP
VTP Pruning Mode : Enabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xD1 0xB9 0x2D 0xCE 0xD4 0xEA 0x4C 0x33 Configuration last modified by 0.0.0.0 at 3-1-02 00:24:00
Local updater ID is 0.0.0.0 (no valid interface found)
SW1#
2.同理配置SW2为vtp client端,所在domain域名称为VTP,密码为cisco。

SW2#vlan database
SW2(vlan)#vtp domain VTP
SW2(vlan)#vtp client
SW2(vlan)#vtp pruning
SW2(vlan)#vtp password cisco
SW2(vlan)#apply
SW2(vlan)#exit
SW2#show vtp status
VTP Version : 2
Configuration Revision : 0
Maximum VLANs supported locally : 256
Number of existing VLANs : 5
VTP Operating Mode : Client
VTP Domain Name : VTP
VTP Pruning Mode : Enabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xD1 0xB9 0x2D 0xCE 0xD4 0xEA 0x4C 0x33 Configuration last modified by 0.0.0.0 at 3-1-02 00:24:00
SW2#
第四步:配置PC-R1和PC-R2所属Vlan。

1.在SW1上添加Vlan12,并配置SW的F0/1口所属Vlan12。

SW1#vlan database
SW1(vlan)#vlan 12 name test
SW1(vlan)#apply
SW1(vlan)#exit
SW1#show vlan-switch brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, F a0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/1, Fa0/12
Fa0/13, Fa0/14, Fa0/15
12 test active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
SW1#conf t
SW1(config)#inter f0/1
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 12
SW1(config-if)#speed 100
SW1(config-if)#duplex full
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#exit
SW1#show vlan-switch brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/0, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15
12 test active Fa0/1
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
SW1#
2.SW2通过vtp学到Vlan12,配置SW2的F0/2口属于Vlan12。

SW2#show vlan-switch brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15
12 test active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
SW2#conf t
SW2(config)#inter f0/2
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 12
SW2(config-if)#speed 100
SW2(config-if)#duplex full
SW2(config-if)#no shutdown
SW2(config-if)#exit
SW2(config)#
第五步:测试PC-R1和PC-R2是否可以ping通。

PC-R1#ping 192.168.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/55/108 ms PC-R1#
第六步:配置SW1和SW2的管理SVI口,使SW1和SW2可以互相telnet。

1.配置SW1的SVI1口IP地址12.12.12.1/24。

SW1(config)#interface vlan 1
SW1(config-if)#ip address 12.12.12.1 255.255.255.0
SW1(config-if)#exit
SW1(config)#
2.配置SW2的SVI1口IP地址12.12.12.2/24。

SW2(config)#interface vlan 1
SW2(config-if)#ip address 12.12.12.2 255.255.255.0
SW2(config-if)#exit
SW2(config)#
3.测试从SW1远程telnet到SW2的SVI1口远程管理。

SW1#telnet 12.12.12.2
Trying 12.12.12.2 ... Open
SW2#
实验4:单臂路由,不同Vlan间通信
【实验目的】:
在本实验中,要求R2与SW2模拟PC,设备名称分别为PC-R2、PC-SW2。

且PC-R2属于Vlan220,PC-SW2属于Vlan230,PC-R2和PC-SW2可以互相ping通。

R1为路由器,SW1为二层交换机,SW1通过Trunk口连接R1。

R1作为R2和SW2的网关,实现单臂路由。

同时R1也是SW1的网关,PC-R2和PC-SW2可以telnet到SW1的SVI1口进行远程管理。

•实验拓扑如图所示,R1、PC-R2、PC-SW2以各自的以太口连交换机SW1。

•PC-R2的 F0/0口地址为192.168.20.1/24,PC-SW2的 F0/0口地址为192.168.30.1/24。

PC-R2属于Vlan220,PC-SW2属于Vlan230。

•PC-R2的网关地址为192.168.20.254,PC-SW2的网关地址为192.168.30.254。

•SW1连接R1的上行口F0/1为Trunk口, R1的F0/0口起子接口F0/0.20和子接口F0/0.30。

R1的子接口F0/0.20的IP地址为192.168.20.254/24,做为PC-R2的网关,子接口F0/0.30的IP地址为192.168.30.254/24,做为PC-SW2的网关。

主接口F0/0的IP地址为10.1.1.254/24,做为SW1的网关。

•SW1的三层SVI1管理口地址为10.1.1.1/24。

【实验拓扑】:
【实验过程】:
第一步:模版化初始配置各设备。

设备名称分别为R1,PC-R2,SW1,PC-SW2。

•注意:在此以R2为例,其它设备名称不同,模版化初始配置相同,后不赘述。

Router>enable
Router#configure terminal
Router(config)#no ip domain-lookup
Router(config)#line console 0
Router(config-line)#exec-timeout 0 0
Router(config-line)#logging synchronous
Router(config-line)#exit
Router(config)#line vty 0 4
Router(config-line)#privilege level 15
Router(config-line)#no login
Router(config-line)#exec-timeout 0 0
Router(config-line)#logging synchronous
Router(config-line)#exit
Router(config)#hostname PC-R2
PC-R2(config)#
第二步:将路由器R2和SW2模拟为PC。

1.关闭R2的路由功能,将R2模拟为PC,IP地址为192.168.20.1/24,网关为192.168.20.254。

PC-R2(config)#no ip routing
PC-R2(config)#inter f0/0
PC-R2(config-if)#ip address 192.168.20.1 255.255.255.0
PC-R2(config-if)#speed 100
PC-R2(config-if)#duplex full
PC-R2(config-if)#no shutdown
PC-R2(config-if)#exit
PC-R2(config)#ip default-gateway 192.168.20.254
PC-R2(config)#exit
PC-R2#show ip route
Default gateway is 192.168.20.254
Host Gateway Last Use Total Uses Interface ICMP redirect cache is empty
PC-R2#
2.同理配置SW2,将SW2的F0/0口改为三层接口,IP地址为192.168.30.1/24,网关为192.168.30.254。

PC-SW2(config)#no ip routing
PC-SW2(config)#inter f0/0
PC-SW2(config-if)#no switchport
PC-SW2(config-if)#ip address 192.168.30.1 255.255.255.0
PC-SW2(config-if)#speed 100
PC-SW2(config-if)#duplex full
PC-SW2(config-if)#no shutdown
PC-SW2(config-if)#exit
PC-SW2(config)#ip default-gateway 192.168.30.254
PC-SW2(config)#
第三步:配置PC-R2和PC-SW2的所属Vlan,配置SW1的上行口为Trunk。

1.SW1为二层交换机,关闭路由功能。

在SW1上添加Vlan220和Vlan230。

SW1(config)#no ip routing
SW1(config)#exit
SW1#vlan database
SW1(vlan)#vlan 220
SW1(vlan)#vlan 230
SW1(vlan)#exit
SW1#show vlan-switch brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/0, Fa0/1, Fa0/2, F a0/3
Fa0/4, Fa0/5, Fa0/6, Fa0/7
Fa0/8, Fa0/9, Fa0/10, Fa0/11
Fa0/12, Fa0/13, Fa0/14, Fa0/15
220 VLAN0220 active
230 VLAN0230 active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
SW1#
2.将SW1的F0/2口划分到vlan220,F0/0口划分到vlan230。

SW1#conf t
SW1(config)#inter f0/2
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 220
SW1(config-if)#speed 100
SW1(config-if)#duplex full
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#inter f0/0
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 230
SW1(config-if)#speed 100
SW1(config-if)#duplex full
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1#show vlan-switch brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/3, Fa0/4, Fa0/5, Fa0/6
Fa0/7, Fa0/8, Fa0/9, Fa0/10
Fa0/11, Fa0/12, Fa0/13, Fa0/14 Fa0/15
220 VLAN0220 active Fa0/2
230 VLAN0230 active Fa0/0
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
SW1#
3.配置SW1的上行口F0/1为Trunk口,允许所有Vlan通过。

SW1(config)#inter f0/1
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport trunk allowed vlan all
SW1(config-if)#speed 100
SW1(config-if)#duplex full
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#
第四步:激活R1的F0/0主接口,配置子接口F0/0.20和F0/0.30的IP地址。

1.激活R1的F0/0口。

R1(config)#inter f0/0
R1(config-if)#speed 100
R1(config-if)#duplex full
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#
2.配置R1的F0/0.20子接口为PC-R2的网关,IP地址192.168.20.254/24。

R1(config)#inter f0/0.20
R1(config-subif)#encapsulation dot1Q 220
R1(config-subif)#ip add 192.168.20.254 255.255.255.0
R1(config-subif)#exit
R1(config)#
3.配置R1的F0/0.30子接口为PC-SW2的网关,IP地址192.168.30.254/24。

并查看路由表。

R1(config)#inter f0/0.30
R1(config-subif)#encapsulation dot1Q 230
R1(config-subif)#ip add 192.168.30.254 255.255.255.0
R1(config-subif)#end
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.30.0/24 is directly connected, FastEthernet0/0.30
C 192.168.20.0/24 is directly connected, FastEthernet0/0.20
R1#
第五步:测试PC-R2和PC-SW2之间是否能够互通。

1.测试PC-R2到网关是否可达。

PC-R2#ping 192.168.20.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.20.254, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/235/1028 ms
PC-R2#
2.测试PC-R2到PC-SW2的网关以及到PC-SW2是否可达。

PC-R2#ping 192.168.30.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.30.254, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/224/1032 ms
PC-R2#ping 192.168.30.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.30.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/56/132 ms PC-R2#
第六步:配置SW1的三层管理接口SVI1,R1的F0/0口做为SW1的网关,使得PC-R2和PC-SW2能够远程登陆
SW1。

1.配置SW1的SVI1口,IP地址10.1.1.1/24,网关地址10.1.1.254。

SW1(config)#interface vlan 1
SW1(config-if)#ip address 10.1.1.1 255.255.255.0
SW1(config-if)#exit
SW1(config)#ip default-gateway 10.1.1.254
SW1(config)#exit
SW1#show ip route
Default gateway is 10.1.1.254
Host Gateway Last Use Total Uses Interface ICMP redirect cache is empty
SW1#
2.配置R1的F0/0口地址10.1.1.254/24,测试R1和SW1直连是否可达。

R1(config)#inter f0/0
R1(config-if)#ip address 10.1.1.254 255.255.255.0
R1(config-if)#exit
R1(config)#exit
R1#ping 10.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds: .!!!!
Success rate is 60 percent (3/5), round-trip min/avg/max = 12/29/60 ms R1#
3.测试PC-R2是否能够远程登陆SW1。

PC-R2#telnet 10.1.1.1
Trying 10.1.1.1 ... Open
SW1#
SW1#
SW1#exit
[Connection to 10.1.1.1 closed by foreign host]
PC-R2#
4.测试PC-SW2是否能够远程登陆SW1。

PC-SW2#telnet 10.1.1.1
Trying 10.1.1.1 ... Open
SW1#
SW1#
SW1#exit
[Connection to 10.1.1.1 closed by foreign host]
PC-SW2#
实验5:配置RIP协议
【实验目的】:
在本实验中,要求路由器R1、R2和三层交换机SW1底层运行RIP协议,支持VLSM,不自动汇聚,具有防环机制。

任意网段之间路由可达。

•实验拓扑如图所示,R1和R2以各自的S1/0口连帧中继,帧中继所在网段12.12.12.0/24。

R2与SW1以太口相连,所在网段23.23.23.0/24。

•路由器R1的 Loopback0口地址为1.1.1.1/32,R2的 Loopback0口地址为2.2.2.2/32,SW1的Loopback0口地址为3.3.3.3/32。

•R1的S1/0口地址为12.12.12.1/24,R2的S1/0口地址为12.12.12.2/24。

R1封装DLCI号102,R2封装DLCI号201。

•R2的F0/0口IP地址23.23.23.2/24。

SW1的F0/2口IP地址23.23.23.3/24。

•R1、R2和SW1所有接口运行RIP。

【实验拓扑】:
【实验过程】:
第一步:模版化初始配置R1、R2和SW1。

以R1为例。

Router>enable
Router#configure terminal
Router(config)#no ip domain-lookup
Router(config)#line console 0
Router(config-line)#exec-timeout 0 0
Router(config-line)#logging synchronous
Router(config-line)#exit
Router(config)#line vty 0 4
Router(config-line)#privilege level 15
Router(config-line)#no login
Router(config-line)#exec-timeout 0 0
Router(config-line)#logging synchronous
Router(config-line)#exit
Router(config)#hostname R1
R1(config)#
第二步:配置R1、R2和SW1的Loopback接口。

1.配置R1的Loopback0口,IP地址为1.1.1.1/32。

R1(config)#interface loopback 0
R1(config-if)#ip address 1.1.1.1 255.255.255.255
R1(config-if)#exit
R1(config)#
2.配置R2的Loopback0口,IP地址为2.2.2.2/32。

R2(config)#interface loopback 0
R2(config-if)#ip address 2.2.2.2 255.255.255.255
R2(config-if)#exit
R2(config)#
3.配置SW1的Loopback0口,IP地址为3.3.3.3/32。

SW1(config)#interface loopback 0
SW1(config-if)#ip address 3.3.3.3 255.255.255.255
SW1(config-if)#exit
SW1(config)#
第三步:配置R1和R2的帧中继连接以及R2和SW1之间以太连接。

1.R1的S1/0口地址为12.12.12.1/24,封装帧中继。

R1(config)#inter s1/0
R1(config-if)#ip address 12.12.12.1 255.255.255.0
R1(config-if)#encapsulation frame-relay
R1(config-if)#no frame-relay inverse-arp
R1(config-if)#frame-relay map ip 12.12.12.2 102 broadcast R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#
2.R2的S1/0口地址为12.12.12.2/24,封装帧中继。

R2(config)#inter s1/0
R2(config-if)#ip address 12.12.12.2 255.255.255.0
R2(config-if)#encapsulation frame-relay
R2(config-if)#no frame-relay inverse-arp
R2(config-if)#frame-relay map ip 12.12.12.1 201 broadcast R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#
3.激活R2的F0/0口,IP地址23.23.23.2/24。

R2(config)#inter f0/0
R2(config-if)#ip address 23.23.23.2 255.255.255.0
R2(config-if)#speed 100
R2(config-if)#duplex full
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#
4.激活SW1的F0/2口,IP地址23.23.23.3/24。

SW1(config)#inter f0/2
SW1(config-if)#no switchport
SW1(config-if)#ip address 23.23.23.3 255.255.255.0
SW1(config-if)#speed 100
SW1(config-if)#duplex full
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#
第四步:测试R1、R2和SW1底层直连ping通。

1.测试R1、R2之间低层帧中继直连ping通。

R2#ping 12.12.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.12.12.1, timeout is 2 seconds: !!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/36/80 ms R2#
2.测试R2和SW1之间以太口直连ping通。

R2#ping 23.23.23.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 23.23.23.3, timeout is 2 seconds: !!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/36/80 ms R2#
第五步:R1、R2和SW1运行RIP协议,版本2,关闭自动汇聚,Loopback0口只收不发路由更新。

1.R1配置RIP协议。

R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#no auto-summary
R1(config-router)#passive-interface loopback 0
R1(config-router)#network 1.1.1.1
R1(config-router)#network 12.12.12.0
R1(config-router)#end。

相关文档
最新文档