如下拓扑:
基本配置完成:
R1上:
R1#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
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
C 192.168.6.0/24 is directly connected, FastEthernet0/0
C 192.168.1.0/24 is directly connected, Serial1/1
R 192.168.2.0/24 [120/1] via 192.168.6.3, 00:00:05, FastEthernet0/0
[120/1] via 192.168.6.2, 00:00:02, FastEthernet0/0
[120/1] via 192.168.1.2, 00:00:05, Serial1/1
R1(config)#router rip
R1(config-router)#offset-list 1 in 6 给所有路由增加跳数。
如下路由表:
R1#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
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
C 192.168.6.0/24 is directly connected, FastEthernet0/0
C 192.168.1.0/24 is directly connected, Serial1/1
R 192.168.2.0/24 [120/7] via 192.168.6.3, 00:00:00, FastEthernet0/0
[120/7] via 192.168.6.2, 00:00:00, FastEthernet0/0
[120/7] via 192.168.1.2, 00:00:00, Serial1/1
R1#config t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#
等价多条路径的出现,可以负载均衡,但是为了指定通信线路(带宽等因素)
可以手工增加跳数,
比如:s1/1带宽500K, Fa0/0带宽 100K,指定通信为s1/1
在R1上进行如下配置:
R1(config-router)#offset-list 1 in 6 fa0/0
R1(config-router)#end
查看:
R1#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
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
C 192.168.6.0/24 is directly connected, FastEthernet0/0
C 192.168.1.0/24 is directly connected, Serial1/1
R 192.168.2.0/24 [120/1] via 192.168.1.2, 00:00:01, Serial1/1
实现指定通信线路,通信。当S1/1断掉的时候,
R1(config)#int s1/1
R1(config-if)#shutdown
R1(config-if)#end
R1#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
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
C 192.168.6.0/24 is directly connected, FastEthernet0/0
R 192.168.1.0/24 [120/7] via 192.168.6.2, 00:00:00, FastEthernet0/0
R 192.168.2.0/24 [120/7] via 192.168.6.3, 00:00:00, FastEthernet0/0
[120/7] via 192.168.6.2, 00:00:00, FastEthernet0/0
实现了线路的浮动路由。
下面深化该试验:
在R3上增加:
LO1:192.168.10.1
LO2:192.168.20.1
LO3:192.168.30.2
在R2路由上可以看到:
R2#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
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
R 192.168.30.0/24 [120/1] via 192.168.6.3, 00:00:09, FastEthernet0/0
[120/1] via 192.168.2.2, 00:00:07, Serial1/1
R 192.168.10.0/24 [120/1] via 192.168.6.3, 00:00:09, FastEthernet0/0
[120/1] via 192.168.2.2, 00:00:07, Serial1/1
R 192.168.20.0/24 [120/1] via 192.168.6.3, 00:00:09, FastEthernet0/0
[120/1] via 192.168.2.2, 00:00:07, Serial1/1
C 192.168.6.0/24 is directly connected, FastEthernet0/0
C 192.168.1.0/24 is directly connected, Serial1/0
C 192.168.2.0/24 is directly connected, Serial1/1
下面
192.168.30.0
192.168.20.0两个网络段的等价路由的线路带宽相近,就负载均衡通信;
192.168.10.0,等价线路,差距大,想指定fa0/0 通信,s1/0接口路由做备份线路。
如下配置:
R2(config)#access-list 1 permit 192.168.10.0 0.0.0.255
R2(config-router)#offset-list 1 in 6 s1/1
查看路由:
R2#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
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
R 192.168.30.0/24 [120/1] via 192.168.6.3, 00:00:01, FastEthernet0/0
[120/1] via 192.168.2.2, 00:00:01, Serial1/1
R 192.168.10.0/24 [120/1] via 192.168.6.3, 00:00:01, FastEthernet0/0
R 192.168.20.0/24 [120/1] via 192.168.6.3, 00:00:01, FastEthernet0/0
[120/1] via 192.168.2.2, 00:00:01, Serial1/1
C 192.168.6.0/24 is directly connected, FastEthernet0/0
C 192.168.1.0/24 is directly connected, Serial1/0
C 192.168.2.0/24 is directly connected, Serial1/1
R2#
试验成功。