...
Figure 1. BGP Load Balancing
Procedure
This section describes the steps of how to configure basic BGP functions on SwitchA, SwitchB, SwitchC and SwitchD.
Switch A
Step1 Configure the VLANs and VLAN interfaces.
Code Block |
---|
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 gete-1/1/1 family ethernet-switching native-vlan-id 30 admin@SwitchA# set interface gigabit-ethernet gete-1/1/2 family ethernet-switching native-vlan-id 40 admin@SwitchA# set vlanl3-interface vlan-interface vlan30 vif vlan30 address 192.168.30.1 prefix-length 24 admin@SwitchA# set vlanl3-interface vlan-interface vlan40 vif vlan40 address 192.168.40.1 prefix-length 24 |
...
Code Block |
---|
admin@SwitchA# set protocols bgp bgprouter-id 1.1.1.1 admin@SwitchA# set protocols bgp local-as 100 admin@SwitchA# set protocols bgp peerneighbor 192.168.30.2 remote-as 200 admin@SwitchA# set protocols bgp peerneighbor 192.168.3040.2 localremote-ip 192.168.30.1 as 300 |
Step3 Enable IP routing.
Code Block |
---|
admin@SwitchA# set protocolsip bgprouting peer 192.168.40.2 as 300 admin@SwitchA# set protocols bgp peer 192.168.40.2 local-ip 192.168.30.1 |
...
enable true |
Step4 Commit the configurations.
...
Step1 Configure the VLANs and VLAN interfaces.
Code Block |
---|
admin@XorPlus#admin@SwitchB# set vlans vlan-id 20 l3-interface vlan20 admin@XorPlus#admin@SwitchB# set vlans vlan-id 30 l3-interface vlan30 admin@XorPlus#admin@SwitchB# set interface gigabit-ethernet gete-1/1/1 family ethernet-switching native-vlan-id 30 admin@XorPlus#admin@SwitchB# set interface gigabit-ethernet gete-1/1/2 family ethernet-switching native-vlan-id 20 admin@XorPlus#admin@SwitchB# set vlanl3-interface vlan-interface vlan20 vif vlan20 address 192.168.20.2 prefix-length 24 admin@XorPlus#admin@SwitchB# set vlanl3-interface vlan-interface vlan30 vif vlan30 address 192.168.30.2 prefix-length 24 |
Step2 Configure EBGP connections.
Code Block |
---|
admin@XorPlus#admin@SwitchB# set protocols bgp bgprouter-id 2.2.2.2 admin@XorPlus#admin@SwitchB# set protocols bgp local-as 200 admin@XorPlus#admin@SwitchB# set protocols bgp peerneighbor 192.168.2030.1 remote-as 400100 admin@XorPlus#admin@SwitchB# set protocols bgp peerneighbor 192.168.20.1 localremote-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 |
...
as 400 |
Step3 Enable IP routing.
Code Block |
---|
admin@SwitchB# set ip routing enable true |
Step4 Commit the configurations.
...
Step1 Configure the VLANs and VLAN interfaces.
Code Block |
---|
admin@XorPlus#admin@SwitchC# set vlans vlan-id 40 l3-interface 40 admin@XorPlus#admin@SwitchC# set vlans vlan-id 50 l3-interface 50 admin@XorPlus#admin@SwitchC# set interface gigabit-ethernet gete-1/1/2 family ethernet-switching native-vlan-id 40 admin@XorPlus#admin@SwitchC# set interface gigabit-ethernet gete-1/1/3 family ethernet-switching native-vlan-id 50 admin@XorPlus#admin@SwitchC# set vlanl3-interface vlan-interface vlan40 vif vlan40 address 192.168.40.2 prefix-length 24 admin@XorPlus#admin@SwitchC# set vlanl3-interface vlan-interface vlan50 vif vlan50 address 192.168.50.2 prefix-length 24 |
Step2 Configure the EBGP connection.
Code Block |
---|
admin@XorPlus#admin@SwitchC# set protocols bgp bgprouter-id 3.3.3.3 admin@XorPlus#admin@SwitchC# set protocols bgp local-as 300 admin@XorPlus#admin@SwitchC# set protocols bgp peerneighbor 192.168.40.1 remote-as 100 admin@XorPlus#admin@SwitchC# set protocols bgp peerneighbor 192.168.4050.1 localremote-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 |
...
as 400 |
Step3 Enable IP routing.
Code Block |
---|
admin@SwitchC# set ip routing enable true |
Step4 Commit the configurations.
...
Step1 Configure the VLANs and VLAN interfaces.
Code Block |
---|
admin@XorPlus#admin@SwitchD# set vlans vlan-id 10 l3-interface vlan10 admin@XorPlus#admin@SwitchD# set vlans vlan-id 20 l3-interface vlan20 admin@XorPlus#admin@SwitchD# set vlans vlan-id 50 l3-interface vlan50 admin@XorPlus# commit Waiting for merging configuration. Commit OK. Save done. admin@XorPlus# admin@SwitchD# set interface gigabit-ethernet gete-1/1/1 family ethernet-switching native-vlan-id 10 admin@XorPlus#admin@SwitchD# set interface gigabit-ethernet gete-1/1/2 family ethernet-switching native-vlan-id 20 admin@XorPlus#admin@SwitchD# set interface gigabit-ethernet gete-1/1/3 family ethernet-switching native-vlan-id 50 admin@XorPlus#admin@SwitchD# set vlanl3-interface vlan-interface vlan10 vif vlan10 address 192.168.10.1 prefix-length 24 admin@XorPlus#admin@SwitchD# set vlanl3-interface vlan-interface vlan20 vifaddress vlan20 address 192.168.20.1 prefix-length 24 admin@XorPlus#admin@SwitchD# set vlanl3-interface vlan-interface vlan50 vif vlan50 address 192.168.50.1 prefix-length 24 |
Step2 Configure the EBGP connection.
Code Block |
---|
admin@XorPlus#admin@SwitchD# set protocols bgp bgprouter-id 4.4.4.4 admin@XorPlus#admin@SwitchD# set protocols bgp local-as 400 admin@XorPlus#admin@SwitchD# set protocols bgp peerneighbor 192.168.20.2 remote-as 200 admin@XorPlus#admin@SwitchD# set protocols bgp peerneighbor 192.168.2050.2 localremote-ip 192.168.20.1 admin@XorPlus#as 300 |
Step3 Enable IP routing.
Code Block |
---|
admin@SwitchC# set protocolsip bgprouting peer 192.168.50.2 as 300 admin@XorPlus# set protocols bgp peer 192.168.50.2 local-ip 192.168.50.1 |
...
enable true |
Step4 Commit the configurations.
Code Block |
---|
admin@SwitchD# commit |
Viewing BGP Peer Status on Switch B and Switch C
Code Block |
---|
admin@XorPlus#admin@SwitchB# run show bgp peersneighbor detailBGP neighbor Peeron 2vlan30: local 192.168.20.2/17930.1, 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
Code Block |
---|
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:
Code Block |
---|
admin@XorPlus# set protocols bgp multipath disable false |
Configure Switch D to advertise route 192.168.10.0/24:
Code Block |
---|
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# set protocols bgp export direct-to-bgp |
View the BGP routing table of Switch A:
Code Block |
---|
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
增加描述Multipath Path-Relax。
Code Block |
---|
admin@XorPlus# set protocols bgp multipath path-relax true
admin@XorPlus# commit
Waiting for merging configuration.
Commit OK.
Save done.
admin@XorPlus# |
...
Code Block |
---|
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# 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
Code Block |
---|
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.
Code Block |
---|
admin@SwitchA# set protocols bgp ipv4-unicast multipath ibgp 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.