BGP Load Balancing Configuration Example

 

Configure load balancing on Switch A. 

Configure EBGP connections between Switch B and Switch A and between Switch B and Switch D.

Configure EBGP connections between Switch C and Switch A and between Switch C and Switch D.


Figure 5-12. BGP load balancing 

                                         


Configuring Switch A

Configure the VLAN that each interface belongs to.

admin@XorPlus# set vlans vlan-id 30 l3-interface vlan30
admin@XorPlus# set vlans vlan-id 40 l3-interface vlan40
admin@XorPlus# commit
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus#
admin@XorPlus# set interface gigabit-ethernet ge-1/1/1 family ethernet-switching native-vlan-id 30
admin@XorPlus# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching native-vlan-id 40
admin@XorPlus# commit
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus# 


Configure the VLAN interfaces, and assign them each IP addresses.

admin@XorPlus# set vlan-interface interface vlan30 vif vlan30 address 192.168.30.1 prefix-length 24
admin@XorPlus# set vlan-interface interface vlan40 vif vlan40 address 192.168.40.1 prefix-length 24
admin@XorPlus# commit
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus# 


Configure an EBGP connection.

admin@XorPlus# set protocols bgp bgp-id 1.1.1.1
admin@XorPlus# set protocols bgp local-as 100
admin@XorPlus# set protocols bgp peer 192.168.30.2 as 200
admin@XorPlus# set protocols bgp peer 192.168.30.2 local-ip 192.168.30.1
admin@XorPlus# set protocols bgp peer 192.168.40.2 as 300
admin@XorPlus# set protocols bgp peer 192.168.40.2 local-ip 192.168.30.1
admin@XorPlus# commit
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus# 


Configuring Switch B

Configure the VLAN that each interface belongs to.

admin@XorPlus# set vlans vlan-id 20 l3-interface vlan20
admin@XorPlus# set vlans vlan-id 30 l3-interface vlan30
admin@XorPlus# commit
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus#
admin@XorPlus# set interface gigabit-ethernet ge-1/1/1 family ethernet-switching native-vlan-id 30
admin@XorPlus# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching native-vlan-id 20
admin@XorPlus# commit
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus#


Configure the VLAN interfaces, and assign them IP addresses.

admin@XorPlus# set vlan-interface interface vlan20 vif vlan20 address 192.168.20.2 prefix-length 24
admin@XorPlus# set vlan-interface interface vlan30 vif vlan30 address 192.168.30.2 prefix-length 24
admin@XorPlus# commit
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus# 


Configure an EBGP connection.

admin@XorPlus# set protocols bgp bgp-id 2.2.2.2
admin@XorPlus# set protocols bgp local-as 200
admin@XorPlus# set protocols bgp peer 192.168.20.1 as 400
admin@XorPlus# set protocols bgp peer 192.168.20.1 local-ip 192.168.20.2
admin@XorPlus# set protocols bgp peer 192.168.30.1 as 100
admin@XorPlus# set protocols bgp peer 192.168.30.2 local-ip 192.168.30.2
admin@XorPlus# commit
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus# 


Configuring Switch C

Configure the VLAN that each interface belongs to.

admin@XorPlus# set vlans vlan-id 40 l3-interface 40
admin@XorPlus# set vlans vlan-id 50 l3-interface 50
admin@XorPlus# commit
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching native-vlan-id 40
admin@XorPlus# set interface gigabit-ethernet ge-1/1/3 family ethernet-switching native-vlan-id 50
admin@XorPlus# commit
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus# 


Configure the VLAN interfaces, and assign them IP addresses.

