CCNA实验手册 下载本文

内容发布更新时间 : 2024/5/8 6:42:08星期一 下面是文章的全部内容请认真阅读。

host-association: none Administrative private-vlan mapping: none Administrative private-vlan trunk native VLAN: none Administrative private-vlan trunk encapsulation: dot1q Administrative

private-vlan trunk normal VLANs: none Administrative private-vlan trunk private VLANs: none Operational private-vlan: none Trunking VLANs Enabled: ALL Pruning VLANs Enabled: 2-1001 Capture Mode Disabled Capture VLANs Allowed: ALL Protected: false Appliance trust: none SW1# 用两台 2500 的路由器作为 PC 测试: 配置 PC1: PC1(config)#no ip routing 百思学网络,领先科技 -66- HTTP://WWW.BESTXUE.CN

PC1(config)#int e0 PC1(config-if)#ip address 10.1.2.1 255.255.255.0 PC1(config-if)#no sh PC1(config-if)#exit PC1(config)#ip default-gateway 10.1.2.254 配置 PC2: PC2(config)#no ip

routing PC2(config)#int e0 ---------------注:把路由器作为 PC,关闭路由功能,设置接口 IP 地址和网关PC2(config-if)#ip address 10.1.3.1 255.255.255.0 PC2(config-if)#no sh PC2(config-if)#exit PC2(config)#ip default-gateway 10.1.3.254 --------------注:把路由器作为 PC,关闭路由功能,设置接口 IP 地址和网关 测试: 测试 PC1 到网关的连通性: PC1#ping 10.1.2.254 Type escape

sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.2.254, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms 测试 PC1 到 PC2 的连通性: PC1#ping 10.1.3.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.3.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/8 ms 在 PC1 用 traceroute 跟踪到目标主机 10.1.3.1 是否经过网关. PC1#traceroute 10.1.3.1 Type

escape sequence to abort. Tracing the route to 10.1.3.1 1 10.1.2.254 0 msec 4 msec 4 msec -------------注:经过网关到达目的地址 2 10.1.3.1 4 msec * 4 msec PC1# 百思学网络,领先科技 -67- HTTP://WWW.BESTXUE.CN

实验17. 三层交换机实现 VLAN 之间互访 实验拓扑:

实验要求: 1. 分别在 SW1 和 SW2 上创建 VLAN2 和 VLAN3 , 在 SW2 上把 F0/2 加入 VLAN2,F0/3 加入 VLAN3,端 口 F0/1 设置为 802.1Q 的 Trunk. 2. 把 SW1 的 F0/1 设置成 802.1Q 的 Trunk, 启 SVI 接口,使得 SW2 的 VLAN2 和 VLAN3 主机之间可以 互相访问. 配置步骤: 配置 SW2: (2950 交换机) SW2(config)#vlan 2-3 ---------------注〆在 SW2 上创建 VLAN2,VLAN3 SW2(config)#int f0/2 SW2(config-if)#switchport mode access

SW2(config-if)#switchport access vlan 2 ---------------注〆把端口 F0/2 加入到 VLAN2

SW2(config)#int f0/3 SW2(config-if)#switchport mode access SW2(config-if)#switchport access vlan 3 ---------------注〆把端口 F0/3 加入到 VLNA3 SW2(config)#int f0/1 SW2(config-if)#switchport mode trunk ---------------注〆设置 F0/1 为 trunk 端口 配置 SW1:(3550 交换机) SW1(config)#ip routing ------------注:启用三层交换机的路由功能,默认是关闭的 SW1(config)#vlan 2-3 -------------注:创建 VLAN2,VLAN3 SW1(config)#int f0/1

SW1(config-if)#switchport trunk encapsulation dot1q SW1(config-if)#switchport mode trunk ---------注:设置 F0/1 的 802.1Q trunk,必须要先封装再设置为 trunk 模式 SW1(config)#int vlan 2 SW1(config-if)#ip address 10.1.2.254 255.255.255.0 SW1(config-if)#no sh -----------注:创建 SVI 2 的三层接口并配置 IP 地址,并启用接 口,这个接口 IP 作为 VLAN2 主机的网关

