Example for Configuring BGP Load Balancing


Network Requirement

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 1. BGP Load Balancing

Procedure

Switch A

Step1         Configure the VLANs and VLAN interfaces.

admin@SwitchA# set vlans vlan-id 30 l3-interface vlan30
admin@SwitchA# set vlans vlan-id 40 l3-interface vlan40
admin@SwitchA# set interface gigabit-ethernet te-1/1/1 family ethernet-switching native-vlan-id 30
admin@SwitchA# set interface gigabit-ethernet te-1/1/2 family ethernet-switching native-vlan-id 40
admin@SwitchA# set l3-interface vlan-interface vlan30 address 192.168.30.1 prefix-length 24
admin@SwitchA# set l3-interface vlan-interface vlan40 address 192.168.40.1 prefix-length 24

Step2        Configure an EBGP connection.

admin@SwitchA# set protocols bgp router-id 1.1.1.1
admin@SwitchA# set protocols bgp local-as 100
admin@SwitchA# set protocols bgp neighbor 192.168.30.2 remote-as 200
admin@SwitchA# set protocols bgp neighbor 192.168.40.2 remote-as 300
admin@SwitchA# set protocols bgp ebgp-requires-policy false

Step3        Enable IP routing.

admin@SwitchA# set ip routing enable true

Step4         Commit the configurations.

admin@SwitchA# commit

Switch B

Step1         Configure the VLANs and VLAN interfaces.

admin@SwitchB# set vlans vlan-id 20 l3-interface vlan20
admin@SwitchB# set vlans vlan-id 30 l3-interface vlan30
admin@SwitchB# set interface gigabit-ethernet te-1/1/1 family ethernet-switching native-vlan-id 30
admin@SwitchB# set interface gigabit-ethernet te-1/1/2 family ethernet-switching native-vlan-id 20
admin@SwitchB# set l3-interface vlan-interface vlan20 address 192.168.20.2 prefix-length 24
admin@SwitchB# set l3-interface vlan-interface vlan30 address 192.168.30.2 prefix-length 24

Step2        Configure EBGP connections.

admin@SwitchB# set protocols bgp router-id 2.2.2.2
admin@SwitchB# set protocols bgp local-as 200
admin@SwitchB# set protocols bgp neighbor 192.168.30.1 remote-as 100
admin@SwitchB# set protocols bgp neighbor 192.168.20.1 remote-as 400
admin@SwitchB# set protocols bgp ebgp-requires-policy false

Step3        Enable IP routing.

admin@SwitchB# set ip routing enable true

Step4         Commit the configurations.

admin@SwitchB# commit

Switch C

Step1         Configure the VLANs and VLAN interfaces.

admin@SwitchC# set vlans vlan-id 40 l3-interface vlan40
admin@SwitchC# set vlans vlan-id 50 l3-interface vlan50
admin@SwitchC# set interface gigabit-ethernet te-1/1/2 family ethernet-switching native-vlan-id 40
admin@SwitchC# set interface gigabit-ethernet te-1/1/3 family ethernet-switching native-vlan-id 50
admin@SwitchC# set l3-interface vlan-interface vlan40 address 192.168.40.2 prefix-length 24
admin@SwitchC# set l3-interface vlan-interface vlan50 address 192.168.50.2 prefix-length 24

Step2        Configure the EBGP connection.

admin@SwitchC# set protocols bgp router-id 3.3.3.3
admin@SwitchC# set protocols bgp local-as 300
admin@SwitchC# set protocols bgp neighbor 192.168.40.1 remote-as 100
admin@SwitchC# set protocols bgp neighbor 192.168.50.1 remote-as 400
admin@SwitchC# set protocols bgp ebgp-requires-policy false

Step3        Enable IP routing.

admin@SwitchC# set ip routing enable true

Step4         Commit the configurations.

admin@SwitchC# commit

Switch D

Step1         Configure the VLANs and VLAN interfaces.

admin@SwitchD# set vlans vlan-id 10 l3-interface vlan10
admin@SwitchD# set vlans vlan-id 20 l3-interface vlan20
admin@SwitchD# set vlans vlan-id 50 l3-interface vlan50
admin@SwitchD# set interface gigabit-ethernet te-1/1/1 family ethernet-switching native-vlan-id 10
admin@SwitchD# set interface gigabit-ethernet te-1/1/2 family ethernet-switching native-vlan-id 20
admin@SwitchD# set interface gigabit-ethernet te-1/1/3 family ethernet-switching native-vlan-id 50
admin@SwitchD# set l3-interface vlan-interface vlan10 address 192.168.10.1 prefix-length 24
admin@SwitchD# set l3-interface vlan-interface vlan20 address 192.168.20.1 prefix-length 24
admin@SwitchD# set l3-interface vlan-interface vlan50 address 192.168.50.1 prefix-length 24

Step2        Configure the EBGP connection.

admin@SwitchD# set protocols bgp router-id 4.4.4.4
admin@SwitchD# set protocols bgp local-as 400
admin@SwitchD# set protocols bgp neighbor 192.168.20.2 remote-as 200
admin@SwitchD# set protocols bgp neighbor 192.168.50.2 remote-as 300
admin@SwitchD# set protocols bgp ebgp-requires-policy false

Step3        Enable IP routing.

admin@SwitchC# set ip routing enable true