admin@XorPlus# set vlan-interface interface vlan40 vif vlan40 address 192.168.40.2 prefix-length 24
admin@XorPlus# set vlan-interface interface vlan50 vif vlan50 address 192.168.50.2 prefix-length 24
admin@XorPlus# commit
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus# 
Configure an EBGP connection. 
admin@XorPlus# set protocols bgp bgp-id 3.3.3.3
admin@XorPlus# set protocols bgp local-as 300
admin@XorPlus# set protocols bgp peer 192.168.40.1 as 100
admin@XorPlus# set protocols bgp peer 192.168.40.1 local-ip 192.168.40.2
admin@XorPlus# set protocols bgp peer 192.168.50.1 as 400
admin@XorPlus# set protocols bgp peer 192.168.50.1 local-ip 192.168.50.2
admin@XorPlus# commit
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus# 


Configuring Switch D

Configure the VLAN that each interface belongs to.

admin@XorPlus# set vlans vlan-id 10 l3-interface vlan10
admin@XorPlus# set vlans vlan-id 20 l3-interface vlan20
admin@XorPlus# set vlans vlan-id 50 l3-interface vlan50
admin@XorPlus# commit
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus# set interface gigabit-ethernet ge-1/1/1 family ethernet-switching native-vlan-id 10
admin@XorPlus# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching native-vlan-id 20
admin@XorPlus# set interface gigabit-ethernet ge-1/1/3 family ethernet-switching native-vlan-id 50
admin@XorPlus# commit
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus# 


Configure the VLAN interfaces, and assign them IP addresses.

admin@XorPlus# set vlan-interface interface vlan10 vif vlan10 address 192.168.10.1 prefix-length 24
admin@XorPlus# set vlan-interface interface vlan20 vif vlan20 address 192.168.20.1 prefix-length 24
admin@XorPlus# set vlan-interface interface vlan50 vif vlan50 address 192.168.50.1 prefix-length 24
admin@XorPlus# commit
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus# 


Configure an EBGP Connection

admin@XorPlus# set protocols bgp bgp-id 4.4.4.4
admin@XorPlus# set protocols bgp local-as 400
admin@XorPlus# set protocols bgp peer 192.168.20.2 as 200
admin@XorPlus# set protocols bgp peer 192.168.20.2 local-ip 192.168.20.1
admin@XorPlus# set protocols bgp peer 192.168.50.2 as 300
admin@XorPlus# set protocols bgp peer 192.168.50.2 local-ip 192.168.50.1
admin@XorPlus# commit
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus# 


Viewing BGP Peer Status on Switch B

admin@XorPlus# run show bgp peers detail 
Peer 2: local 192.168.20.2/179 remote 192.168.20.1/39912
Peer ID: 1.1.1.1
Peer State: ESTABLISHED
Admin State: START
Negotiated BGP Version: 4
Peer AS Number: 100
Updates Received: 20, Updates Sent: 2
Messages Received: 634, Messages Sent: 611
Time since last received update: 1685 seconds
Number of transitions to ESTABLISHED: 1
Time since last entering ESTABLISHED state: 15995 seconds
Retry Interval: 120 seconds
Hold Time: 90 seconds, Keep Alive Time: 30 seconds
Configured Hold Time: 90 seconds, Configured Keep Alive Time: 30 seconds
Minimum AS Origination Interval: 0 seconds
Minimum Route Advertisement Interval: 0 seconds 
Peer 2: local 192.168.30.2/16808 remote 192.168.30.1/179
Peer ID: 4.4.4.4
Peer State: ESTABLISHED
Admin State: START
Negotiated BGP Version: 4
Peer AS Number: 100
Updates Received: 20, Updates Sent: 2
Messages Received: 634, Messages Sent: 611
Time since last received update: 1685 seconds
Number of transitions to ESTABLISHED: 1
Time since last entering ESTABLISHED state: 15995 seconds
Retry Interval: 120 seconds
Hold Time: 90 seconds, Keep Alive Time: 30 seconds
Configured Hold Time: 90 seconds, Configured Keep Alive Time: 30 seconds
Minimum AS Origination Interval: 0 seconds
Minimum Route Advertisement Interval: 0 seconds 


