BGP Basics – iBGP and eBGP peering

By | May 7, 2014

This is the first post in a mini-series on BGP basics, and looks at setting up internal and external BGP neighbours using loopback interfaces. The advantage loopbacks have over physical interfaces is that they are always up and reachable.

iBGP configuration:

ibgp peering

The routers must be able to reach each others loopback IP’s and we don’t have any dynamic routing protocols running yet, so we add static routes:

R1#sh run | i ip route
ip route 2.2.2.2 255.255.255.255 10.0.0.2

R2#sh run | i ip route 
ip route 1.1.1.1 255.255.255.255 10.0.0.1
R2#ping 1.1.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/20/24 ms

Next, configure the BGP process on each router to use the same AS number, then specify the neighbour, and tell BGP to establish the TCP connection (BGP uses tcp/179) using the loopback 0 interface:

R1#sh run | s router 
router bgp 100
 no synchronization
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 100
 neighbor 2.2.2.2 update-source Loopback0
 no auto-summary

R2#sh run | s router
router bgp 100
 no synchronization
 bgp log-neighbor-changes
 neighbor 1.1.1.1 remote-as 100
 neighbor 1.1.1.1 update-source Loopback0
 no auto-summary

Verify the configuration:

R1#show ip bgp neighbors | include BGP
BGP neighbor is 2.2.2.2,  remote AS 100, internal link
  BGP version 4, remote router ID 2.2.2.2
  BGP state = Established, up for 00:04:10
  BGP table version 1, neighbor version 1/0

R1#show ip bgp summary
BGP router identifier 1.1.1.1, local AS number 100
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
2.2.2.2         4   100       9       9        1    0    0 00:05:21        0

eBGP configuration:

ebgp peering

First, configure the BGP process on each router under the local AS number. Then configure the neighbour with the remote AS number, using loopbacks to connect:

R1#sh run | s router            
router bgp 111
 no synchronization
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 222
 neighbor 2.2.2.2 update-source Loopback0
 no auto-summary

R2#sh run | s router
router bgp 222
 no synchronization
 bgp log-neighbor-changesre 
 neighbor 1.1.1.1 remote-as 111
 neighbor 1.1.1.1 update-source Loopback0
 no auto-summary

At this point we still don’t have established neighbours:

R2#sh ip bgp summary 
BGP router identifier 2.2.2.2, local AS number 222
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
1.1.1.1         4   111       0       0        0    0    0 never    Idle
 
R2#sh ip bgp neighbors | i BGP
BGP neighbor is 1.1.1.1,  remote AS 111, external link
  BGP version 4, remote router ID 0.0.0.0
  BGP state = Idle
  BGP table version 1, neighbor version 0/0
  External BGP neighbor not directly connected.

The reason for this is that eBGP neighbours using an interface that is not directly connected need an extra command that sets the TTL value for the packet to a value that allows it to reach the loopback interface (in this case 2 hops):

R1(config)#router bgp 111
R1(config-router)#neighbor 2.2.2.2 ebgp-multihop 2

R2(config)#router bgp 222
R2(config-router)#neighbor 1.1.1.1 ebgp-multihop 2

Verify the configuration:

R1#sh ip bgp summary 
BGP router identifier 1.1.1.1, local AS number 111
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
2.2.2.2         4   222       8       8        1    0    0 00:04:10        0

R1#sh ip bgp neighbors | i BGP
BGP neighbor is 2.2.2.2,  remote AS 222, external link
  BGP version 4, remote router ID 2.2.2.2
  BGP state = Established, up for 00:04:46
  BGP table version 1, neighbor version 1/0
  External BGP neighbor may be up to 2 hops away.

I hope this has been a useful explanation. The next post in this series looks at advertising networks into BGP.

Thanks for reading, and good luck with your CCNP studies!

Rich

Follow Rich on Twitter

Leave a Reply

Your email address will not be published. Required fields are marked *