SW2 SW1

802.1Q Trunk

VLAN2 网段:10.1.2.0/24 VLAN3 网段:10.1.3.0/24

PC2:10.1.3.1/24 GW:10.1.3.254 PC1:10.1.2.1/24 GW:10.1.2.254 SW1为3550 SW2为2950

百思学网络,领先科技 -68- HTTP://WWW.BESTXUE.CN

SW1(config)#int vlan 3 SW1(config-if)#ip address 10.1.3.254 255.255.255.0 SW1(config-if)#no sh -----------注:创建 SVI 3 的三层接口并配置 IP 地址,并启用接 口,这个接 口 IP 作为 VLAN3 主机的网关在 SW1 上用 show 命令查看刚才的配置: SW1#show run int vlan 2 interface

Vlan2 ip address 10.1.2.254 255.255.255.0 end SW1#show int vlan 2 Vlan2 is up, line protocol is up Hardware is EtherSVI, address is 000d.bcb4.c500 (bia 000d.bcb4.c500) Internet address is

10.1.2.254/24 SW1#show run int vlan 3 interface Vlan3 ip address 10.1.3.254 255.255.255.0 end SW1#show int vlan 3 Vlan3 is up, line protocol is up Hardware is EtherSVI, address is 000d.bcb4.c500 (bia 000d.bcb4.c500)

Internet address is 10.1.3.254/24 SW1#show int f0/1 switchport Name: Fa0/1 Switchport: Enabled Administrative Mode: trunk Operational Mode: trunk Administrative Trunking Encapsulation: dot1q Operational Trunking Encapsulation: dot1q SW1#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, E - EGP 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 10.0.0.0/24 is subnetted, 2 subnets C 10.1.3.0 is directly connected, Vlan3 C 10.1.2.0 is directly connected, Vlan2

在 SW2 上用 show 命令查看刚才的配置: SW2#show run int f0/2 interface FastEthernet0/2 switchport access vlan 2

switchport mode access end SW2#show run int f0/3 interface FastEthernet0/3 switchport access vlan 3 switchport mode access end SW2#show int f0/1 switchport Name: Fa0/1 Switchport: Enabled 百思学网络,领先科技 -69- HTTP://WWW.BESTXUE.CN

Administrative Mode: trunk Operational Mode: trunk Administrative Trunking Encapsulation: dot1q Operational Trunking Encapsulation: dot1q Negotiation of Trunking: On Access Mode VLAN: 1 (default) Trunking Native Mode VLAN: 1 (default) Voice VLAN: none Administrative private-vlan host-association: none Administrative private-vlan mapping: none Administrative private-vlan trunk native VLAN: none Administrative private-vlan trunk encapsulation: dot1q Administrative

private-vlan trunk normal VLANs: none Administrative private-vlan trunk private VLANs: none Operational private-vlan: none Trunking VLANs Enabled: ALL Pruning VLANs Enabled: 2-1001 Capture Mode Disabled Capture VLANs Allowed: ALL Protected: false Appliance trust: none 测试:本实验用两台 2500 的路由器作为 PC 测试。 配置 PC1: PC1(config)#no ip routing PC1(config)#int e0 PC1(config-if)#ip address 10.1.2.1 255.255.255.0 PC1(config-if)#no sh

PC1(config)#ip default-gateway 10.1.2.254 ---------注:把路由器作为 PC,关闭路由功能,设置接口 IP 地址和网关 配置 PC2: PC2(config)#no ip routing PC2(config)#int e0 PC2(config-if)#ip address 10.1.3.1 255.255.255.0 PC2(config-if)#no sh PC2(config)#ip default-gateway 10.1.3.254 ----------注:把路由器作为 PC,关闭路由功能,设置接口 IP 地址和网关 测试 PC1 到网关的连通性:

