CCNP-EIGRP不等价负载均衡
CCNP-EIGRP不等價負載均衡:
實驗拓撲:
?
?
?
實驗目標:
EIGRP的不等價負載均衡。(因為等價的負載均衡比較簡單,這里討論不等價的負載均衡)
路由基本配置(略)
IP地址配置:
r1(config)#in s1/0
r1(config-if)#ip add 219.146.0.1 255.255.255.0
r1(config-if)#no sh
r1(config-if)#in s1/1
r1(config-if)#ip add 219.146.1.1 255.255.255.0
r1(config-if)#no sh
r1(config-if)#exi
r2(config)#in s1/0
r2(config-if)#ip add 219.146.2.1 255.255.255.0
r2(config-if)#no sh
r2(config-if)#in s1/1
r2(config-if)#ip add 219.146.1.2 255.255.255.0
r2(config-if)#no sh
r2(config-if)#exi
r3(config)#in s1/0
r3(config-if)#ip add 219.146.0.2 255.255.255.0
r3(config-if)#no sh
r3(config-if)#in s1/1
r3(config-if)#ip add 219.146.2.2 255.255.255.0
r3(config-if)#no sh
r3(config-if)#in s1/2
r3(config-if)#ip add 219.146.3.1 255.255.255.0
r3(config-if)#no sh
r3(config-if)#exi
r4(config)#in s1/0
r4(config-if)#ip add 219.146.3.2 255.255.255.0
r4(config-if)#no sh
r4(config-if)#exi
EIGRP配置:
r1(config)#router e 10
r1(config-router)#no au
r1(config-router)#net 219.146.0.0 0.0.1.255
r1(config-router)#exi
r2(config)#router e 10
r2(config-router)#no au
r2(config-router)#net 219.146.1.0 0.0.0.255
r2(config-router)#net 219.146.2.0 0.0.0.255
r2(config-router)#exi
r3(config)#router e 10
r3(config-router)#no au
r3(config-router)#net 219.146.0.0 0.0.0.255
r3(config-router)#net 219.146.2.0 0.0.1.255
r3(config-router)#exi
r4(config)#router e 10
r4(config-router)#no au
r4(config-router)#net 219.146.3.0 0.0.0.255y
r4(config-router)#exi
查看一下R1和R2路由表:
r1(config)#do sh ip rou
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
D??? 219.146.2.0/24 [90/2681856] via 219.146.1.2, 00:09:49, Serial1/1
??????????????????? [90/2681856] via 219.146.0.2, 00:09:49, Serial1/0
D??? 219.146.3.0/24 [90/2681856] via 219.146.0.2, 00:09:48, Serial1/0
C??? 219.146.0.0/24 is directly connected, Serial1/0
C??? 219.146.1.0/24 is directly connected, Serial1/1
r2(config)#do sh ip rou
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??? 219.146.2.0/24 is directly connected, Serial1/0
D??? 219.146.3.0/24 [90/2681856] via 219.146.2.2, 00:10:18, Serial1/0
D??? 219.146.0.0/24 [90/2681856] via 219.146.2.2, 00:10:18, Serial1/0
??????????????????? [90/2681856] via 219.146.1.1, 00:10:18, Serial1/1
C??? 219.146.1.0/24 is directly connected, Serial1/1
這里已經有等價的負載均衡,主要看一下R1和R2到R4的路由,從拓撲圖來看,是有兩條路由的,但這里卻只有一條,這是因為R1和R2到R4都沒有FS(可行后繼路由器),成為FS的條件是:AD<FD.AD是下一跳路由通告給本路由的通告距離(個人理解為就是度量值)。FD是本路由到達目標網絡最優的可行距離。這里的AD是等于FD的,所以沒有FS。可以查看一下:
r1(config)#do sh ip eigrp top all-links
IP-EIGRP Topology Table for AS(10)/ID(219.146.1.1)
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
?????? r - reply Status, s - sia Status
P 219.146.1.0/24, 1 successors, FD is 2169856, serno 2
??????? via Connected, Serial1/1
P 219.146.0.0/24, 1 successors, FD is 2169856, serno 1
??????? via Connected, Serial1/0
P 219.146.3.0/24, 1 successors, FD is 2681856, serno 5
??????? via 219.146.0.2 (2681856/2169856), Serial1/0
??????? via 219.146.1.2 (3193856/2681856), Serial1/1
P 219.146.2.0/24, 2 successors, FD is 2681856, serno 6
??????? via 219.146.0.2 (2681856/2169856), Serial1/0
??????? via 219.146.1.2 (2681856/2169856), Serial1/1
后面跟上all-links,可以查看所有鏈路。可以看出AD是等于FD的。只要讓AD小于FD,那就實現了不等價負載均衡。怎么修改AD呢?
首先,要知道EIGRP度量值的算法:
EIGRP的度量值=K1*帶寬+*(K2*帶寬)/(256-負載)+K3*延遲。
因為默認K1和K3等于1.其他等于0.所以:
EIGRP的度量值=帶寬+延遲
帶寬=10的7次方/最低鏈路的帶寬(單位為Kbit/s)*256
延遲=延遲(單位為10微秒.而用show interfaces顯示的延遲是以微秒為單位的)的總和*256
所以最終度量值為:
EIGRP的度量值=(10的7次方/帶寬(所有入口帶寬最小值)+延遲的和(所有入口延遲的和)/10)*256
通過上面的公式。可以知道修改度量值可以修改K值,帶寬,延遲。但一般不建議修改K值,帶寬修改的計算復雜,所以修改延遲最方便。
在這個拓撲中,可以修改R3的S1/2、R1的S1/0或者R3的S1/2、R2的S1/0、R1的S1/1。
但R1的S1/2會影響到這兩條路由,所以不能修改。那么可以把R1的延遲改大或R2的延遲改小。
r1(config)#do sh int s1/0
Serial1/0 is up, line protocol is up
? Hardware is M4T
? Internet address is 219.146.0.1/24
? MTU 1500 bytes, BW 1544 Kbit/sec, DLY 20000 usec
r1(config)#in s1/0
r1(config-if)#delay 2001?//延遲增加10,注意這里不是20010(單位是10微秒)
r1(config-if)#exi
r1(config)#do sh ip rou
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
D??? 219.146.2.0/24 [90/2681856] via 219.146.1.2, 00:00:32, Serial1/1
D??? 219.146.3.0/24 [90/2682112] via 219.146.0.2, 00:00:32, Serial1/0
C??? 219.146.0.0/24 is directly connected, Serial1/0
C??? 219.146.1.0/24 is directly connected, Serial1/1
發現并沒有實現負載均衡。而且剛才那條等價的也沒有了,因為現在是不等價了。
r1(config)#do sh ip pro
Routing Protocol is "eigrp 10"
? Outgoing update filter list for all interfaces is not set
? Incoming update filter list for all interfaces is not set
? Default networks flagged in outgoing updates
? Default networks accepted from incoming updates
? EIGRP metric weight K1=1, K2=0, K3=1, K4=0, K5=0
? EIGRP maximum hopcount 100
? EIGRP maximum metric variance 1
? Redistributing: eigrp 10
? EIGRP NSF-aware route hold timer is 240s
? Automatic network summarization is not in effect
? Maximum path: 4
? Routing for Networks:
??? 219.146.0.0/23
? Routing Information Sources:
??? Gateway???????? Distance????? Last Update
??? 219.146.1.2?????????? 90????? 00:03:04
??? 219.146.0.2?????????? 90????? 00:03:04
? Distance: internal 90 external 170
這里的variance值是1.這就是只是等價的負載均衡。但現在是不等價的,所有沒有路由。修改一下variance值。variance指的是倍數。是FD和AD的倍數。
r1(config)#router e 10
r1(config-router)#variance 2
r1(config-router)#exi
r1(config)#do sh ip rou
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
D??? 219.146.2.0/24 [90/2681856] via 219.146.1.2, 00:00:04, Serial1/1
??????????????????? [90/2682112] via 219.146.0.2, 00:00:04, Serial1/0
D??? 219.146.3.0/24 [90/3193856] via 219.146.1.2, 00:00:04, Serial1/1
??????????????????? [90/2682112] via 219.146.0.2, 00:00:04, Serial1/0
C??? 219.146.0.0/24 is directly connected, Serial1/0
C??? 219.146.1.0/24 is directly connected, Serial1/1
現在已經出現了。而且是不等價的負載均衡。
現在怎么把剛才那條(219.146.2.0)還原成等價的呢?當然修改延遲也可以達到目的。這里使用一種更簡單的方法。偏移列表:
r1(config)#access-list 10 permit 219.146.2.0 0.0.0.255
r1(config)#router e 10
r1(config-router)#offset-list 10 in 256 serial 1/1
r1(config-router)#exi
r1(config)#do sh ip rou
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
D??? 219.146.2.0/24 [90/2682112] via 219.146.1.2, 00:00:06, Serial1/1
??????????????????? [90/2682112] via 219.146.0.2, 00:00:06, Serial1/0
D??? 219.146.3.0/24 [90/3193856] via 219.146.1.2, 00:10:17, Serial1/1
??????????????????? [90/2682112] via 219.146.0.2, 00:10:17, Serial1/0
C??? 219.146.0.0/24 is directly connected, Serial1/0
C??? 219.146.1.0/24 is directly connected, Serial1/1
已經實現了,一條等價一條不等價的。
繼續查看一下負載均衡的流量分配情況。
r1(config)#do sh ip rou 219.146.3.0
Routing entry for 219.146.3.0/24
? Known via "eigrp 10", distance 90, metric 2682112, type internal
? Redistributing via eigrp 10
? Last update from 219.146.1.2 on Serial1/1, 00:07:24 ago
? Routing Descriptor Blocks:
??? 219.146.1.2, from 219.146.1.2, 00:07:24 ago, via Serial1/1
????? Route metric is 3193856, traffic share count is 101
????? Total delay is 60000 microseconds, minimum bandwidth is 1544 Kbit
????? Reliability 255/255, minimum MTU 1500 bytes
????? Loading 1/255, Hops 2
? * 219.146.0.2, from 219.146.0.2, 00:07:24 ago, via Serial1/0
????? Route metric is 2682112, traffic share count is 120
????? Total delay is 40010 microseconds, minimum bandwidth is 1544 Kbit
????? Reliability 255/255, minimum MTU 1500 bytes
????? Loading 1/255, Hops 1
這里的101和120指的是到達目標網絡的數據包從S1/1走101個,從S1/0走120.
來測試一下:在R3上做一個訪問列表:
r3(config)#ip access-list extended cs
r3(config-ext-nacl)#per ip host 219.146.0.1 host 219.146.3.2
r3(config-ext-nacl)#per ip host 219.146.1.1 host 219.146.3.2
r3(config-ext-nacl)#per ip any any
r3(config-ext-nacl)#exi
r3(config)#in s1/0
r3(config-if)#ip access-group cs in
r3(config-if)#in s1/1
r3(config-if)#ip access-group cs in
r3(config-if)#exi
r3(config)#do sh ip acce
Extended IP access list cs
??? 10 permit ip host 219.146.0.1 host 219.146.3.2
??? 20 permit ip host 219.146.1.1 host 219.146.3.2
??? 30 permit ip any any (42 matches)
現在匹配的都為0,在R1上使用擴展ping一下:
r1#ping
*Jan? 2 13:20:14.739: %SYS-5-CONFIG_I: Configured from console by console
r1#ping
Protocol [ip]:
Target IP address: 219.146.3.2
Repeat count [5]: 663
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface:
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 663, 100-byte ICMP Echos to 219.146.3.2, timeout is 2 seconds:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Success rate is 100 percent (663/663), round-trip min/avg/max = 12/88/220 ms
r3(config)#do sh ip acce
Extended IP access list cs
??? 10 permit ip host 219.146.0.1 host 219.146.3.2 (663 matches)
??? 20 permit ip host 219.146.1.1 host 219.146.3.2
??? 30 permit ip any any (174 matches)
發現并沒有實現負載均衡,所有數據都走了最好的那條路由。(不要以為路由表中顯示負載均衡就一定會負載均衡)這是因為還有一個思科的快速轉發表。在R1上關閉后再試。
r1#conf t
r1(config)#no ip cef
r1(config)#exi
清空一下R3剛才的記錄:
r3(config)#exi
r3#clear ip access-list counters
r3#sh ip acce
Extended IP access list cs
??? 10 permit ip host 219.146.0.1 host 219.146.3.2
??? 20 permit ip host 219.146.1.1 host 219.146.3.2
??? 30 permit ip any any (28 matches)
r1#ping
Protocol [ip]:
Target IP address: 219.146.3.2
Repeat count [5]: 663
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface:
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 663, 100-byte ICMP Echos to 219.146.3.2, timeout is 2 seconds:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Success rate is 100 percent (663/663), round-trip min/avg/max = 12/73/176 ms
r3#sh ip acce
Extended IP access list cs
??? 10 permit ip host 219.146.0.1 host 219.146.3.2 (360 matches)
??? 20 permit ip host 219.146.1.1 host 219.146.3.2 (303 matches)
??? 30 permit ip any any (74 matches)
現在已經真正實現了不等價的負載均衡。
接下來看一下流量控制:
r1#conf t
r1(config)#router e 10
r1(config-router)#traffic-share min across-interfaces //使用最小開銷的路由轉發數據
r1(config-router)#end
r3#clear ip access-list coun
r1#ping
Protocol [ip]:
Target IP address: 219.146.3.2
Repeat count [5]: 663
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface:
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 663, 100-byte ICMP Echos to 219.146.3.2, timeout is 2 seconds:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Success rate is 100 percent (663/663), round-trip min/avg/max = 12/65/148 ms
r3#sh ip acce
Extended IP access list cs
??? 10 permit ip host 219.146.0.1 host 219.146.3.2 (663 matches)
??? 20 permit ip host 219.146.1.1 host 219.146.3.2
??? 30 permit ip any any (84 matches)
這里已經只從最小開銷的鏈路轉發數據了。但路由表中還是顯示不等價負載均衡的。
r1#sh ip rou
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
D??? 219.146.2.0/24 [90/2681856] via 219.146.1.2, 00:12:54, Serial1/1
??????????????????? [90/2682112] via 219.146.0.2, 00:12:54, Serial1/0
D??? 219.146.3.0/24 [90/3193856] via 219.146.1.2, 00:12:54, Serial1/1
??????????????????? [90/2682112] via 219.146.0.2, 00:12:54, Serial1/0
C??? 219.146.0.0/24 is directly connected, Serial1/0
C??? 219.146.1.0/24 is directly connected, Serial1/1
這就再次說明了不要看到路由表顯示負載均衡就認為真正的實現了負載均衡。
EIGRP的不等價負載均衡就先到這里。
?
轉載于:https://blog.51cto.com/chenbin/279500
總結
以上是生活随笔為你收集整理的CCNP-EIGRP不等价负载均衡的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [原]动态打jar包程序,可用于手机图片
- 下一篇: loadrunner9.10安装及破解问