BGP Configuration Commands

BGP configuration topology

This tutorial describes how to configure bgp with two routers , check bgp peering status and understand different bpg show commands.

EBGP configuration exercise 1:

An eBGP peering can be established by configuring peers in two different autonomous systems. Your task is to configure egbp peering between R1-R2 and advertise loopback networks from both routers.You can do the following steps to make an eBGP peering in the above topology.


Step1 : Configure IP address in the physical interface connecting R1 and R2

Step2: Add loopback interfaces in both routers and configure IP address as in the topology

Step3: Ping between R1 to R2 to check connectivity

Step4: Configure bgp in R1 and R2, add the neighbor and advertise loopback network.

Step5: Verify the peering and check the entries in bgp table.


R1 Configuration:

Configuring IP address and loopback interfaces

R1#

R1#configure terminal

R1(config)#interface fastEthernet 0/0

R1(config-if)#ip address 192.168.1.1 255.255.255.0

R1(config-if)#no shutdown

R1(config-if)#int loopback 1

R1(config-if)#ip address 10.0.0.1 255.0.0.0

R1(config-if)#exit

Configuring BGP

R1(config)#router bgp 1000

R1(config-router)#neighbor 192.168.1.2 remote-as 2000

R1(config-router)#network 10.0.0.0 mask 255.0.0.0

R1(config-router)#exit

R1(config)#exit

R1#

R2 Configuration:

Configuring IP address and loopback interfaces

R2#

R2#configure terminal

R2(config)#interface fastEthernet 0/0

R2(config-if)#ip address 192.168.1.2 255.255.255.0

R2(config-if)#no shutdown

R2(config-if)#exit

R2(config)#interface loopback 1

R2(config-if)#ip address 20.0.0.1 255.0.0.0

R2(config-if)#exit

Configuring BGP

R2(config)#router bgp 2000

R2(config-router)#neighbor 192.168.1.1 remote-as 1000

R2(config-router)#network 20.0.0.0 mask 255.0.0.0

R2(config-router)#exit

R2(config)#exit

R2#


Verifying BGP peering

show ip bgp

Show ip bgp can be used to check all routes learned and advertised by bgp.

show ip bgp

Understanding show ip bgp output

In the above output you can see two networks (10.0.0.0 and 20.0.0.0) in bgp table.

Status code: *>

The status code will show “*” if a route is a valid one and the NOH is reachable. “>” shows that this path is the best path to reachable destination. Status code will be “*>i” if it is a route learned from ibgp peer.

Next Hop:

If the Next Hop column is set 0.0.0.0 , it shows that this network is directly connected one. In the above output R1 has set NOH as 0.0.0.0 for the connected network 10.0.0.0

Metric:

This column shows the value of MED attribute, by default MED is set to 0

LocPrf:

Local preference attribute is not applicable for ebgp peering, so this column is not populated in this scenario. Local preference will be by default 100 for routes learned from ibgp peers.

Weight:

Weight is set to 32768 by default for all local networks and will be 0 for ibgp and ebgp routes

Path and Origin code:

This column shows the value of AS-PATH attribute.

The symbol at the end of line shows the origin code. In the above output origin code is “i” meaning that the network is originally advertised by a bgp speaking router connected to that network


Show ip bgp summary

Show ip bgp summary can be used check how many neighbors are added , status of the peering and the number of routes received from each neighbor.

show ip bgp summary

In the above output, the last column State/PfxRcd is used to understand the status of BGP peering, if it set to a number (0 or more) , it means peering has been established and that value shows how many networks has been learned from that peer. If that colum is showing “Active” or “Idle” , it means bgp peering has not been completed.

Show ip bgp network-address

You can get more details about a path by using the show ip bgp network-address command.

show ip bgp network address

Note: Configuring ibgp peering is similar to ebgp , one thing to remember is that you need to disable “synchronization” if it is not disabled by default. You can do this by using the command “no synchronization” after getting in to bgp configuration mode.




Ebgp configuration exercise 2:

Configuring ebgp peering with loopback interfaces

Remember the following important points when loopback interfaces are used for ebgp peering

Peer’s loopback IP should be reachable:

Both routers should have a route to reach the neigbor’s loopback network, you may use a static route or RIP/OSPF to advertise this network before BGP is configured.

Update the source IP address:

By default the source IP address of all bgp packets will be IP address of the interface that is used to send the packet to that neighbor, but in this case, peer is expecting packets with source IP set to the peer’s loopback interface. To change the source IP address , use “update-source” with neighbor command.

Change the default TTL

TTL is set to 1 when ebgp peerings are formed, but this will not work when loopback interfaces are used . You have to set the TTL value to 2 or higher using the “ebgp-multihop” option.

Configuration:

Configure IP address and loopback interface similar to exercise 1. In R1, add one more loopback interface with IP address 21.0.0.1/8.

Configuring BGP in R1

R1#

R1#configure terminal

R1(config)#ip route 20.0.0.0 255.0.0.0 192.168.1.2

R1(config)#router bgp 1000

R1(config-router)#neighbor 20.0.0.1 remote-as 2000

R1(config-router)#neighbor 20.0.0.1 update-source loopback 1

R1(config-router)#neighbor 20.0.0.1 ebgp-multihop 2

R1(config-router)#network 21.0.0.0 mask 255.0.0.0

R1(config-router)#exit

R1(config)#exit

R1#

Configuring BGP in R2

R2#

R2#configure terminal

R2(config)#ip route 10.0.0.0 255.0.0.0 192.168.1.1

R2(config)#router bgp 2000

R2(config-router)#neighbor 10.0.0.1 remote-as 1000

R2(config-router)#neighbor 10.0.0.1 update-source loopback 1

R2(config-router)#neighbor 10.0.0.1 ebgp-multihop 2

R2(config-router)#exit

R2(config)#exit

R2#

Checking peering and networks learned:

show ip bgp summary ebgp

Show ip bgp neighbors

show ip bgp neighbors can be used to get detailed information about all neighbors

show ip bgp neighbors

Related:

Cisco OSPF configuration commands

Cisco RIP configuration commands

Cisco basic commands


CONTACT

Contact us and we'll get back to you within 24 hours.

#11, 8th cross, Indiranagar 1st stage, Bangalore, India

Queries?
You can connect with us on Whatsapp 8884 884 844