在所有的路由器上添加静态路由。
能够在小型的网络环境中配置路由表。
能够使用ping测试静态路由配置
使用Tracert跟踪数据包
排除网络故障
删除在Router3上删除到172.16.0.0/24网段的路由信息
PKA文件下载地址:https://zhifubao.lanzous.com/iRFs5dibjja
2 网络拓扑
3 基本配置步骤
试验环境应经将路由器的所有接口和计算机的Ip地址已经按着网络拓扑配置。
只需在路由器上添加静态路由表即可。
3.1 在Router2上
1 Router#show ip route 查看现有的路由表,发现只有直连的网段的路由信息 2 Router#config t 3 Router(config)#ip route 172.16.1.0 255.255.255.0 172.16.3.2 4 Router(config)#ip route 172.16.4.0 255.255.255.0 172.16.3.2 5 Router(config)#ip route 172.16.5.0 255.255.255.0 172.16.3.2 6 Router(config)#ip route 172.16.2.0 255.255.255.0 172.16.3.2 7 Router#show ip route 8 Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP 9 D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 10 N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 11 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP 12 i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area 13 * - candidate default, U - per-user static route, o - ODR 14 P - periodic downloaded static route 15 Gateway of last resort is not set 16 172.16.0.0/24 is subnetted, 6 subnets 17 C 172.16.0.0 is directly connected, FastEthernet0/0 C 直连的网络 18 S 172.16.1.0 [1/0] via 172.16.3.2 S 添加的静态路由 19 S 172.16.2.0 [1/0] via 172.16.3.2 20 C 172.16.3.0 is directly connected, Serial2/0 21 S 172.16.4.0 [1/0] via 172.16.3.2 22 S 172.16.5.0 [1/0] via 172.16.3.2 23 Router#copy running-config startup-config 24 Destination filename [startup-config]? 25 Building configuration... 26 [OK]
3.2 在Router3上添加静态路由
1 Router#config t 2 Router(config)#ip route 172.16.0.0 255.255.255.0 172.16.4.2 3 Router(config)#ip route 172.16.3.0 255.255.255.0 172.16.4.2 4 Router(config)#ip route 172.16.2.0 255.255.255.0 172.16.4.2 5 Router(config)#ip route 172.16.5.0 255.255.255.0 172.16.4.2 6 Router(config)#exit 7 %SYS-5-CONFIG_I: Configured from console by console 8 Router#show ip rout 显示路由表 9 Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP 10 D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 11 N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 12 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP 13 i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area 14 * - candidate default, U - per-user static route, o - ODR 15 P - periodic downloaded static route 16 Gateway of last resort is not set 17 172.16.0.0/24 is subnetted, 6 subnets 18 S 172.16.0.0 [1/0] via 172.16.4.2 19 C 172.16.1.0 is directly connected, FastEthernet0/0 20 S 172.16.2.0 [1/0] via 172.16.4.2 21 S 172.16.3.0 [1/0] via 172.16.4.2 22 C 172.16.4.0 is directly connected, Serial2/0 23 S 172.16.5.0 [1/0] via 172.16.4.2 24 Router#copy running-config startup-config 25 Destination filename [startup-config]? 26 Building configuration...
3.3 在Router0上添加静态路由
1 Router#config t 2 Enter configuration commands, one per line. End with CNTL/Z. 3 Router(config)#ip route 172.16.0.0 255.255.255.0 172.16.3.1 4 Router(config)#ip route 172.16.1.0 255.255.255.0 172.16.4.1 5 Router(config)#ip route 172.16.2.0 255.255.255.0 172.16.5.2 6 Router(config)# 7 Router#copy running-config startup-config 8 Destination filename [startup-config]? 9 Building configuration... 10 [OK]
3.4 在Router1上添加静态路由
1 Router#configure 2 Configuring from terminal, memory, or network [terminal]? 3 Enter configuration commands, one per line. End with CNTL/Z. 4 Router(config)#ip route 172.16.0.0 255.255.255.0 172.16.5.1 5 Router(config)#ip route 172.16.1.0 255.255.255.0 172.16.5.1 6 Router(config)#ip route 172.16.3.0 255.255.255.0 172.16.5.1 7 Router(config)#ip route 172.16.4.0 255.255.255.0 172.16.5.1 8 Router#copy running-config startup-config 9 Destination filename [startup-config]? 10 Building configuration... 11 [OK]
4 测试静态路由
4.1 在PC1上测试到PC0的连接
1 PC>ping 172.16.1.1 静态路由配置正确 2 Pinging 172.16.1.1 with 32 bytes of data: 3 Reply from 172.16.1.1: bytes=32 time=27ms TTL=253 4 Reply from 172.16.1.1: bytes=32 time=14ms TTL=253 5 Reply from 172.16.1.1: bytes=32 time=20ms TTL=253 6 Reply from 172.16.1.1: bytes=32 time=16ms TTL=253 7 PC>tracert 172.16.1.2 使用Tracert跟踪数据包 8 Tracing route to 172.16.1.2 over a maximum of 30 hops: 9 1 9 ms 6 ms 8 ms 172.16.0.1 10 2 13 ms 10 ms 10 ms 172.16.3.2 11 3 17 ms 16 ms 16 ms 172.16.4.1 12 4 23 ms 24 ms 25 ms 172.16.1.2 13 Trace complete.
4.2 在PC1上测试到PC2的连接
1 PC>ping 172.16.2.1 静态路由配置正确 2 Pinging 172.16.2.1 with 32 bytes of data: 3 Reply from 172.16.2.1: bytes=32 time=15ms TTL=253 4 Reply from 172.16.2.1: bytes=32 time=13ms TTL=253 5 Reply from 172.16.2.1: bytes=32 time=16ms TTL=253 6 Reply from 172.16.2.1: bytes=32 time=19ms TTL=253
4.3 在Router3上删除到172.16.0.0/24网段的路由
1 Router(config)#no ip route 172.16.0.0 255.255.255.0 2 Router#show ip route 3 Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP 4 D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 5 N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 6 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP 7 i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area 8 * - candidate default, U - per-user static route, o - ODR 9 P - periodic downloaded static route 10 Gateway of last resort is not set 11 172.16.0.0/24 is subnetted, 5 subnets 12 C 172.16.1.0 is directly connected, FastEthernet0/0 13 S 172.16.2.0 [1/0] via 172.16.4.2 14 S 172.16.3.0 [1/0] via 172.16.4.2 15 C 172.16.4.0 is directly connected, Serial2/0 16 S 172.16.5.0 [1/0] via 172.16.4.2 没有到172.16.0.0/24网段的路由信息
4.4 在PC1上测试到PC0的连接 发现数据包不能返回
1 PC>ping 172.16.1.1 2 3 Pinging 172.16.1.1 with 32 bytes of data: 4 5 Request timed out. 6 7 Request timed out. 8 9 Request timed out. 10 11 Request timed out. 12 13 PC>tracert 172.16.1.2 使用tracert跟踪数据包路径 14 15 Tracing route to 172.16.1.2 over a maximum of 30 hops: 16 17 1 9 ms 7 ms 8 ms 172.16.0.1 18 19 2 12 ms 14 ms 14 ms 172.16.3.2 20 21 3 * * * Request timed out. 22 23 4 * * * Request timed out. 24 25 5 * * * Request timed out.
4.5 在PC0上测试到PC1的连接
1 PC>ping 172.16.0.2 2 3 Pinging 172.16.0.2 with 32 bytes of data: 4 5 Reply from 172.16.1.1: Destination host unreachable. 提示目标主机不可到达 6 7 Reply from 172.16.1.1: Destination host unreachable. 8 9 Reply from 172.16.1.1: Destination host unreachable. 10 11 Reply from 172.16.1.1: Destination host unreachable.