十八、CCNP-BGP(非等价负载均衡)

18.7 BGP非等价负载均衡

18.7.1 基础环境

R1R2R3属于AS123,R4属于AS400

R1配置

R1(config)#interface loopback 0
R1(config-if)#ip address 1.1.1.1 255.255.255.255
R1(config-if)#no shutdown
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address 10.1.123.1 255.255.255.0
R1(config-if)#no shutdown
R1(config)#interface fastEthernet 1/0
R1(config-if)#ip address 11.11.11.254 255.255.255.0
R1(config-if)#no shutdown

R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1 
R1(config-router)#network 1.1.1.1 0.0.0.0 area 0
R1(config-router)#network 10.1.123.1 0.0.0.0 area 0

R1(config)#router bgp 123
R1(config-router)#bgp router-id 1.1.1.1
R1(config-router)#neighbor 2.2.2.2 remote-as 123
R1(config-router)#neighbor 2.2.2.2 update-source loopback 0
R1(config-router)#neighbor 3.3.3.3 remote-as 123
R1(config-router)#neighbor 3.3.3.3 update-source loopback 0
R1(config-router)#network 11.11.11.0 mask 255.255.255.0

R2配置

R2(config)#interface loopback 0
R2(config-if)#ip address 2.2.2.2 255.255.255.255
R2(config-if)#no shutdown
R2(config)#interface fastEthernet 0/0
R2(config-if)#ip address 10.1.123.2 255.255.255.0
R2(config-if)#no shutdown
R2(config)#interface fastEthernet 1/0
R2(config-if)#ip address 10.1.24.2 255.255.255.0
R2(config-if)#no shutdown

R2(config)#router ospf 1 
R2(config-router)#router-id 2.2.2.2 
R2(config-router)#network 2.2.2.2 0.0.0.0 area 0
R2(config-router)#network 10.1.123.2 0.0.0.0 area 0
R2(config-router)#network 10.1.24.2 0.0.0.0 area 0

R2(config)#router bgp 123 
R2(config-router)#bgp router-id 2.2.2.2
R2(config-router)#neighbor 1.1.1.1 remote-as 123
R2(config-router)#neighbor 1.1.1.1 update-source loopback 0
R2(config-router)#neighbor 10.1.24.4 remote-as 400

R3配置

R3(config)#interface loopback 0
R3(config-if)#ip address 3.3.3.3 255.255.255.255
R3(config-if)#no shutdown
R3(config)#interface fastEthernet 0/0
R3(config-if)#ip address 10.1.123.3 255.255.255.0
R3(config-if)#no shutdown
R3(config)#interface serial 1/0
R3(config-if)#ip address 10.1.34.3 255.255.255.0
R3(config-if)#no shutdown

R3(config)#router ospf 1 
R3(config-router)#router-id 3.3.3.3 
R3(config-router)#network 3.3.3.3 0.0.0.0 area 0
R3(config-router)#network 10.1.123.3 0.0.0.0 area 0
R3(config-router)#network 10.1.34.3 0.0.0.0 area 0

R3(config)#router bgp 123
R3(config-router)#bgp router-id 3.3.3.3
R3(config-router)#neighbor 1.1.1.1 remote-as 123
R3(config-router)#neighbor 1.1.1.1 update-source loopback 0
R3(config-router)#neighbor 10.1.34.4 remote-as 400

R4配置

R4(config)#interface loopback 0
R4(config-if)#ip address 4.4.4.4 255.255.255.255
R4(config-if)#no shutdown
R4(config)#interface fastEthernet 0/0
R4(config-if)#ip address 10.1.24.4 255.255.255.0
R4(config-if)#no shutdown
R4(config-if)#exit
R4(config)#interface serial 1/0
R4(config-if)#ip address 10.1.34.4 255.255.255.0
R4(config-if)#no shutdown
R4(config)#interface fastEthernet 2/0
R4(config-if)#ip address 44.44.44.254 255.255.255.0
R4(config-if)#no shutdown

