资源描述
非等价负载均衡
如图:
R1通过R2到R3走的是Serial线路。R1通过R4到R3走的是Ethernet线路。因此是非等价的。
通常在这种情况下,路由表中只有R1->R4->R3一条路由。
现在我们通过非等价负载均衡的办法,将两条路由都放进路由表中。
环境配置
R1
Router>enable
Router#configure terminal
Router(config)#hostname r1
r1(config)#line console 0
r1(config-line)#logging synchronous
r1(config-line)#exec-timeout 0
r1(config-line)#exit
r1(config)#interface loopback 0
r1(config-if)#ip address 1.1.1.1 255.255.255.0
r1(config-if)#exit
r1(config)#interface serial 1/2
r1(config-if)#ip address 12.12.12.1 255.255.255.252
r1(config-if)#no shutdown
r1(config-if)#exit
r1(config)#interface ethernet 0/0
r1(config-if)#ip address 12.12.12.9 255.255.255.252
r1(config-if)#no shutdown
r1(config-if)#exit
r1(config)#router eigrp 1
r1(config-router)#network 1.1.1.1 0.0.0.255
r1(config-router)#network 12.12.12.1 0.0.0.3
r1(config-router)#network 12.12.12.9 0.0.0.3
r1(config-router)#no auto-summary
r1(config-router)#exit
r1(config)#exit
R2
Router>enable
Router#configure terminal
Router(config)#hostname r2
r2(config)#line console 0
r2(config-line)#logging synchronous
r2(config-line)#exec-timeout 0
r2(config-line)#exit
r2(config)#interface loopback 0
r2(config-if)#ip address 2.2.2.2 255.255.255.0
r2(config-if)#exit
r2(config)#interface serial 1/3
r2(config-if)#ip address 12.12.12.2 255.255.255.252
r2(config-if)#no shutdown
r2(config-if)#exit
r2(config)#interface serial 1/2
r2(config-if)#ip address 12.12.12.5 255.255.255.252
r2(config-if)#no shutdown
r2(config-if)#exit
r2(config)#router eigrp 1
r2(config-router)#network 2.2.2.2 0.0.0.255
r2(config-router)#network 12.12.12.2 0.0.0.3
r2(config-router)#network 12.12.12.5 0.0.0.3
r2(config-router)#no auto-summary
r2(config-router)#exit
r2(config)#exit
R3
Router>enable
Router#configure terminal
Router(config)#hostname r3
r3(config)#line console 0
r3(config-line)#logging synchronous
r3(config-line)#exec-timeout 0
r3(config-line)#exit
r3(config)#interface loopback 0
r3(config-if)#ip address 3.3.3.3 255.255.255.0
r3(config-if)#exit
r3(config)#interface serial 1/3
r3(config-if)#ip address 12.12.12.6 255.255.255.252
r3(config-if)#no shutdown
r3(config-if)#exit
r3(config)#interface ethernet 0/1
r3(config-if)#ip address 12.12.12.4 255.255.255.252
r3(config-if)#no shutdown
r3(config-if)#exit
r3(config)#router eigrp 1
r3(config-router)#network 3.3.3.3 0.0.0.255
r3(config-router)#network 12.12.12.6 0.0.0.3
r3(config-router)#network 12.12.12.14 0.0.0.3
r3(config-router)#no auto-summary
r3(config-router)#exit
r3(config)#exit
R4
Router>enable
Router#configure terminal
Router(config)#hostname r4
R4(config)#line console 0
R4(config-line)#logging synchronous
r4(config-line)#exec-timeout 0
r4(config-line)#exit
r4(config)#interface loopback 0
r4(config-if)#ip address 4.4.4.4 255.255.255.0
r4(config-if)#exit
r4(config)#interface ethernet 0/0
r4(config-if)#ip address 12.12.12.10 255.255.255.252
r4(config-if)#no shutdown
r4(config-if)#exit
r4(config)#interface ethernet 0/1
r4(config-if)#ip address 12.12.12.13 255.255.255.252
r4(config-if)#no shutdown
r4(config-if)#exit
r4(config)#router eigrp 1
r4(config-router)#network 4.4.4.4 0.0.0.255
r4(config-router)#network 12.12.12.10 0.0.0.3
r4(config-router)#network 12.12.12.13 0.0.0.3
r4(config-router)#no auto-summary
r4(config-router)#exit
r4(config)#exit
显示路由表
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
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
D 2.2.2.0 [90/2297856] via 12.12.12.2, 00:03:09, Serial1/2
3.0.0.0/24 is subnetted, 1 subnets
D 3.3.3.0 [90/435200] via 12.12.12.10, 00:02:23, Ethernet0/0
4.0.0.0/24 is subnetted, 1 subnets
D 4.4.4.0 [90/409600] via 12.12.12.10, 00:02:23, Ethernet0/0
12.0.0.0/30 is subnetted, 4 subnets
D 12.12.12.12 [90/307200] via 12.12.12.10, 00:02:24, Ethernet0/0
C 12.12.12.8 is directly connected, Ethernet0/0
D 12.12.12.4 [90/2221056] via 12.12.12.10, 00:02:23, Ethernet0/0
C 12.12.12.0 is directly connected, Serial1/2
r1#show ip eigrp topology
IP-EIGRP Topology Table for AS(1)/ID(1.1.1.1)
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
r - reply Status, s - sia Status
P 12.12.12.12/30, 1 successors, FD is 307200
via 12.12.12.10 (307200/281600), Ethernet0/0
P 1.1.1.0/24, 1 successors, FD is 128256
via Connected, Loopback0
P 2.2.2.0/24, 1 successors, FD is 2297856
via 12.12.12.2 (2297856/128256), Serial1/2
P 3.3.3.0/24, 1 successors, FD is 435200
via 12.12.12.10 (435200/409600), Ethernet0/0
P 4.4.4.0/24, 1 successors, FD is 409600
via 12.12.12.10 (409600/128256), Ethernet0/0
P 12.12.12.8/30, 1 successors, FD is 281600
via Connected, Ethernet0/0
P 12.12.12.4/30, 1 successors, FD is 2221056
via 12.12.12.10 (2221056/2195456), Ethernet0/0
via 12.12.12.2 (2681856/2169856), Serial1/2
P 12.12.12.0/30, 1 successors, FD is 2169856
via Connected, Serial1/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
1.0.0.0/24 is subnetted, 1 subnets
D 1.1.1.0 [90/2297856] via 12.12.12.1, 00:17:48, Serial1/3
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
3.0.0.0/24 is subnetted, 1 subnets
D 3.3.3.0 [90/2297856] via 12.12.12.6, 00:17:48, Serial1/2
4.0.0.0/24 is subnetted, 1 subnets
D 4.4.4.0 [90/2323456] via 12.12.12.6, 00:17:48, Serial1/2
[90/2323456] via 12.12.12.1, 00:17:48, Serial1/3
12.0.0.0/30 is subnetted, 4 subnets
D 12.12.12.12 [90/2195456] via 12.12.12.6, 00:17:49, Serial1/2
D 12.12.12.8 [90/2195456] via 12.12.12.1, 00:17:48, Serial1/3
C 12.12.12.4 is directly connected, Serial1/2
r2#show ip eigrp topology
IP-EIGRP Topology Table for AS(1)/ID(2.2.2.2)
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
r - reply Status, s - sia Status
P 12.12.12.12/30, 1 successors, FD is 2195456
via 12.12.12.6 (2195456/281600), Serial1/2
via 12.12.12.1 (2221056/307200), Serial1/3
P 1.1.1.0/24, 1 successors, FD is 2297856
via 12.12.12.1 (2297856/128256), Serial1/3
via 12.12.12.6 (2349056/435200), Serial1/2
P 2.2.2.0/24, 1 successors, FD is 128256
via Connected, Loopback0
P 3.3.3.0/24, 1 successors, FD is 2297856
via 12.12.12.6 (2297856/128256), Serial1/2
via 12.12.12.1 (2349056/435200), Serial1/3
P 4.4.4.0/24, 2 successors, FD is 2323456
via 12.12.12.1 (2323456/409600), Serial1/3
via 12.12.12.6 (2323456/409600), Serial1/2
P 12.12.12.8/30, 1 successors, FD is 2195456
via 12.12.12.1 (2195456/281600), Serial1/3
via 12.12.12.6 (2221056/307200), Serial1/2
P 12.12.12.4/30, 1 successors, FD is 2169856
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
r - reply Status, s - sia Status
via Connected, Serial1/2
P 12.12.12.0/30, 1 successors, FD is 2169856
via Connected, Serial1/3
从路由表里只能看到一条到R3的回环地址3.3.3.3(以下简称3.3.3.3)的路由
3.0.0.0/24 is subnetted, 1 subnets
D 3.3.3.0 [90/435200] via 12.12.12.10, 00:02:23, Ethernet0/0
这是从R1的Ethernet0/0接口出去经过R4到R3的3.3.3.3。
而且Topology表里面也只有一条通往R3的3.3.3.3的路径
P 3.3.3.0/24, 1 successors, FD is 435200
via 12.12.12.10 (435200/409600), Ethernet0/0
也是经过R1的Ethernet0/0接口出去经过R4到R3的3.3.3.3,出去的。
从图上可以看到,我们其实有两条路径可以选择:
R1->R2->R3->3.3.3.3
R1->R4->R3->3.3.3.3
检查R2的Topology表后,发现R2到R3的3.3.3.3路由条目
P 3.3.3.0/24, 1 successors, FD is 2297856
via 12.12.12.6 (2297856/128256), Serial1/2
的度量值为(即R1->R2->R3->3.3.3.3的通告距离):AD=2297856。
而R1的Topology表中,路径R1->R4->R3->3.3.3.3
P 3.3.3.0/24, 1 successors, FD is 435200
via 12.12.12.10 (435200/409600), Ethernet0/0
的度量值为(即R1->R4->R3->3.3.3.3的可行性距离):FD=435200。
这里AD>FD。因此路径R1->R2->R3没有进入R1的Topology表。
修改度量值
在R1上修改R1->R4->R3->3.3.3.3的度量值。
R1
r1#configure terminal
r1(config)#router eigrp 1
r1(config-router)#offset-list 1 in 1862657 ethernet 0/0
r1(config- router)#exit
r1(config)#exit
显示R1的topology表和路由表
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
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
D 2.2.2.0 [90/2297856] via 12.12.12.2, 00:20:13, Serial1/2
3.0.0.0/24 is subnetted, 1 subnets
D 3.3.3.0 [90/2297857] via 12.12.12.10, 00:05:31, Ethernet0/0
4.0.0.0/24 is subnetted, 1 subnets
D 4.4.4.0 [90/2272257] via 12.12.12.10, 00:05:31, Ethernet0/0
12.0.0.0/30 is subnetted, 4 subnets
D 12.12.12.12 [90/2169857] via 12.12.12.10, 00:05:31, Ethernet0/0
C 12.12.12.8 is directly connected, Ethernet0/0
D 12.12.12.4 [90/2681856] via 12.12.12.2, 00:05:31, Serial1/2
C 12.12.12.0 is directly connected, Serial1/2
r1#show ip eigrp topology
IP-EIGRP Topology Table for AS(1)/ID(1.1.1.1)
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
r - reply Status, s - sia Status
P 12.12.12.12/30, 1 successors, FD is 2169857
via 12.12.12.10 (2169857/2144257), Ethernet0/0
P 1.1.1.0/24, 1 successors, FD is 128256
via Connected, Loopback0
P 2.2.2.0/24, 1 successors, FD is 2297856
via 12.12.12.2 (2297856/128256), Serial1/2
P 3.3.3.0/24, 1 successors, FD is 2297857
via 12.12.12.10 (2297857/2272257), Ethernet0/0
via 12.12.12.2 (2809856/2297856), Serial1/2
P 4.4.4.0/24, 1 successors, FD is 2272257
via 12.12.12.10 (2272257/1990913), Ethernet0/0
P 12.12.12.8/30, 1 successors, FD is 281600
via Connected, Ethernet0/0
P 12.12.12.4/30, 1 successors, FD is 2221056
via 12.12.12.2 (2681856/2169856), Serial1/2
P 12.12.12.0/30, 1 successors, FD is 2169856
via Connected, Serial1/2
topology表中出现路由条目:
P 3.3.3.0/24, 1 successors, FD is 2297857
via 12.12.12.10 (2297857/2272257), Ethernet0/0
via 12.12.12.2 (2809856/2297856), Serial1/2
现在两条路由条目都已经在Topology表中了。
但是路由表中仍然只有一条路由:
3.0.0.0/24 is subnetted, 1 subnets
D 3.3.3.0 [90/2297857] via 12.12.12.10, 00:05:31, Ethernet0/0
做非等价负载均衡
R1
r1#configure terminal
r1(config)#router eigrp 1
r1(config-router)#variance 2
r1(config-router)#exit
r1(config)#exit
显示路由表
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
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
D 2.2.2.0 [90/2297856] via 12.12.12.2, 00:01:46, Serial1/2
3.0.0.0/24 is subnetted, 1 subnets
D 3.3.3.0 [90/2297857] via 12.12.12.10, 00:01:46, Ethernet0/0
[90/2809856] via 12.12.12.2, 00:01:46, Serial1/2
4.0.0.0/24 is subnetted, 1 subnets
D 4.4.4.0 [90/2272257] via 12.12.12.10, 00:01:46, Ethernet0/0
12.0.0.0/30 is subnetted, 4 subnets
D 12.12.12.12 [90/2169857] via 12.12.12.10, 00:01:46, Ethernet0/0
C 12.12.12.8 is directly connected, Ethernet0/0
D 12.12.12.4 [90/2681856] via 12.12.12.2, 00:01:46, Serial1/2
C 12.12.12.0 is directly connected, Serial1/2
这里出现了路由条目:
3.0.0.0/24 is subnetted, 1 subnets
D 3.3.3.0 [90/2297857] via 12.12.12.10, 00:01:46, Ethernet0/0
[90/2809856] via 12.12.12.2, 00:01:46, Serial1/2
显然:现在到3.3.3.3在路由表中存在有2条路由,他们是按照2:1的形式进行工作的。即从Ethernet0/0出去两个数据包,从Serial1/2出去一个数据包。
说明:
要做到非等价负载均衡的首要条件是两条路由都在路由器的Topology表中。即:满足DUAL算法(次要路径的通告距离AD<主路径的可行性距离FD)。
展开阅读全文