CCNP-EIGRP不等价负载均衡

CCNP-EIGRP不等价负载均衡:

实验拓扑:

 

 

CCNP-EIGRP不等价负载均衡_第1张图片

 

实验目标:

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的不等价负载均衡就先到这里。
 

你可能感兴趣的:(负载均衡,休闲,ccnp,EIGRP,不等价)