实验目的:使用静态路由进行路由选择配置。
预配置
第一步 R1的配置
R1(config)#interface loopback 0
R1(config-if)#ip address
R1(config-if)#exit
R1(config)#interface serial1/2
R1(config-if)#no shutdown
R1(config-if)#ip address 192.168.0.1 255.255.255.0
R1(config-if)#exit
R1(config)#interface serial1/3
R1(config-if)#no shutdown
R1(config-if)#ip address 172.16.0.1 255.255.255.0
R1(config-if)#exit
第二步 R2的配置
R2(config)#interface loopback 0
R2(config-if)#ip address
R2(config-if)#exit
R2(config)#interface serial2/1
R2(config-if)#no shutdown
00:17:02: %LINK-3-UPDOWN: Interface Serial2/1, changed state to up
00:17:03: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/1, changed state to up
R2(config-if)#ip address 192.168.0.2 255.255.255.0
R2(config-if)#interface serial2/3
R2(config-if)#no shutdown
00:17:36: %LINK-3-UPDOWN: Interface Serial2/3, changed state to up
00:17:37: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/3, changed state to up
R2(config-if)#ip address
00:18:02: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/3, changed state to down
R2(config-if)#exit
第三步 R3的配置
R3(config)#interface loopback0
R3(config-if)#ip address
R3(config-if)#interface serial3/1
R3(config-if)#no shutdown
00:21:08: %LINK-3-UPDOWN: Interface Serial3/1, changed state to up
00:21:09: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial3/1, changed state to up
R3(config-if)#ip address 172.16.0.3 255.255.255.0
R3(config-if)#interface serial3/2
R3(config-if)#no shutdown
00:21:51: %LINK-3-UPDOWN: Interface Serial3/2, changed state to up
00:21:52: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial3/2, changed state to up
R3(config-if)#ip address
R3(config-if)#exit
配置过程
第一步 在R1上加入R2-R3的网段的路由
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, * - candidate default
U - per-user static route, o - ODR
T - traffic engineered route
Gateway of last resort is not set
C
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.0.0 is directly connected, Serial1/3
C 192.168.0.0/24 is directly connected, Serial1/2
现在R1上还没有R2-R3的路由
配置
R1(config)#ip route
R1(config)#^Z
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, * - candidate default
U - per-user static route, o - ODR
T - traffic engineered route
Gateway of last resort is not set
C
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.0.0 is directly connected, Serial1/3
S
C 192.168.0.0/24 is directly connected, Serial1/2
现在看到一条路由 S 去
第二步 加入路由后在R1上ping
在R1上ping
R1#ping
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to
.....
Success rate is 0 percent (0/5)
在R1上Ping不成功
为什么没ping成功??debug看一下
R1#debug ip icmp
ICMP packet debugging is on
打开debug ip icmp 可以查看router经过的所有icmp协议的包显示出来。
发现没有从R3上回来的包 所以ping不成功。
第三步 根据现在配置,去R3上进行调试
R3#debug ip icmp
ICMP packet debugging is on
再回到R1上ping
在R3上看到
R3#
00:45:25: ICMP: echo reply sent, src
R3#
00:45:27: ICMP: echo reply sent, src
R3#
00:45:29: ICMP: echo reply sent, src
R3#
00:45:31: ICMP: echo reply sent, src
R3#
00:45:33: ICMP: echo reply sent, src
发现R3不仅收到R1的icmp echo包,而且还向192.168.0.1发出了icmp echo reply
R3#show ip route
来源:http://www.cnblogs.com/chengjunchao/archive/2011/10/24/2222354.html