看到一道题如下拓扑,问R4到达R2为选择哪条路,当时拿不准,所以设计了这个拓扑加以证明,最后证明了自己的结论。如果R4通过两条链接到达R2的COST均相等的话,就会进行负载均衡。
在这个拓扑里,根本就没有O路由与OIA路由的区别,因为OSPF是链路状态路由协议,R4从两条不同链路到达R2均是OIA的路由。
拓扑如下:
配置如下:
R1的配置
interface Loopback0
ip address 1.1.1.1 255.255.255.255
interface Serial1/1
ip address 10.10.12.1 255.255.255.252
serial restart-delay 0
!
interface Serial1/2
ip address 10.10.14.1 255.255.255.252
encapsulation frame-relay
serial restart-delay 0
frame-relay map ip 10.10.14.2 104 broadcast //这里的广播参数并不代表OSPF在HELLO包可以广播出去。
no frame-relay inverse-arp
!
router ospf 100
router-id 1.1.1.1
log-adjacency-changes
network 1.1.1.1 0.0.0.0 area 1
network 10.10.12.0 0.0.0.3 area 1
network 10.10.14.0 0.0.0.3 area 1
neighbor 10.10.14.2 //这里一定要指定邻居,使用单播建立邻居,因为在帧中继网络中,OSPF的网络类型为非广播多路访问,必须指定邻居。
//指定邻居,一定要使用直连接口,使用环回口建立不成功。
R2的配置
interface Loopback0
ip address 2.2.2.2 255.255.255.255
interface Serial1/0
ip address 10.10.12.2 255.255.255.252
serial restart-delay 0
clock rate 64000
!
interface Serial1/1
ip address 10.10.23.1 255.255.255.252
serial restart-delay 0
clock rate 64000
router ospf 100
router-id 2.2.2.2
log-adjacency-changes
network 2.2.2.2 0.0.0.0 area 0
network 10.10.12.0 0.0.0.3 area 1
network 10.10.23.0 0.0.0.3 area 0
!
R3的配置
interface Loopback0
ip address 3.3.3.3 255.255.255.255
interface Serial1/0
ip address 10.10.23.2 255.255.255.252
serial restart-delay 0
!
interface Serial1/1
ip address 10.10.34.1 255.255.255.252
serial restart-delay 0
clock rate 64000
router ospf 100
router-id 3.3.3.3
log-adjacency-changes
network 3.3.3.3 0.0.0.0 area 0
network 10.10.23.0 0.0.0.3 area 0
network 10.10.34.0 0.0.0.3 area 1
R4的配置
interface Loopback0
ip address 4.4.4.4 255.255.255.255
interface Serial1/0
ip address 10.10.34.2 255.255.255.252
serial restart-delay 0
interface Serial1/2
ip address 10.10.14.2 255.255.255.252
encapsulation frame-relay
ip ospf priority 100
serial restart-delay 0
frame-relay map ip 10.10.14.1 401 broadcast
no frame-relay inverse-arp
router ospf 100
router-id 4.4.4.4
log-adjacency-changes
network 4.4.4.4 0.0.0.0 area 1
network 10.10.14.0 0.0.0.3 area 1
network 10.10.34.0 0.0.0.3 area 1
neighbor 10.10.14.1 //指定邻居,一定要使用直连接口,使用环回口建立不成功。
R1的路由表:
R1(config)#do sh 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
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/65] via 10.10.12.2, 01:57:18, Serial1/1
3.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/129] via 10.10.14.2, 01:57:18, Serial1/2
[110/129] via 10.10.12.2, 01:57:18, Serial1/1
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/65] via 10.10.14.2, 01:57:18, Serial1/2
10.0.0.0/30 is subnetted, 4 subnets
C 10.10.12.0 is directly connected, Serial1/1
C 10.10.14.0 is directly connected, Serial1/2
O IA 10.10.23.0 [110/128] via 10.10.12.2, 01:57:18, Serial1/1
O 10.10.34.0 [110/128] via 10.10.14.2, 01:57:29, Serial1/2
R1#traceroute 3.3.3.3
Type escape sequence to abort.
Tracing the route to 3.3.3.3
1 10.10.14.2 40 msec
10.10.12.2 8 msec
10.10.14.2 24 msec
2 10.10.23.2 80 msec
10.10.34.1 76 msec *
我们看到,由于R1到R3有两条链路,而且COST相等,进行了负载。
R4#sh 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
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/65] via 10.10.14.1, 02:03:32, Serial1/2
2.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/129] via 10.10.34.1, 02:03:32, Serial1/0
[110/129] via 10.10.14.1, 02:03:32, Serial1/2
3.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/65] via 10.10.34.1, 02:03:32, Serial1/0
4.0.0.0/32 is subnetted, 1 subnets
C 4.4.4.4 is directly connected, Loopback0
10.0.0.0/30 is subnetted, 4 subnets
O 10.10.12.0 [110/128] via 10.10.14.1, 02:03:32, Serial1/2
C 10.10.14.0 is directly connected, Serial1/2
O IA 10.10.23.0 [110/128] via 10.10.34.1, 02:03:32, Serial1/0
C 10.10.34.0 is directly connected, Serial1/0
R4#
R4#tr
R4#traceroute 2.2.2.2
Type escape sequence to abort.
Tracing the route to 2.2.2.2
1 10.10.34.1 68 msec
10.10.14.1 4 msec
10.10.34.1 16 msec
2 10.10.12.2 52 msec
10.10.23.1 28 msec *
R4#
R4上面也是这样,出现了负载。