R4(config)#router bgp 400
R4(config-router)#bgp router-id 4.4.4.4
R4(config-router)#neighbor 10.1.24.2 remote-as 123
R4(config-router)#neighbor 10.1.34.3 remote-as 123
R4(config-router)#network 44.44.44.0 mask 255.255.255.0

检查配置

R1#show ip bgp summary
BGP router identifier 1.1.1.1, local AS number 123
BGP table version is 3, main routing table version 3
2 network entries using 234 bytes of memory
3 path entries using 156 bytes of memory
3/2 BGP path/bestpath attribute entries using 372 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 786 total bytes of memory
BGP activity 2/0 prefixes, 3/0 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
2.2.2.2         4   123      17      17        3    0    0 00:12:50        1
3.3.3.3         4   123      11      11        3    0    0 00:06:47        1

R1上有两个BGP邻居关系

R2#show ip bgp summary
BGP router identifier 2.2.2.2, local AS number 123
BGP table version is 3, main routing table version 3
2 network entries using 234 bytes of memory
2 path entries using 104 bytes of memory
3/2 BGP path/bestpath attribute entries using 372 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 734 total bytes of memory
BGP activity 2/0 prefixes, 2/0 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
1.1.1.1         4   123      18      18        3    0    0 00:13:27        1
10.1.24.4       4   400       8       8        3    0    0 00:03:03        1

R2也有两个,一个IBGP,一个EBGP

R3#show ip bgp summary
BGP router identifier 3.3.3.3, local AS number 123
BGP table version is 3, main routing table version 3
2 network entries using 234 bytes of memory
2 path entries using 104 bytes of memory
3/2 BGP path/bestpath attribute entries using 372 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 734 total bytes of memory
BGP activity 2/0 prefixes, 2/0 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
1.1.1.1         4   123      12      12        3    0    0 00:07:57        1
10.1.34.4       4   400       8       7        3    0    0 00:02:33        1

R3也有两个,一个IBGP,一个EBGP

R4#show ip bgp summary
BGP router identifier 4.4.4.4, local AS number 400
BGP table version is 3, main routing table version 3
2 network entries using 234 bytes of memory
3 path entries using 156 bytes of memory
3/2 BGP path/bestpath attribute entries using 372 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 786 total bytes of memory
BGP activity 2/0 prefixes, 3/0 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.1.24.2       4   123       8       8        3    0    0 00:03:58        1
10.1.34.3       4   123       7       8        3    0    0 00:02:54        1

R4两个EBGP邻居

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/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback0
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/2] via 10.1.123.2, 00:06:00, FastEthernet0/0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/2] via 10.1.123.3, 00:06:00, FastEthernet0/0
     10.0.0.0/24 is subnetted, 3 subnets
O       10.1.24.0 [110/2] via 10.1.123.2, 00:06:00, FastEthernet0/0
O       10.1.34.0 [110/65] via 10.1.123.3, 00:06:00, FastEthernet0/0
C       10.1.123.0 is directly connected, FastEthernet0/0
     11.0.0.0/24 is subnetted, 1 subnets
C       11.11.11.0 is directly connected, FastEthernet1/0
     44.0.0.0/24 is subnetted, 1 subnets
B       44.44.44.0 [200/0] via 10.1.24.4, 00:03:50

R1上也有了BGP路由44.44.44.0

R1#show ip bgp
BGP table version is 3, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 11.11.11.0/24    0.0.0.0                  0         32768 i
* i44.44.44.0/24    10.1.34.4                0    100      0 400 i
*>i                 10.1.24.4                0    100      0 400 i

有两条去往44.44.44.0的路由

R4#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

     4.0.0.0/32 is subnetted, 1 subnets
C       4.4.4.4 is directly connected, Loopback0
     10.0.0.0/24 is subnetted, 2 subnets
C       10.1.24.0 is directly connected, FastEthernet0/0
C       10.1.34.0 is directly connected, Serial1/0
     11.0.0.0/24 is subnetted, 1 subnets