PC1#ping 10.1.2.254 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.2.254, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms 测试 PC1 到 PC2 的连通性: PC1#ping 10.1.3.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.3.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/8 ms 在 PC1 用 traceroute 跟踪到目标主机 10.1.3.1 是否经过网关. PC1#traceroute 10.1.3.1 Type escape sequence to abort. Tracing the route to 10.1.3.1 1 10.1.2.254 0 msec 4 msec 4 msec ---------------注:经过网关到达目的地址 2 10.1.3.1 4 msec * 4 msec 百思学网络,领先科技 -70- HTTP://WWW.BESTXUE.CN

实验18. 配置静态路由

实验拓扑:

试验环境:两台2500系列路由器通过串口相连。 要求:在R1和R2上启用静态路由,使两端网络能够互通。 步骤一、基本配置 Router> Router>enable Router#config terminal Router(config)#hostname R1 R1(config)#no ip domain-lookup R1(config)#line console 0

R1(config-line)# logging synchronous R1(config-line)#exec-timeout 0 0 R1(config-line)#exit 步骤二:接口配置 R1的配置: R1(config)#interface s0 R1(config-if)#ip address 30.1.1.1 255.255.255.0 R1(config-if)#clock rate 64000 ?时钟速率端 R1(config-if)#no shutdown R1(config-if)#interface loopback 0 R1(config-if)#ip address 10.1.1.1 255.255.255.0 R1(config-if)# R2的配置:

Router(config)#hostname R2 R2(config)#interface s1 R2(config-if)#ip address 30.1.1.2 255.255.255.0 R2(config-if)#no shutdown R2(config-if)#interface loopback 0 R2(config-if)#ip address 20.1.1.1 255.255.255.0 R2(config-if)#exit R2(config)# 步骤三、指定静态路由 R1(config)# R1(config)#ip route 20.1.1.0 255.255.255.0 serial 0 ?指定静态路由 R2(config)# IP:30.1.1.x/24 Loop0:20.1.1.1/24 Loop0:10.1.1.1/24 S1 S0 R2 R1

百思学网络,领先科技 -71- HTTP://WWW.BESTXUE.CN

R2(config)#ip route 10.1.1.0 255.255.255.0 30.1.1.1 ?指定静态路由 步骤四、作ping 测试

R1#ping Protocol [ip]: Target IP address: 20.1.1.1 ?目的地址 Extended commands [n]: y ?是否用扩展命令 Source address or interface: 10.1.1.1 ?源地址 !!!!! ?显示已通 步骤五、显示静态路由条目 R1#show ip route Codes: C - connected, S - static, I - IGRP, 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, E - EGP i - IS-IS, 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 20.0.0.0/24 is subnetted, 1 subnets S 20.1.1.0 is directly connected, Serial0 ?静态路由条目 10.0.0.0/24 is

subnetted, 1 subnets C 10.1.1.0 is directly connected, Loopback0 30.0.0.0/24 is subnetted, 1 subnets C 30.1.1.0 is directly connected, Serial0

步骤六、显示当前配置 R1的配置结果: R1#show running-config ! hostname R1 ! no ip

domain-lookup ! interface Loopback0 ip address 10.1.1.1 255.255.255.0 ! interface Serial0 ip address 30.1.1.1 255.255.255.0 clockrate 64000 ! ip route 20.1.1.0 255.255.255.0 Serial0 ! line con 0 exec-timeout 0 0 logging synchronous transport input none R2的配置结果: R2#show

running-config ! hostname R2 ! no ip domain-lookup ! interface Loopback0 ip address 20.1.1.1

255.255.255.0 ! interface Serial1 ip address 30.1.1.2 255.255.255.0 ! ip route 10.1.1.0 255.255.255.0 30.1.1.1 ! line con 0 exec-timeout 0 0 logging synchronous ! end

百思学网络,领先科技 -72- HTTP://WWW.BESTXUE.CN

