1.
预配置
r1(config-if)#int s1/2
r1(config-if)#ip ad 12.1.1 .1 255.255.255.0
r1(config-if)#no sh
r1(config-if)#int lo0
r1(config-if)#ip ad 1.1.1 .1 255.255.255.0
r1(config-if)#int s1/3
r1(config-if)#ip ad 13.1.1 .1 255.255.255.0
r1(config-if)#no sh
r1(config-if)#router rip
r1(config-router)#net 1.1.1 .0
r1(config-router)#net 12.1.1 .0
r1(config-router)#no auto-summary
r1(config-router)#ver 2
不把
13.1.1
.0/24
的网段宣告进来,为了做静态路由。
r1(config)#ip route 3.3.3 .0 255.255.255.0 13.1.1.3 150
设静态路由的管理距离为
150
r2(config)#int s2/1
r2(config-if)#ip ad 12.1.1 .2 255.255.255.0
r2(config-if)#no sh
r2(config-if)#int s2/3
r2(config-if)#ip ad 23.1.1 .2 225.255.255.0
r2(config-if)#no sh
r2(config-if)#
r2(config-if)#router rip
r2(config-router)#net 12.1.1 .0
r2(config-router)#net 23.1.1 .0
r2(config-router)#no au
r2(config-router)#ver 2
r3(config)#int s3/2
r3(config-if)#ip ad 23.1.1 .3 255.255.255.0
r3(config-if)#no sh
r3(config-if)#int s3/1
r3(config-if)#ip ad 13.1.1 .3 255.255.255.0
r3(config-if)#no sh
r3(config-if)#router rip
r3(config-router)#net 3.3.3 .0
r3(config-router)#net 23.1.1 .0
r3(config-router)#no au
r3(config-router)#ver 2
不把
13.1.1
.0/24
的网段宣告进来,为了做静态路由。
r3(config)#ip route 1.1.1 .0 255.255.255.0 13.1.1.1 150
2.
查看
r1#sho 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
Gateway of last resort is not set
1.0.0 .0/24 is subnetted, 1 subnets
C 1.1.1 .0 is directly connected, Loopback0
3.0.0 .0/24 is subnetted, 1 subnets
可以看到用
RIP
学到路由
3.3.3.0/24,
因为
RIP
的管理距离是
120
,小于静态路由的管理距离
150
,所以静态路由出于备份的地位。
R 3.3.3 .0/24 is possibly down,
routing vi a 12.1.1 .2, Serial1/2
13.0.0 .0/24 is subnetted, 1 subnets
C 13.1.1 .0 is directly connected, Serial1/3
23.0.0 .0/24 is subnetted, 1 subnets
R 23.1.1 .0/24 is possibly down,
routing vi a 12.1.1 .2, Serial1/2
3.
把
S1/2
关闭,再看路由表
r1#sho 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
Gateway of last resort is not set
1.0.0 .0/24 is subnetted, 1 subnets
C 1.1.1 .0 is directly connected, Loopback0
3.0.0 .0/24 is subnetted, 1 subnets
S 3.3.3 .0 [150/0] vi a 13.1.1 .3
通过静态路由学到
3.3.3.0/24
的网络
13.0.0 .0/24 is subnetted, 1 subnets
C 13.1.1 .0 is directly connected, Serial1/3
4.
把
S1/2
打开看路由表
r1#sho 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
Gateway of last resort is not set
1.0.0 .0/24 is subnetted, 1 subnets
C 1.1.1 .0 is directly connected, Loopback0
3.0.0 .0/24 is subnetted, 1 subnets
R 3.3.3 .0 [120/2] vi a 12.1.1 .2, 00:00:10, Serial1/2
12.0.0 .0/24 is subnetted, 1 subnets
C 12.1.1 .0 is directly connected, Serial1/2
13.0.0 .0/24 is subnetted, 1 subnets
C 13.1.1 .0 is directly connected, Serial1/3
23.0.0 .0/24 is subnetted, 1 subnets
R 23.1.1 .0 [120/1] vi a 12.1.1 .2, 00:00:10, Serial1/2
现在可以见到静态路由又处于备份的地位。