B       11.11.11.0 [20/0] via 10.1.24.2, 00:06:06
     44.0.0.0/24 is subnetted, 1 subnets
C       44.44.44.0 is directly connected, FastEthernet2/0

R4也学到了去往11.11.11.0的路由

R4#show ip bgp
BGP table version is 3, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*  11.11.11.0/24    10.1.34.3                              0 123 i
*>                  10.1.24.2                              0 123 i
*> 44.44.44.0/24    0.0.0.0                  0         32768 i

R4的BGP表中有两条

18.7.2 潜在问题

两个潜在问题:

R1学到了去往44.44.44.44的两条路由,R1完全可以执行等价负载均衡。但是两条路径不等价,因为两边带宽大小不一样。需要让R1在R2R3间执行非等价负载均衡。

对于R4来说,都能从R2R3收到11网段的路由,这两条也具备执行等价负载均衡的条件,但是带宽也不等价。

18.7.3 EBGP非等价负载均衡

R4#show ip bgp 11.11.11.0
BGP routing table entry for 11.11.11.0/24, version 2
Paths: (2 available, best #2, table Default-IP-Routing-Table)
  Advertised to update-groups:
     1
  123
    10.1.34.3 from 10.1.34.3 (3.3.3.3)
      Origin IGP, localpref 100, valid, external
  123
    10.1.24.2 from 10.1.24.2 (2.2.2.2)
      Origin IGP, localpref 100, valid, external, best

R4到11网段的两条可选路径,具备执行等价负载均衡的条件,因为各项属性一致。

18.7.3.1 等价负载均衡

R4(config)#router bgp 400
R4(config-router)#maximum-paths 2

等价负载均衡

R4#show ip bgp 11.11.11.11
BGP routing table entry for 11.11.11.0/24, version 4
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Multipath: eBGP
  Advertised to update-groups:
     1
  123
    10.1.34.3 from 10.1.34.3 (3.3.3.3)
      Origin IGP, localpref 100, valid, external, multipath
  123
    10.1.24.2 from 10.1.24.2 (2.2.2.2)
      Origin IGP, localpref 100, valid, external, multipath, best

这时这两条路劲都用上了,

R4#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

     4.0.0.0/32 is subnetted, 1 subnets
C       4.4.4.4 is directly connected, Loopback0
     10.0.0.0/24 is subnetted, 2 subnets
C       10.1.24.0 is directly connected, FastEthernet0/0
C       10.1.34.0 is directly connected, Serial1/0
     11.0.0.0/24 is subnetted, 1 subnets
B       11.11.11.0 [20/0] via 10.1.34.3, 00:01:49
                   [20/0] via 10.1.24.2, 00:16:10
     44.0.0.0/24 is subnetted, 1 subnets
C       44.44.44.0 is directly connected, FastEthernet2/0

路由表中执行的也是等价负载均衡

合理性:流量1:1,可是两个流量带宽不成比例,执行等价负载均衡不考虑带宽,这样流量分配不合理。

18.7.3.2 非等价负载均衡

开启BGP LINK BANDWIDTH后,会考虑带宽信息。

R4(config)#router bgp 400
R4(config-router)#bgp dmzlink-bw
R4(config-router)#neighbor 10.1.24.2 dmzlink-bw
R4(config-router)#neighbor 10.1.34.3 dmzlink-bw
R4#show ip bgp 11.11.11.11
BGP routing table entry for 11.11.11.0/24, version 6
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Multipath: eBGP
Flag: 0x8000
  Advertised to update-groups:
     1
  123
    10.1.34.3 from 10.1.34.3 (3.3.3.3)
      Origin IGP, localpref 100, valid, external, multipath
      DMZ-Link Bw 193 kbytes
  123
    10.1.24.2 from 10.1.24.2 (2.2.2.2)
      Origin IGP, localpref 100, valid, external, multipath, best
      DMZ-Link Bw 12500 kbytes

每条路径多了DMZ-Link Bw,参数就是COMMUNITY扩展属性,值计算是根据接口带宽/8计算得来的。

R4#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

     4.0.0.0/32 is subnetted, 1 subnets
C       4.4.4.4 is directly connected, Loopback0
     10.0.0.0/24 is subnetted, 2 subnets
C       10.1.24.0 is directly connected, FastEthernet0/0
C       10.1.34.0 is directly connected, Serial1/0
     11.0.0.0/24 is subnetted, 1 subnets
B       11.11.11.0 [20/0] via 10.1.34.3, 00:01:17
                   [20/0] via 10.1.24.2, 00:01:17
     44.0.0.0/24 is subnetted, 1 subnets
C       44.44.44.0 is directly connected, FastEthernet2/0

路由表中两条路由都用上了

R4#show ip route 11.11.11.11
Routing entry for 11.11.11.0/24
  Known via "bgp 400", distance 20, metric 0
  Tag 123, type external
  Last update from 10.1.24.2 00:01:44 ago
  Routing Descriptor Blocks:
    10.1.34.3, from 10.1.34.3, 00:01:44 ago
      Route metric is 0, traffic share count is 1
      AS Hops 1
      Route tag 123
  * 10.1.24.2, from 10.1.24.2, 00:01:44 ago
      Route metric is 0, traffic share count is 60
      AS Hops 1
      Route tag 123

流量分配比例是60:1,其实就是接口带宽比。

至此,EBGP非等价负载均衡完成

18.7.3.3 测试

由于流量60:1,现象不明显,调整比例,实际环境中不建议使用

R4(config)#interface serial 1/0
R4(config-if)#bandwidth 50000

不影响物理上的带宽速率。

R4#show ip bgp 11.11.11.11
BGP routing table entry for 11.11.11.0/24, version 6
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Multipath: eBGP
Flag: 0x8000
  Advertised to update-groups:
     1
  123
    10.1.34.3 from 10.1.34.3 (3.3.3.3)
      Origin IGP, localpref 100, valid, external, multipath
      DMZ-Link Bw 6250 kbytes
  123
    10.1.24.2 from 10.1.24.2 (2.2.2.2)
      Origin IGP, localpref 100, valid, external, multipath, best
      DMZ-Link Bw 12500 kbytes

调整成将近2:1的比例了

R4#show ip route 11.11.11.11
Routing entry for 11.11.11.0/24
  Known via "bgp 400", distance 20, metric 0
  Tag 123, type external
  Last update from 10.1.24.2 00:48:20 ago
  Routing Descriptor Blocks:
  * 10.1.34.3, from 10.1.34.3, 00:48:20 ago
      Route metric is 0, traffic share count is 1
      AS Hops 1
      Route tag 123
    10.1.24.2, from 10.1.24.2, 00:48:20 ago
      Route metric is 0, traffic share count is 2
      AS Hops 1
      Route tag 123

路由上显示也是1:2

PC R5配置:

R5(config)#interface fastEthernet 0/0
R5(config-if)#ip address 44.44.44.1 255.255.255.0
R5(config-if)#no shutdown

R5(config)#ip route 0.0.0.0 0.0.0.0 44.44.44.254


R1(config)#router bgp 123
R1(config-router)#maximum-paths ibgp 2

激活多链路属性

R5#ping 11.11.11.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 11.11.11.254, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 64/88/112 ms

可以PING通R1了,下一步看流量出口

R4#show ip cef 11.11.11.0
11.11.11.0/24, version 25, epoch 0, per-destination sharing
0 packets, 0 bytes
  via 10.1.34.3, 0 dependencies, recursive
    traffic share 1
    next hop 10.1.34.3, Serial1/0 via 10.1.34.0/24
    valid adjacency
  via 10.1.24.2, 0 dependencies, recursive
    traffic share 2
    next hop 10.1.24.2, FastEthernet0/0 via 10.1.24.2/32
    valid adjacency
  0 packets, 0 bytes switched through the prefix
  tmstats: external 0 packets, 0 bytes
           internal 0 packets, 0 bytes

R4上默认开启了CEF,CEF对流量的执行默认是per-destination,基于目的地址的负载均衡。这时流量一直走一边,CEF对负载均衡的默认执行策略,需要调整。

需要在R4的两个上联接口上加命令,改为基于数据包的负载均衡

R4(config)#interface fastEthernet 0/0
R4(config-if)#ip load-sharing per-packet

R4(config)#interface serial 1/0
R4(config-if)#ip load-sharing per-packet

接着在R5上PING试验,现在R2的F1/0接口上抓包,输入过滤条件

只抓原地址为44.44.44.1发出的ICMP包:icmp and ip.src == 44.44.44.1

R5#ping 11.11.11.254 repeat 6

Type escape sequence to abort.
Sending 6, 100-byte ICMP Echos to 11.11.11.254, timeout is 2 seconds:
!!!!!!
Success rate is 100 percent (6/6), round-trip min/avg/max = 76/89/104 ms

PING6个包,看看单条链路能抓到几个包

抓到了3个包,没有按2:1进行分配。接着在PING6个包

R5#ping 11.11.11.254 repeat 6
Type escape sequence to abort.
Sending 6, 100-byte ICMP Echos to 11.11.11.254, timeout is 2 seconds:
!!!!!!
Success rate is 100 percent (6/6), round-trip min/avg/max = 64/84/108 ms

这次抓到了4个包,排除之前的3个。量大的情况下就能体现出来2:1了。

18.7.4 IBGP的非等价负载均衡

18.7.4.1 介绍

对于R1来说能同时从R2和R3学到44网段的更新。

R1到R2R3完全符合同时实行等价负载均衡的条件,但是还是存在接口带宽不一致的情况导致不科学,带宽没有有效利用。

R4可以直接了解和R2R3直连接口的带宽信息,但是R1了解不到R2R3和直连接口的带宽信息。

扩展COMMUNITY属性值携带。

实现:需要在R2R3上开DMZLINK-BW,还需要发送扩展COMMUNITY看,同时只EBGP的邻居DMZLINK-BW。这样带宽扩展信息才会传给R1。

18.7.4.2 实现

R1#show ip bgp 44.44.44.0
BGP routing table entry for 44.44.44.0/24, version 3
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Multipath: iBGP
  Not advertised to any peer
  400
    10.1.34.4 (metric 65) from 3.3.3.3 (3.3.3.3)
      Origin IGP, metric 0, localpref 100, valid, internal
  400
    10.1.24.4 (metric 2) from 2.2.2.2 (2.2.2.2)
      Origin IGP, metric 0, localpref 100, valid, internal, best

两条链路METRIC值不一致,因为接口COST,带宽不一致。

R1(config)#router bgp 123
R1(config-router)#maximum-paths ibgp 2

激活多链路属性

R2(config)#router bgp 123
R2(config-router)#neighbor 1.1.1.1 next-hop-self

R3(config)#router bgp 123
R3(config-router)#neighbor 1.1.1.1 next-hop-self
R1#show ip bgp 44.44.44.0
BGP routing table entry for 44.44.44.0/24, version 5
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Multipath: iBGP
  Not advertised to any peer
  400
    3.3.3.3 (metric 2) from 3.3.3.3 (3.3.3.3)
      Origin IGP, metric 0, localpref 100, valid, internal, multipath
  400
    2.2.2.2 (metric 2) from 2.2.2.2 (2.2.2.2)
      Origin IGP, metric 0, localpref 100, valid, internal, multipath, best

这次两条METRIC值一致。

R1#show ip route 44.44.44.0
Routing entry for 44.44.44.0/24
  Known via "bgp 123", distance 200, metric 0
  Tag 400, type internal
  Last update from 3.3.3.3 00:02:43 ago
  Routing Descriptor Blocks:
    3.3.3.3, from 3.3.3.3, 00:02:43 ago
      Route metric is 0, traffic share count is 1
      AS Hops 1
      Route tag 400
  * 2.2.2.2, from 2.2.2.2, 00:03:03 ago
      Route metric is 0, traffic share count is 1
      AS Hops 1
      Route tag 400

两条路由都有了,1:1分配,等价负载均衡。

R1(config)#router bgp 123
R1(config-router)#bgp dmzlink-bw
R2(config)#router bgp 123
R2(config-router)#bgp dmzlink-bw
R2(config-router)#neighbor 1.1.1.1 send-community extended
R2(config-router)#neighbor 10.1.24.4 dmzlink-bw

需要发扩展COMMUNITY,其中eighbor 10.1.24.4 dmzlink-bw只能只EBGP邻居

R3(config)#router bgp 123
R3(config-router)#bgp dmzlink-bw
R3(config-router)#neighbor 1.1.1.1 send-community extended
R3(config-router)#neighbor 10.1.34.4 dmzlink-bw
R1#show ip bgp 44.44.44.0
BGP routing table entry for 44.44.44.0/24, version 7
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Multipath: iBGP
Flag: 0x8800
  Not advertised to any peer
  400
    3.3.3.3 (metric 2) from 3.3.3.3 (3.3.3.3)
      Origin IGP, metric 0, localpref 100, valid, internal, multipath
      DMZ-Link Bw 193 kbytes
  400
    2.2.2.2 (metric 2) from 2.2.2.2 (2.2.2.2)
      Origin IGP, metric 0, localpref 100, valid, internal, multipath, best
      DMZ-Link Bw 12500 kbytes

这时都有DMZ-Link Bw带宽值了。

R1#show ip route 44.44.44.0
Routing entry for 44.44.44.0/24
  Known via "bgp 123", distance 200, metric 0
  Tag 400, type internal
  Last update from 2.2.2.2 00:01:25 ago
  Routing Descriptor Blocks:
    3.3.3.3, from 3.3.3.3, 00:01:25 ago
      Route metric is 0, traffic share count is 1
      AS Hops 1
      Route tag 400
  * 2.2.2.2, from 2.2.2.2, 00:01:25 ago
      Route metric is 0, traffic share count is 60
      AS Hops 1
      Route tag 400

非等价负载均衡也有了60:1

便于测试,调整R3的S1/0接口

R3(config)#interface serial 1/0
R3(config-if)#bandwidth 50000
R1#show ip route 44.44.44.0
Routing entry for 44.44.44.0/24
  Known via "bgp 123", distance 200, metric 0
  Tag 400, type internal
  Last update from 2.2.2.2 00:00:01 ago
  Routing Descriptor Blocks:
    3.3.3.3, from 3.3.3.3, 00:00:01 ago
      Route metric is 0, traffic share count is 1
      AS Hops 1
      Route tag 400
  * 2.2.2.2, from 2.2.2.2, 00:00:01 ago
      Route metric is 0, traffic share count is 2
      AS Hops 1
      Route tag 400

流量比调整我1:2了

18.7.4.3 测试

PC R6配置

R6(config)#interface fastEthernet 0/0
R6(config-if)#ip address 11.11.11.1 255.255.255.0
R6(config-if)#no shutdown

R6(config)#ip route 0.0.0.0 0.0.0.0 11.11.11.254
R6#ping 11.11.11.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 11.11.11.254, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/31/44 ms

可以PING通

R1(config)#interface fastEthernet 0/0
R1(config-if)#ip load-sharing per-packet

R1上也要打开基于包负载

接着还在R2的F1/0上抓包:icmp and ip.src == 11.11.11.1

抓ICMP流量,原地址为11.11.11.1

PING测试

PING测试
R6#ping 44.44.44.254 repeat 6
Type escape sequence to abort.
Sending 6, 100-byte ICMP Echos to 44.44.44.254, timeout is 2 seconds:
!!!!!!
Success rate is 100 percent (6/6), round-trip min/avg/max = 76/84/108 ms

PING6个包,走了4个包。有时候不是完全按1:2比例,只是个大概值,只有量大的时候才会更加均匀。

18.7.5 小结

18.7.5.1 特性

18.7.5.2 预置条件

18.7.5.3 限制

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注