多个EBGP会话负载均衡

image

如何在多条链路上负载均衡?

两种方法:

1.使用环回口建立EBGP邻居并使用EBGP多跳

2.EBGP multipath

现讨论这两种方法:

1.使用环回口建立EBGP邻居并使用EBGP多跳

ISP#

interface Loopback0
ip address 172.16.1.1 255.255.255.255
!        
interface Serial1/0
ip address 10.1.1.1 255.255.255.252
serial restart-delay 0
!
interface Serial1/1
ip address 10.1.1.5 255.255.255.252
serial restart-delay 0
!
interface Serial1/2
ip address 10.1.1.9 255.255.255.252
serial restart-delay 0

!

router bgp 100
no synchronization
bgp router-id 172.16.1.1
bgp log-neighbor-changes
network 172.17.0.0
neighbor 172.16.2.1 remote-as 65100
neighbor 172.16.2.1 ebgp-multihop 2
neighbor 172.16.2.1 update-source Loopback0
no auto-summary
!
ip route 172.16.2.1 255.255.255.255 Serial1/0 10.1.1.2
ip route 172.16.2.1 255.255.255.255 Serial1/0 10.1.1.6
ip route 172.16.2.1 255.255.255.255 Serial1/0 10.1.1.10
ip route 172.17.0.0 255.255.0.0 Null0

Enterprise#

interface Loopback0
ip address 172.16.1.1 255.255.255.255
!        
interface Serial1/0
ip address 10.1.1.1 255.255.255.252
serial restart-delay 0
!
interface Serial1/1
ip address 10.1.1.5 255.255.255.252
serial restart-delay 0
!
interface Serial1/2
ip address 10.1.1.9 255.255.255.252
serial restart-delay 0
!
interface Serial1/3
no ip address
shutdown
serial restart-delay 0
!
router bgp 100
no synchronization
bgp router-id 172.16.1.1
bgp log-neighbor-changes
network 172.17.0.0
neighbor 172.16.2.1 remote-as 65100
neighbor 172.16.2.1 ebgp-multihop 2
neighbor 172.16.2.1 update-source Loopback0
no auto-summary
!
ip route 172.16.2.1 255.255.255.255 Serial1/0 10.1.1.2
ip route 172.16.2.1 255.255.255.255 Serial1/0 10.1.1.6
ip route 172.16.2.1 255.255.255.255 Serial1/0 10.1.1.10
ip route 172.17.0.0 255.255.0.0 Null0

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

B    172.17.0.0/16 [20/0] via 172.16.1.1, 00:08:09
     172.16.0.0/32 is subnetted, 2 subnets
S       172.16.1.1 [1/0] via 10.1.1.9, Serial1/2
                   [1/0] via 10.1.1.5, Serial1/1
                   [1/0] via 10.1.1.1, Serial1/0
C       172.16.2.1 is directly connected, Loopback0
S    172.18.0.0/16 is directly connected, Null0
     10.0.0.0/30 is subnetted, 3 subnets
C       10.1.1.8 is directly connected, Serial1/2
C       10.1.1.0 is directly connected, Serial1/0
C       10.1.1.4 is directly connected, Serial1/1

可以看到达目的网络172.17.0.0/16的下一跳是172.16.1.1,递归查询路由表,到达172.16.1.1有三条等价的路由,从而达到负载均衡的目的。

注意:这里的配置到达对方环回口使用的是静态路由,是为了防止使用IGP学习环回口地址又误将环回口地址宣告到BGP中,造成EBGP邻居flapping,具体参考http://1095999.blog.51cto.com/1085999/524417

所以如果使用环回口建立EBGP邻居,建议使用静态路由到达对方的环回口。

2.EBGP multipath

ISP#

interface Loopback0
ip address 172.16.1.1 255.255.255.255
!        
interface Serial1/0
ip address 10.1.1.1 255.255.255.252
serial restart-delay 0
!
interface Serial1/1
ip address 10.1.1.5 255.255.255.252
serial restart-delay 0
!
interface Serial1/2
ip address 10.1.1.9 255.255.255.252
serial restart-delay 0
!
interface Serial1/3
no ip address
shutdown
serial restart-delay 0
!
router bgp 100
no synchronization
bgp router-id 172.16.1.1
bgp log-neighbor-changes
network 172.17.0.0
neighbor 10.1.1.2 remote-as 65100
neighbor 10.1.1.6 remote-as 65100
neighbor 10.1.1.10 remote-as 65100
maximum-paths 3
no auto-summary
!
no ip http server
no ip http secure-server
ip route 172.17.0.0 255.255.0.0 Null0
!

Enterprise#   

interface Loopback0
ip address 172.16.2.1 255.255.255.255
!        
interface Serial1/0
ip address 10.1.1.2 255.255.255.252
serial restart-delay 0
!
interface Serial1/1
ip address 10.1.1.6 255.255.255.252
serial restart-delay 0
!
interface Serial1/2
ip address 10.1.1.10 255.255.255.252
serial restart-delay 0
!
interface Serial1/3
no ip address
shutdown
serial restart-delay 0
!
router bgp 65100
no synchronization
bgp router-id 172.16.2.1
bgp log-neighbor-changes
network 172.18.0.0
neighbor 10.1.1.1 remote-as 100
neighbor 10.1.1.5 remote-as 100
neighbor 10.1.1.9 remote-as 100
maximum-paths 3
no auto-summary
!
no ip http server
no ip http secure-server
ip route 172.18.0.0 255.255.0.0 Null0

Enterprise#       sh ip ro
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

B    172.17.0.0/16 [20/0] via 10.1.1.9, 00:00:41
                   [20/0] via 10.1.1.5, 00:00:41
                   [20/0] via 10.1.1.1, 00:00:41
     172.16.0.0/32 is subnetted, 1 subnets
C       172.16.2.1 is directly connected, Loopback0
S    172.18.0.0/16 is directly connected, Null0
     10.0.0.0/30 is subnetted, 3 subnets
C       10.1.1.8 is directly connected, Serial1/2
C       10.1.1.0 is directly connected, Serial1/0
C       10.1.1.4 is directly connected, Serial1/1

路由表显示3条等价路由负载均衡

注意:在BGP表中只可能有一条最优路由,因为经过13条选路原则对比下来,一定能分出高下,不可能有等价路由存在

maximum-paths 命令的意思是,某些选路原则不进行对比,选择前几项选路原则相同的几条路径放进路由表,从而表现为几条路径的等价负载

你可能感兴趣的:(负载均衡,职场,会话,休闲,EBGP)