实验19. 配置RIP 1.1 实验目的 学会用RIP协议配置动态路由; 1.2 实验内容

??学习关于RIP一些基本知识; ??了解RIP协议的特点; ??明确RIP缺点和优点; ??学习如何配置基本RIP命令; ??知道使用RIP协议所带来的问题。

1.3 实验步骤 按照下面的指示,连接网络设备 1、在全局配置模式下键入router rip(启动路由协议)々 2、在(config-router)模式下键入network network number(选择相关的网络或子网络号)々 3、保存当前配置(使用copy run start)。 Lab_E Lab_D Lab_A Lab_C Lab_B

210.93.105.0 net E0

E0 S1

204.204.7.0 net S0(DCE) E0 S1

199.6.13.0 net 223.8.151.0 net 219.17.100.0 net E0

S0(DCE) S1

201.100.11.0 net S0(DCE) E0 E1

205.7.5.0 net 192.5.5.0 net

1.4实验参考:

百思学网络,领先科技 -73- HTTP://WWW.BESTXUE.CN

列出本小组所用的网络号清单: RouterA(config)#router rip RouterA(config-router)#network 201.100.11.0 RouterA(config-router)#newtork 192.5.5.0 RouterB(config)#router rip

RouterB(config-router)#network 201.100.11.0 RouterB(config-router)#network 199.6.13.0 RouterB(config-router)#network 219.17.100.0 RouterC(config)#router rip

RouterC(config-router)#network 199.6.13.0 RouterC(config-router)#network 204.204.7.0 RouterC(config-router)#network 223.8.151.0 RouterD(config)#router rip

RouterD(config-router)#network 204.204.7.0 RouterD(config-router)#network 210.93.105.0

RouterD(config)#router rip RouterD(config-router)#network 210.93.105.0 设置RIP协议的过程〆 首先配置了各台路由器上的基本设置,比如路由器标识、端口的地址配置々 然后检查各路由器上是否已存在RIP路由协议,或其他动态路由协议,或静态协议,如果有,则将这些协议关闭掉々 随后启用RIP动态协议,将上面的子网地址配置上去就可以了々 配置完以后,还应进行相应的检查,检查RIP协议是否成功的在起作用了,最简单的检查命令是PING命令々 如果成功那么配置就算完成了,如果没有成功PING通的话,则需要再做具体的检测通过,检查一下物理连接,协议配置是否成功等等的问题。 如下RIP协议特性保证网络的稳定性 在RIP中,路由器向所有直接相连的网络广播所有它已知的网络々 RIP路由器监听RIP广播,从而了解到不能直接知道的那些网络々 RIP的度量是跳数,RIP的最大跳数是15,每个网络的度量在RIP广播中公告々 更新定时发送。

百思学网络,领先科技 -74- HTTP://WWW.BESTXUE.CN

实验20. 配置EIGRP 实验拓扑:

实验目的〆 确保路由器之间接口IP地址信息已经设置好,能够端到端的ping通。 实验步骤〆 命令〆 1.定义自治系统(AS)号并启用EIGRP; R1(config)#router eigrp {AS-number} 2.宣告直连主类网络号〆 R1(config-router)#network {network-number} 解析〆EIGRP作为IGRP的扩展,它同时集合了距离矢量和链路状态路由协议的特点。 参与同一EIGRP进程的EIGRP路由器必须处于相同的AS里,接下来只要需要宣告直连 的主类网络号即可。 自治系统(AS)〆指定区域里,有统一的管理策略,对外表现出一个单一实体的属 性,每个自治系统有一个全局唯一的自治系统号。 R1配置 R1>enable R1#configure terminal R1(config)#interface Serial0/0/0 R1(config-if)#ip address 192.168.1.1 255.255.255.0 R1(config-if)#no shutdown R1(config)#router eigrp 100