Viewing BGP Peer Status on Switch C

admin@XorPlus# run show bgp peers detail 
Peer 2: local 192.168.40.2/179 remote 192.168.40.1/38815
Peer ID: 1.1.1.1
Peer State: ESTABLISHED
Admin State: START
Negotiated BGP Version: 4
Peer AS Number: 100
Updates Received: 20, Updates Sent: 2
Messages Received: 634, Messages Sent: 611
Time since last received update: 1685 seconds
Number of transitions to ESTABLISHED: 1
Time since last entering ESTABLISHED state: 15995 seconds
Retry Interval: 120 seconds
Hold Time: 90 seconds, Keep Alive Time: 30 seconds
Configured Hold Time: 90 seconds, Configured Keep Alive Time: 30 seconds
Minimum AS Origination Interval: 0 seconds
Minimum Route Advertisement Interval: 0 seconds 
Peer 2: local 192.168.50.2/49923 remote 192.168.50.1/179
Peer ID: 4.4.4.4
Peer State: ESTABLISHED
Admin State: START
Negotiated BGP Version: 4
Peer AS Number: 100
Updates Received: 20, Updates Sent: 2
Messages Received: 634, Messages Sent: 611
Time since last received update: 1685 seconds
Number of transitions to ESTABLISHED: 1
Time since last entering ESTABLISHED state: 15995 seconds
Retry Interval: 120 seconds
Hold Time: 90 seconds, Keep Alive Time: 30 seconds
Configured Hold Time: 90 seconds, Configured Keep Alive Time: 30 seconds
Minimum AS Origination Interval: 0 seconds
Minimum Route Advertisement Interval: 0 seconds 


Configuring Switch D to Advertise Route 192.168.10.0/24

Configure Switch A to enable BGP multipath:

admin@XorPlus# set protocols bgp multipath disable false
admin@XorPlus# commit
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus# 


Configure Switch D to advertise route 192.168.10.0/24:

admin@XorPlus# set policy policy-statement direct-to-bgp term t1 from protocol connected 
admin@XorPlus# set policy policy-statement direct-to-bgp term t1 from network4 192.168.10.0/24
admin@XorPlus# set policy policy-statement direct-to-bgp term t1 then accept 
admin@XorPlus# commit
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus#
admin@XorPlus# set protocols bgp export direct-to-bgp
admin@XorPlus# commit
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus# 


View the BGP routing table of Switch A:

admin@XorPlus# run show bgp routes 
Status Codes: * valid route, > best route
Origin Codes: i IGP, e EGP, ? incomplete 
Prefix Nexthop Peer AS Path
------ ------- ---- -------
*> 192.168.10.0/24 192.168.30.2 2.2.2.2 200 400 ?
192.168.10.0/24 192.168.40.2 3.3.3.3 200 400 ?
admin@XorPlus# 


As expected, Switch A is not load balancing because it does not view the paths as "equal," but as different AS paths. 


Configuring BGP Multipath Path-Relax on Switch A

admin@XorPlus# set protocols bgp multipath path-relax true
admin@XorPlus# commit 
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus# 


View the BGP routing table and IP routing table of Switch A:

admin@XorPlus# run show bgp routes 
Status Codes: * valid route, > best route
Origin Codes: i IGP, e EGP, ? incomplete 
Prefix Nexthop Peer AS Path
------ ------- ---- -------
*> 192.168.10.0/24 192.168.30.2 2.2.2.2 200 400 ?
*> 192.168.10.0/24 192.168.40.2 3.3.3.3 200 400 ?
admin@XorPlus# 
admin@XorPlus# run show route table ipv4 unicast ebgp 
192.168.10.0/24 [ebgp(20)/0]
> to 192.168.30.2 via vlan30/vlan30
192.168.10.0/24 [ebgp(20)/0]
> to 192.168.40.2 via vlan40/vlan40
admin@XorPlus# 
admin@XorPlus#