Professional Documents
Culture Documents
BGP Configuration in Details
BGP Configuration in Details
BGP Configuration in Details
In the following network, run eBGP between Switch A and Switch B and iBGP between Switch B and Switch C so that Switch
C can access the network 8.1.1.0/24 connected to Router A.
Configuration procedure
2. Configure iBGP.
To prevent route flapping caused by port state changes, this example uses loopback interfaces to establish iBGP
connections.
Because loopback interfaces are virtual interfaces, you need to use the peer connect-interface command to
specify the loopback interface as the source interface for establishing BGP connections.
Enable OSPF in AS 65009 to ensure that Switch B can communicate with Switch C through loopback interfaces.
# Configure Switch B
HP Switch(config)# router bgp 65009
HP Switch(bgp)# bgp router-id 2.2.2.2
HP Switch(bgp)# neighbor 3.3.3.3 remote-as 65009
HP Switch(bgp)# exit
HP Switch(config)# router ospf
HP Switch(ospf)# enable
HP Switch(ospf)# area 0
HP Switch(ospf)# network 2.2.2.2/32
HP Switch(ospf)# network 9.1.1.1/24
HP Switch(ospf)# exit
HP Switch(config)# vlan 300
HP Switch(vlan-300)# ip ospf
# Configure Switch C
HP Switch(config)# router bgp 65009
HP Switch(bgp)# bgp router-id 3.3.3.3
HP Switch(bgp)# neighbor 2.2.2.2 remote-as 65009
HP Switch(bgp)# neighbor 2.2.2.2 connect-interface loopback 0
HP Switch(bgp)# exit
HP Switch(config)# router ospf
HP Switch(ospf)# enable
HP Switch(ospf)# area 0
HP Switch(ospf)# network 3.3.3.3/32
1 of 12 17/09/2021, 2:00 PM
BGP configuration examples https://techhub.hpe.com/eginfolib/networking/docs/switches/K-KA-K...
Peer Information
The output information shows that Switch C has established an iBGP peer relationship with Switch B.
3. Configure eBGP.
The eBGP peers, Switch A and Switch B (usually belonging to different carriers), are located in different ASs.
Their loopback interfaces are not reachable to each other, so directly connected interfaces are used for establishing
BGP sessions.
To enable Switch C to access the network 8.1.1.0/24 that is connected directly to Switch A, add network 8.1.1.0/24
to the BGP routing table of Switch A.
# Configure Switch A.
HP Switch(config)# router bgp 65008
HP Switch(bgp)# bgp router-id 1.1.1.1
HP Switch(bgp)# neighbor 3.1.1.1 remote-as 65009
HP Switch(bgp)# network 8.1.1.1/24
HP Switch(bgp)# exit
# Configure Switch B.
HP Switch(config)# router bgp 65009
HP Switch(bgp)# neighbor 3.1.1.2 remote-as 65008
HP Switch(bgp)# exit
Peer Information
The output shows that Switch B has established an iBGP peer relationship with Switch C and an eBGP peer relationship
with Switch A.
Local AS : 100
Local Router-id : 20.0.0.1
BGP Table Version : 0
Status codes: * - valid, > - best, i - internal, e -
external, s - stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Local AS : 100
Local Router-id : 20.0.0.1
2 of 12 17/09/2021, 2:00 PM
BGP configuration examples https://techhub.hpe.com/eginfolib/networking/docs/switches/K-KA-K...
Local AS : 100
Local Router-id : 20.0.0.1
NOTE: From the above outputs, you see that Switch A has not learned a route to AS 65009, and Switch C has
learned network 8.1.1.0 but the next hop 3.1.1.2 is unreachable, so the route is invalid.
Configure BGP to redistribute direct routes on Switch B, so that Switch A can obtain the route to 9.1.1.0/24 and Switch
C can obtain the route to 3.1.1.0/24.
# Configure Switch B.
HP Switch(config)# router bgp 65009
HP Switch(bgp)# redistribute connected
Local AS : 65009
Local Router-id : 1.1.1.1
Two routes 2.2.2.2/32 and 9.1.1.0/24 have been added in Switch A’s routing table.
Local AS : 65009
Local Router-id : 3.3.3.3
3 of 12 17/09/2021, 2:00 PM
BGP configuration examples https://techhub.hpe.com/eginfolib/networking/docs/switches/K-KA-K...
*e 9.1.1.0/24 0 0 65008i
*>e 9.1.1.0/24 0 0 65008i
5. Verification.
In the following figure, Switch B establishes eBGP connections with Switch A and C. Configure the No_Export community
attribute on Switch A so that routes from AS 10 are not advertised by AS 20 to any other AS.
Configuration procedure
2. Configure eBGP.
# Configure Switch A.
HP Switch(config)# router bgp 10
HP Switch(bgp)# bgp router-id 1.1.1.1
HP Switch(bgp)# neighbor 200.1.2.2 remote-as 20
HP Switch(bgp)# network 9.1.1.0/255.255.255.0/8
HP Switch(bgp)# exit
# Configure Switch B.
HP Switch(config)# bgp 20
HP Switch(bgp)# bgp router-id 2.2.2.2
HP Switch(bgp)# neighbor 200.1.2.1 remote-as 10
HP Switch(bgp)# neighbor 200.1.3.2 remote-as 30
HP Switch(bgp)# exit
# Configure Switch C.
HP Switch(config)# bgp 30
HP Switch(bgp)# bgp router-id 3.3.3.3
HP Switch(bgp)# neighbor 200.1.3.1 remote-as 20
HP Switch(bgp)# exit
4 of 12 17/09/2021, 2:00 PM
BGP configuration examples https://techhub.hpe.com/eginfolib/networking/docs/switches/K-KA-K...
Local AS : 30
Local Router-id : 3.3.3.3
There is an eBGP connection between Switch A and Switch B. There are iBGP connections between SwitchB and
5 of 12 17/09/2021, 2:00 PM
BGP configuration examples https://techhub.hpe.com/eginfolib/networking/docs/switches/K-KA-K...
Configuration procedure
# Configure Switch A.
HP Switch(config)# router bgp 100
HP Switch(bgp)# bgp router-id 1.1.1.1
HP Switch(bgp)# neighbor 192.1.1.2 remote-as 200
# Configure Switch B.
HP Switch(config)# router bgp 200
HP Switch(bgp)# bgp router-id 2.2.2.2
HP Switch(bgp)# neighbor 192.1.1.1 remote-as 100
HP Switch(bgp)# neighbor 193.1.1.1 remote-as 200
HP Switch(bgp)# neighbor 193.1.1.1 next-hop-self
HP Switch(bgp)# exit
# Configure Switch C.
HP Switch(config)# router bgp 200
HP Switch(bgp)# bgp router-id 3.3.3.3
HP Switch(bgp)# neighbor 193.1.1.2 remote-as 200
HP Switch(bgp)# neighbor 194.1.1.2 remote-as 200
HP Switch(bgp)# exit
# Configure Switch D.
HP Switch(config)# router bgp 200
HP Switch(bgp)# bgp router-id 4.4.4.4
HP Switch(bgp)# neighbor 194.1.1.1 remote-as 200
HP Switch(bgp)# exit
# Configure Switch C.
6 of 12 17/09/2021, 2:00 PM
BGP configuration examples https://techhub.hpe.com/eginfolib/networking/docs/switches/K-KA-K...
Local AS : 200
Local Router-id : 200.1.2.2
Local AS : 200
Local Router-id : 200.1.2.2
In the figure below, all switches run BGP. eBGP connections are between Switch A and Switch B, and between Switch
A and Switch C. iBGP connections are between Switch B and Switch D, and between Switch C and Switch D.
Configure the routing policies. Switch D should use the route 1.0.0.0/8 from Switch C as the optimal route.
7 of 12 17/09/2021, 2:00 PM
BGP configuration examples https://techhub.hpe.com/eginfolib/networking/docs/switches/K-KA-K...
Configuration procedure
# Configure Switch B.
HP Switch(config)# router ospf
HP Switch(ospf)# area 0
HP Switch(ospf)# network 192.1.1.0/ 0.0.0.255
HP Switch(ospf)# network 194.1.1.0/ 0.0.0.255
HP Switch(ospf)# exit
# Configure Switch C.
HP Switch(config)# router ospf
HP Switch(ospf)# enable
HP Switch(ospf)# area 0
HP Switch(ospf)# network 193.1.1.0/ 0.0.0.255
HP Switch(ospf)# network 195.1.1.0/ 0.0.0.255
HP Switch(ospf)# exit
# Configure Switch D.
HP Switch(config)# router ospf
HP Switch(ospf)# enable
HP Switch(ospf)# area 0
HP Switch(ospf)# network 194.1.1.0/ 0.0.0.255
HP Switch(ospf)# network 195.1.1.0/ 0.0.0.255
HP Switch(ospf)# exit
# Configure Switch A.
HP Switch(config)# router bgp 100
HP Switch(bgp)# neighbor 192.1.1.2 remote-as 200
HP Switch(bgp)# neighbor 193.1.1.2 remote-as 200
# Configure Switch B.
HP Switch(config)# router bgp 200
HP Switch(bgp)# neighbor 192.1.1.1 remote-as 100
HP Switch(bgp)# neighbor 194.1.1.1 remote-as 200
HP Switch(bgp)# exit
# Configure Switch C.
HP Switch(config)# router bgp 200
HP Switch(bgp)# neighbor 193.1.1.1 remote-as 100
HP Switch(bgp)# neighbor 195.1.1.1 remote-as 200
HP Switch(bgp)# exit
8 of 12 17/09/2021, 2:00 PM
BGP configuration examples https://techhub.hpe.com/eginfolib/networking/docs/switches/K-KA-K...
# Configure Switch D.
HP Switch(config)# router bgp 200
HP Switch(bgp)# neighbor 194.1.1.2 remote-as 200
HP Switch(bgp)# neighbor 195.1.1.2 remote-as 200
HP Switch(bgp)# exit
4. Configure attributes for route 1.0.0.0/8, making Switch D give priority to the route learned from Switch C.
# Configure a higher MED value for the route 1.0.0.0/8 advertised from Switch A to peer 192.1.1.2.
# Define two routing policies, apply_med_50, which sets the MED for route 1.0.0.0/8 to 50, and apply_med_100, which
sets the MED for route 1.0.0.0/8 to 100.
HP Switch(config)# route-map apply_med_50 permit
HP Switch(route-map-apply_med_50)# match ip address prefix-list pl_1
HP Switch(route policy)# set metric 50
HP Switch(route policy)route-map apply_med_50 permit seq 20
HP Switch(route policy)# exit
# Apply routing policy apply_med_50 to the route advertised to peer 193.1.1.2 (Switch C), and apply_med_100 to the
route advertised to peer 192.1.1.2 (Switch B.)
HP Switch(config)# bgp 100
HP Switch(bgp)# neighbor 193.1.1.2 route-map apply_med_50 out
HP Switch(bgp)# neighbor 192.1.1.2 route-policy apply_med_100 out
HP Switch(bgp)# exit
Local AS : 100
Local Router-id : 194.1.1.1
You can ensure that route 1.0.0.0/8 is the optimal route. Configure different local preferences on Switch B and C for
route 1.0.0.0/ 8, making Switch D give priority to the route from Switch C.
# Configure a routing policy named localpref on Switch C, setting the local preference of route 1.0.0.0/8 to 200 (the
default is 100.)
HP Switch(config)# route-map localpref permit seq 10
HP Switch(route-policy)# match ip address prefix-list pl_1
HP Switch(route-policy)# set local-preference 200
HP Switch(route-policy)# route-map localpref permit seq 20
9 of 12 17/09/2021, 2:00 PM
BGP configuration examples https://techhub.hpe.com/eginfolib/networking/docs/switches/K-KA-K...
Local AS : 100
Local Router-id : 194.1.1.1
You can see that route 1.0.0.0/8 from Switch D to Switch C is the optimal route.
BGP GR configuration
Network requirements
In the following figure, all switches are BGP switches. There is a eBGP connection between Switch A and Switch B. Switch B
and Switch C are connected over an iBGP connection. Enable GR for BGP so that the communication between Switch A and
Switch C is not affected when an active/ standby main board switchover occurs on Switch B.
Configuration procedure
1. Configure Switch A.
10 of 12 17/09/2021, 2:00 PM
BGP configuration examples https://techhub.hpe.com/eginfolib/networking/docs/switches/K-KA-K...
2. Configure Switch B.
3. Configure Switch C.
Verification
After completing the above configuration, perform an active/standby switchover on Switch B. Switch A and Switch C should
be able to ping each other without any packet drops. Also ensure that there are no flaps of BGP learned routes on the peer
switches.
prev up next
11 of 12 17/09/2021, 2:00 PM
BGP configuration examples https://techhub.hpe.com/eginfolib/networking/docs/switches/K-KA-K...
12 of 12 17/09/2021, 2:00 PM