Step4         Commit the configurations.

admin@SwitchD# commit

Viewing BGP Peer Status on Switch B

admin@SwitchB# run show bgp neighbor
BGP neighbor on vlan30: 192.168.30.1, remote AS 100, local AS 200, external link
  BGP version 4, remote router ID 1.1.1.1, local router ID 2.2.2.2
  BGP state = Idle
  Last read 00:15:06, Last write never
  Hold time is 180, keepalive interval is 60 seconds
  Graceful restart information:
    Local GR Mode: Helper*
    Remote GR Mode: NotApplicable
    R bit: False
    Timers:
      Configured Restart Time(sec): 120
      Received Restart Time(sec): 0
  Message statistics:
    Inq depth is 0
    Outq depth is 0
                         Sent       Rcvd
    Opens:                  0          0
    Notifications:          0          0
    Updates:                0          0
    Keepalives:             0          0
    Route Refresh:          0          0
    Capability:             0          0
    Total:                  0          0
  Minimum time between advertisement runs is 0 seconds
 
 For address family: IPv4 Unicast
  Not part of any update group
  Community attribute sent to this neighbor(all)
  0 accepted prefixes
 
  Connections established 0; dropped 0
  Last reset 00:15:06,  Waiting for Peer IPv6 LLA
BGP Connect Retry Timer in Seconds: 120
Read thread: off  Write thread: off  FD used: -1
 
BGP neighbor is 192.168.20.2, remote AS 400, local AS 200, internal link
 Administratively shut down
  BGP version 4, remote router ID 3.3.3.3, local router ID 2.2.2.2
  BGP state = Idle
  Last read 00:15:06, Last write never
  Hold time is 180, keepalive interval is 60 seconds
  Graceful restart information:
    Local GR Mode: Helper*
    Remote GR Mode: NotApplicable
    R bit: False
    Timers:
      Configured Restart Time(sec): 120
      Received Restart Time(sec): 0
  Message statistics:
    Inq depth is 0
    Outq depth is 0
                         Sent       Rcvd
    Opens:                  0          0
    Notifications:          0          0
    Updates:                0          0
    Keepalives:             0          0
    Route Refresh:          0          0
    Capability:             0          0
    Total:                  0          0
  Minimum time between advertisement runs is 600 seconds
 
 For address family: IPv4 Unicast
  Not part of any update group
  Advertise bestpath per AS via addpath
  Override ASNs in outbound updates if aspath equals remote-as
  Community attribute sent to this neighbor(all)
  0 accepted prefixes
 
  Connections established 0; dropped 0
  Last reset 00:15:06,  No AFI/SAFI activated for peer
  External BGP neighbor may be up to 255 hops away.
BGP Connect Retry Timer in Seconds: 111
Peer Authentication Enabled
Read thread: off  Write thread: off  FD used: -1
 
BGP neighbor is 192.168.40.2, remote AS 200, local AS 200, internal link
  BGP version 4, remote router ID 4.4.4.4, local router ID 2.2.2.2
  BGP state = Active
  Last read 00:15:06, Last write never
  Hold time is 180, keepalive interval is 60 seconds
  Graceful restart information:
    Local GR Mode: Helper*
    Remote GR Mode: NotApplicable
    R bit: False
    Timers:
      Configured Restart Time(sec): 120
      Received Restart Time(sec): 0
  Message statistics:
    Inq depth is 0
    Outq depth is 0
                         Sent       Rcvd
    Opens:                  0          0
    Notifications:          0          0
    Updates:                0          0
    Keepalives:             0          0
    Route Refresh:          0          0
    Capability:             0          0
    Total:                  0          0
  Minimum time between advertisement runs is 0 seconds
 
For address family: IPv4 Unicast
  Not part of any update group
  Advertise bestpath per AS via addpath
  Override ASNs in outbound updates if aspath equals remote-as
  Community attribute sent to this neighbor(all)
  0 accepted prefixes
 
  Connections established 0; dropped 0
  Last reset 00:15:06,  No AFI/SAFI activated for peer
  External BGP neighbor may be up to 255 hops away.
BGP Connect Retry Timer in Seconds: 111
Peer Authentication Enabled
Read thread: off  Write thread: off  FD used: -1

Configuring Switch D to Advertise Route 192.168.10.0/24

admin@SwitchD# set protocols bgp ipv4-unicast network 192.168.10.0/24
admin@SwitchD# commit

Configure Switch A to Enable BGP Load Balancing

Because Switch A has two routes to reach AS 400, configuring load balancing over the two BGP routes on Switch A can improve link usage.

admin@SwitchA# set protocols bgp ipv4-unicast multipath ebgp maximum-paths 2
admin@SwitchA# commit

 Then you can view the BGP routing table to 192.168.10.0/24 on Switch A, you can find that:

  • The route 192.168.10.0/24 has two next hops, 192.168.30.2 and 192.168.40.2, both of which are marked with a greater-than sign (>), indicating that they are the optimal routes.

  • By using the run show bgp route 192.168.10.0/24 command, you can find two routes to 192.168.10.0/24. One has next hop 192.168.30.2 and output interface VLAN interface vlan30, and the other has next hop 192.168.40.2 and output interface VLAN interface vlan40.









Copyright © 2024 Pica8 Inc. All Rights Reserved.