...
Table of Contents |
---|
Network Requirement
As shown in Figure. 1, BGP runs on all the switches.
...
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 configuration
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 1030 l3-interface 10vlan30 admin@SwitchA# set vlans vlan-id 2040 l3-interface 20vlan40 admin@SwitchA# set interface gigabit-ethernet tege-1/1/1 family ethernet-switching native-vlan-id 1030 admin@SwitchA# set interface gigabit-ethernet tege-1/1/2 family ethernet-switching native-vlan-id 2040 admin@SwitchA# set vlan-interface interface 10vlan30 vif 10vlan30 address 192.168.1030.1 prefix-length 24 admin@SwitchA# set vlan-interface interface 20vlan40 vif 20vlan40 address 192.168.2040.1 prefix-length 24 |
Step2 Configure an EBGP connection.
Code Block |
---|
admin@SwitchA# set protocols bgp bgp-id 1.1.1.1 admin@SwitchA# set protocols bgp local-as 100 admin@SwitchA# set protocols bgp peer 192.168.2030.2 as 200 admin@SwitchA# set protocols bgp peer 192.168.2030.2 local-ip 192.168.2030.1 admin@SwitchA# set protocols bgp peer 192.168.40.2 as 300 admin@SwitchA# set protocols bgp peer 192.168.2040.2 nextlocal-hop-self trueip 192.168.30.1 |
Step3 Commit the configurations.
...
Step1 Configure the VLANs and VLAN interfaces.
Code Block |
---|
admin@SwitchB#admin@XorPlus# set vlans vlan-id 20 l3-interface 20vlan20 admin@SwitchB#admin@XorPlus# set vlans vlan-id 30 l3-interface 30vlan30 admin@SwitchB#admin@XorPlus# set vlans vlan-id 40 l3-interface 40 admin@SwitchB# set interface gigabit-ethernet ge-1/1/21 family ethernet-switching native-vlan-id 2030 admin@SwitchB#admin@XorPlus# set interface gigabit-ethernet ge-1/1/32 family ethernet-switching native-vlan-id 3020 admin@SwitchB#admin@XorPlus# set vlan-interface gigabit-ethernet ge-1/1/4 family ethernet-switching native-vlan-id 40 admin@SwitchB# set vlan-interface interface 20 vif 20 address interface vlan20 vif vlan20 address 192.168.20.2 prefix-length 24 admin@SwitchB#admin@XorPlus# set vlan-interface interface 30vlan30 vif 30vlan30 address 192.168.30.12 prefix-length 24 admin@SwitchB# set vlan-interface interface 40 vif 40 address 192.168.40.1 prefix-length 24 |
Step2 Configure EBGP and IBGP connections.
Code Block |
---|
admin@SwitchB# set protocols bgp bgp-id |
Step2 Configure EBGP connections.
Code Block |
---|
admin@XorPlus# set protocols bgp bgp-id 2.2.2.2.2 admin@SwitchB#admin@XorPlus# set protocols bgp local-as 200 admin@SwitchB#admin@XorPlus# set protocols bgp peer 192.168.20.1 as 100400 admin@SwitchB#admin@XorPlus# set protocols bgp peer 192.168.20.1 local-ip 192.168.20.2 admin@SwitchB#admin@XorPlus# set protocols bgp peer 192.168.2030.1 next-hop-self true admin@SwitchB# set protocols bgp peer 192.168.30.2 as 200 admin@SwitchB#as 100 admin@XorPlus# set protocols bgp peer 192.168.30.2 local-ip 192.168.30.1 admin@SwitchB# set protocols bgp peer 192.168.30.2 next-hop-self true admin@SwitchB# set protocols bgp peer 192.168.40.2 as 200 admin@SwitchB# set protocols bgp peer 192.168.40.2 local-ip 192.168.40.1 admin@SwitchB# set protocols bgp peer 192.168.40.2 next-hop-self true |
Step3 Commit the configurations.
Code Block |
---|
admin@SwitchB# commit |
Switch C
Step1 Configure the VLANs and VLAN interfaces.
Code Block |
---|
admin@SwitchC# set vlans vlan-id 40 l3-interface 40 admin@SwitchC# set vlans vlan-id 50 l3-interface 50 admin@SwitchC# set interface gigabit-ethernet ge-1/1/4 family ethernet-switching native-vlan-id 40 admin@SwitchC# set interface gigabit-ethernet ge-1/1/5 family ethernet-switching native-vlan-id 50 admin@SwitchC# set vlan-interface interface 40 vif 40 address 192.168.402 |
Step3 Commit the configurations.
Code Block |
---|
admin@SwitchB# commit |
Switch C
Step1 Configure the VLANs and VLAN interfaces.
Code Block |
---|
admin@XorPlus# set vlans vlan-id 40 l3-interface 40 admin@XorPlus# set vlans vlan-id 50 l3-interface 50 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# 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@SwitchC# set vlan-interface interface 50 vif 50 address 192.168.50.2 prefix-length 24 |
Step2 Configure the IBGP connection.
Code Block |
---|
admin@SwitchC# set protocols |
Step2 Configure the EBGP connection.
Code Block |
---|
admin@XorPlus# set protocols bgp bgp-id 3.3.3.3 admin@SwitchC#admin@XorPlus# set protocols bgp local-as 200300 admin@SwitchC#admin@XorPlus# set protocols bgp peer 192.168.40.1 as 200100 admin@SwitchC#admin@XorPlus# set protocols bgp peer 192.168.40.1 local-ip 192.168.40.2 admin@SwitchC#admin@XorPlus# set protocols bgp peer 192.168.4050.1 next-hop-self true admin@SwitchC# set protocols bgp peer 192.168.50.1 as 200 admin@SwitchC#as 400 admin@XorPlus# set protocols bgp peer 192.168.50.1 local-ip 192.168.50.2 admin@SwitchC# set protocols bgp peer 192.168.50.1 next-hop-self true |
Step3 Commit the configurations.
...
Step1 Configure the VLANs and VLAN interfaces.
Code Block |
---|
admin@SwitchD#admin@XorPlus# set vlans vlan-id 3010 l3-interface vlan10 admin@XorPlus# set vlans vlan-id 20 l3-interface 30vlan20 admin@SwitchD#admin@XorPlus# set vlans vlan-id 50 l3-interface 50 admin@SwitchD# vlan50 admin@XorPlus# commit Waiting for merging configuration. Commit OK. Save done. admin@XorPlus# set interface gigabit-ethernet ge-1/1/31 family ethernet-switching native-vlan-id 3010 admin@SwitchD#admin@XorPlus# set interface gigabit-ethernet ge-1/1/52 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@SwitchD#admin@XorPlus# set vlan-interface interface 30vlan10 vif 40vlan10 address 192.168.3010.21 prefix-length 24 admin@SwitchD#admin@XorPlus# set vlan-interface interface 50vlan20 vif 50vlan20 address 192.168.5020.1 prefix-length 24 |
...
admin@XorPlus# set vlan-interface interface vlan50 vif vlan50 address 192.168.50.1 prefix-length 24 |
Step2 Configure the EBGP connection.
Code Block |
---|
admin@SwitchD#admin@XorPlus# set protocols bgp bgp-id 4.4.4.4 admin@SwitchD#admin@XorPlus# set protocols bgp local-as 200400 admin@SwitchD#admin@XorPlus# set protocols bgp peer 192.168.3020.12 as 200 admin@SwitchD#admin@XorPlus# set protocols bgp peer 192.168.3020.12 local-ip 192.168.3020.21 admin@SwitchD#admin@XorPlus# set protocols bgp peer 192.168.30.1 next-hop-self true admin@SwitchD# set protocols bgp peer 192.168.50.50.2 as 200300 admin@SwitchD#admin@XorPlus# set protocols bgp peer 192.168.50.2 local-ip 192.168.50.1 admin@SwitchD# set protocols bgp peer 192.168.50.2 next-hop-self true |
Step3 Commit the configurations.
Code Block |
---|
admin@SwitchD# commit |
Viewing BGP Peer Status on Switch B
Code Block |
---|
admin@SwitchB#admin@XorPlus# run show bgp peers detail Peer 2: local 192.168.20.2/179 remote 192.168.20.1/17939912 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.12/17916808 remote 192.168.30.21/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 32: local 192.168.40.12/179 remote 192.168.40.21/17938815 Peer ID: 31.31.31.31 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. |
...
Code Block |
---|
admin@SwitchA# set policy policy-statement direct-to-bgp term t1 from protocol connected
admin@SwitchA# set policy policy-statement direct-to-bgp term t1 from network4 192.168.10.0/24
admin@SwitchA# set policy policy-statement direct-to-bgp term t1 then accept
admin@SwitchA# set protocols bgp export direct-to-bgp
admin@SwitchA# commit |
...
Code Block |
---|
admin@SwitchD# 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.20.1 1.1.1.1 100 ?
admin@SwitchD# |
...
Code Block |
---|
admin@SwitchD# run show bgp routes Status Codes: * valid route, > best route Origin Codes: i IGP, e EGP, ? incomplete Prefix Nexthop Peer AS Path ------ ------- ---- -------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 192.168.20.1 2.2.2.2 100 ? admin@SwitchD# |
The preceding command output display that the route to destination 192.168.10.0/24 becomes invalid because the next hop address of this route is unreachable.
Configuring Switch B to Advertise a Connected Route
Code Block |
---|
admin@SwitchB# set policy policy-statement direct-to-bgp term t1 from protocol connected
admin@SwitchB# set policy policy-statement direct-to-bgp term t1 then accept
admin@SwitchB# set protocols bgp export direct-to-bgp
admin@SwitchB# commit |
Ping 192.168.10.1 on Switch C:
Code Block |
---|
admin@SwitchC# run pingadmin@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.10/24 PING 192.168.1030.12 (1922.1682.102.1) 56(84) bytes of data. 64 bytes from 2 200 400 ? 192.168.10.1: icmp_req=1 ttl=63 time=4.68 ms 64 bytes from 0/24 192.168.10.1: icmp_req=2 ttl=63 time=4.46 ms 64 bytes from 192.168.10.1: icmp_req=3 ttl=63 time=5.35 ms 64 bytes from 192.168.10.1: icmp_req=4 ttl=63 time=4.52 ms 64 bytes from 192.168.10.1: icmp_req=5 ttl=63 time=4.51 ms 192.168.10.1 ping statistics — 5 packets transmitted, 5 received, 0% packet loss, time 4017ms rtt min/avg/max/mdev = 4.460/4.709/5.358/0.338 ms |
View the BGP routing table of Switch C:
Code Block |
---|
admin@SwitchC#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# |
View the BGP routing table and IP 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.2040.12 23.23.23.23 200 100400 ? *> admin@XorPlus# admin@XorPlus# run show route table ipv4 unicast ebgp 192.168.20.0/2410.0/24 [ebgp(20)/0] > to 192.168.4030.1 2.2.2.2? *>1922 via vlan30/vlan30 192.168.3010.0/24 [ebgp(20)/0] > to 192.168.40.1 2.2.2.2?2 via vlan40/vlan40 admin@XorPlus# admin@XorPlus# |