实验要求: 在正常情况下要求R1能Ping 到R2的E0,因为正常情况下公司内的人是通过主线路访问网络B,即要通过R2的E0口 当主线路Down掉后要求R1能Ping到R3的E1,因为Down掉后,公司局域网要通过备份链路访问到网络B,即要通过R3的E1口。 实验配置: 在本试验中要配置浮动静态路由。要求在R1 R2路由器上启动RIP协议。R3用静态路由。R1上配置到经R3到10.0.0.0网段的路由。 开始配置:(实验用的都是3640) R1: en conf t inter s0/0 encap frame-relay frame-relay lmi-type ansi //如果是用Dyanmips实验只能用ANSI clock rate 64000 ip add 120.0.0.1 255.255.255.0 frame-relay interface-dlci 201 //这个是配置这种简单的帧中继复杂的在前面的实验中有 no shut do show inter s0/0 //最好配置完一个后查看一下是否有两个UP,如果Protocol Down掉了说明帧中继没有配置好。 inter e1/0
ip add 172.0.0.1 255.255.255.0
no shut
inter loopback0
ip add 172.0.0.1 255.255.255.0
exit
router rip
net 120.0.0.0
net 192.168.1.0 //不要把172.0.0.0宣布出去
exit
do show run //查看是否都配置对了
do write //保存一下妥当
R2:
en
conf t
inter s0/0
encap frame-relay
frame-relay lmi-type ansi
clock rate 64000
ip add 120.0.0.2 255.255.255.0
frame-relay interface-dlci 102
no shut
do show inter s0/0
inter e1/0
ip add 10.0.0.1 255.0.0.0
no shut
exit
router rip
network 120.0.0.0
network 10.0.0.0
end
show run
write
R3:
en
conf t
inter e0/0
ip add 172.0.0.2 255.255.255.0
no shut
inter E0/1
ip add 10.0.0.2 255.0.0.0
no shut
exit
ip classless
ip route 192.168.1.0 255.255.255.0 172.0.0.1
end
show run
write
验证: 现在的配置是主线路正常可以Ping到R2的E1/0口 router1(config-if)#do ping 10.0.0.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 52/89/144 ms
查看R1的路由表: router1(config)#do show ip rout
Gateway of last resort is not set
172.0.0.0/24 is subnetted, 1 subnets
C 172.0.0.0 is directly connected, Ethernet1/0
R 10.0.0.0/8 [120/1] via 120.0.0.2, 00:00:08, Serial0/0
C 192.168.1.0/24 is directly connected, Loopback0
120.0.0.0/24 is subnetted, 1 subnets
C 120.0.0.0 is directly connected, Serial0/0
没有从R3到10.0.0.0网段的路由,加一条静态的路由
router1(config)#ip route 10.0.0.0 255.0.0.0 172.0.0.2
再查看: Gateway of last resort is not set
172.0.0.0/24 is subnetted, 1 subnets
C 172.0.0.0 is directly connected, Ethernet1/0
S 10.0.0.0/8 [1/0] via 172.0.0.2
C 192.168.1.0/24 is directly connected, Loopback0
120.0.0.0/24 is subnetted, 1 subnets
C 120.0.0.0 is directly connected, Serial0/0
通过路由表我们看到,在配置了静态路由后,静态路由被选用,而RIP被忽略,这是因为静态路由的管理距离1小于RIP的120。 看一下各路由协议的管理距离: Connected interface直连 0
Static route静态路由 1(可修改)
EIGRP summary route 5
External BGP 20
Internal EIGRP 90
IGRP 100
OSPF 110
IS-IS 115
RIPV1 RIPV2 120
External RIGRP 170
Internal BGP 200
Unknown 255
为了在正常情况下用RIP,Down掉了才用静态的,这就是浮动路由,就要改静态路由的管理距离。
router1(config)#no ip route 10.0.0.0 255.0.0.0 172.0.0.2
router1(config)#ip route 10.0.0.0 255.0.0.0 172.0.0.2 121
router1(config)#do show ip route
Gateway of last resort is not set
172.0.0.0/24 is subnetted, 1 subnets
C 172.0.0.0 is directly connected, Ethernet1/0
R 10.0.0.0/8 [120/1] via 120.0.0.2, 00:00:09, Serial0/0 //看到效果了又替换回来了
C 192.168.1.0/24 is directly connected, Loopback0
120.0.0.0/24 is subnetted, 1 subnets
C 120.0.0.0 is directly connected, Serial0/0
现在Shut掉R1的S0或者R2的S0 再看R1的路由表 Gateway of last resort is not set
172.0.0.0/24 is subnetted, 1 subnets
C 172.0.0.0 is directly connected, Ethernet1/0
S 10.0.0.0/8 [121/0] via 172.0.0.2
C 192.168.1.0/24 is directly connected, Loopback0
再Ping下R3的E0/1看是否是行 router1(config-if)#do ping 10.0.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 40/113/260 ms
成功了。
|