R1(config-router)#network 192.168.1.0 R2配置与R3配置跟R1类似,同学们自己配置 验证〆 R3#show ip route 省略。。。 Gateway of last resort is not set C 172.16.0.0/16 is directly connected, Serial0/0/0 D 192.168.1.0/24 [90/21024000] via 172.16.1.1, 00:00:36, Serial0/0/0 百思学网络,领先科技 -75- HTTP://WWW.BESTXUE.CN

实验21. 配置单区域OSPF 实验拓扑:

实验目的: 在配置协议之前,要确保路由器之间接口IP地址信息已经设置好,能够端到端的ping通 实验步骤: 命令模式: 1.启用OSPF进程: Router(config)#router ospf {process-id} 2.定义参与OSPF进程的接口和网络: Router(config-router)#network {ip-address} {wildcard-mask}

area{area-id} 解析;OSPF进程ID可以使用1到65535中任何一个整数,改ID只是本地的一个标识,即一个OSPF网络 每台路由器的进程ID是否一样,和OSPF网络能够正常运行无关,在定义OSPF路由器要宣告的区域的 时候,反掩码用开控制要宣告的范围,0表示精确匹配,255表示任意匹配。OSPF网络中骨干区域为 区域0,因此必须要有区域0. Router1配置如下: Router(config)router ospf 3 Router(config-routernetwork 172.16.0.0 0.0.255.255 area 0 Router(config-routernetwork 192.168.0.0 0.0.0.255 area 0 其他路由器配置与Router1类似,同学们自己配置 测试:

Router#show ip route ````省略 Gateway of last resort is not set O 10.0.0.0/8 [110/2] via 172.16.0.2, 00:08:48, FastEthernet0/1 通过OSPF学习的路由 C 172.16.0.0/16 is directly connected, FastEthernet0/1 C 192.168.0.0/24 is directly connected, FastEthernet0/0 Router#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 192.168.0.1 1 FULL/BDR 00:00:32 192.168.0.1 FastEthernet0/0 172.16.0.2 1 FULL/BDR 00:00:32 172.16.0.2 FastEthernet0/1 观察、检验OSPF配置: Router#debug ip ospf events //OSPF协议运作的各种信息 用no shut 命令打开各路由器上的以太网口。 Router(config-)#int f0 Router(config-if)#no shut 观察路由器输出的debug信息。

百思学网络,领先科技 -76- HTTP://WWW.BESTXUE.CN

在各个路由器确立邻居关系之后: Router#show ip ospf neighbor //检查路由器邻接状态 Router#show ip protocols //查看运行的路由协议及协议相关的信息 Router#show ip ospf //查看OSPF协议信息及各种计时器 Router#show ip ospf interface e0 //查看OSPF的接口相关配置,比如hello间隔 Router#debug ip ospf adj //查看邻接关系相关的信息 4.优先修改接口优先级,观察优先级对选举过程的影响 观察默认优先级:R1#show ip ospf interface 观察默认优先级下,router ID如何影响DR/BDR的选举: R1#show ip ospf neighbor

修改优先级: 路由器1: R1(config)#int e0 R1(config-if)#ip ospf priority 0 路由器2: R2(config)#int e0

R2(config-if)#ip ospf priority 1 路由器3: R3(config)#int e0

R3(config-if)#ip ospf priority 2

重新开始DR/BDR选举过程(把各个路由器的以太网口shut down,过了down机间隔时间之后,重新用no shut命令打开) 观察选举结果:R1#show ip ospf neighbor R1#show ip ospf neighbor detail 5.修改update timer (选做) 查看默认的hello间隔和down判定间隔: R1#sh ip ospf int e0

使用以下命令修改 R1#interface e0 R1#ip ospf hello-interval * R1#ip ospf dead-interval * 由于hello时间间隔有相等的要求,建议大家先改动一台router的参数后,用debug ip ospf events命令观察:不一致的timer使得ospf 路由器无法正常通信。 6.配置认证 在R1接口上配置OSPF认证口令: R1(config)#int e0

R1(config-if)# ip ospf authentication-key cisco 以整个OSPF区域为基础启用认证功能: