Thursday, 14 August 2014

Basic iBGP Peering

Here is a quick tutorial on how to establish a iBGP session between two neighboring routers.

Here is a snapshot of the topology I will be using:

All interfaces are up/up and all IP addresses have been configured.  Here is the output of the 'show ip int brief' and 'show ip route' commands on each router so you can see where I'm starting from:

R1#show ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.1.1     YES manual up                    up
FastEthernet0/1            unassigned      YES unset  administratively down down
Loopback0                  10.10.10.1      YES manual up                    up

R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/24 is subnetted, 1 subnets
C       10.10.10.0 is directly connected, Loopback0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
R1#

R2#show ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.1.2     YES manual up                    up
FastEthernet0/1            unassigned      YES unset  administratively down down
Loopback0                  20.20.20.1      YES manual up                    up

R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     20.0.0.0/24 is subnetted, 1 subnets
C       20.20.20.0 is directly connected, Loopback0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
R2#

Step 1 - Basic BGP Configuration

I should mention now that we are configuring 'iBGP' or 'internal' BGP because both of these routers sit within the same autonomous system (65000).  If we were to peer two routers that were in different autonomous systems, we would be configuring 'eBGP' or 'external' BGP.  The process is practically identical either way, I just thought I'd clarify that we are setting up iBGP in this tutorial.

Here are the commands you need to bring up a basic peering session between R1 and R2:

R1(config)#router bgp 65000
R1(config-router)#neighbor 192.168.1.2 remote-as 65000

R2(config)#router bgp 65000
R2(config-router)#neighbor 192.168.1.1 remote-as 65000

After a moment you should see the BGP session come up:

R1(config-router)#
*Aug 14 11:16:06.427: %BGP-5-ADJCHANGE: neighbor 192.168.1.2 Up
R1(config-router)#

R2(config-router)#
*Aug 14 11:16:07.059: %BGP-5-ADJCHANGE: neighbor 192.168.1.1 Up
R2(config-router)#

In this case we have used the IP address of the neighboring routers fa0/0 interface to establish the session however with iBGP it is common practice to use loopback IP's to establish peering sessions.

Let's try removing the configuration we just made and re-establishing the session using the loopback0 IP of each router.

Step 2 - Re-establish Session with Loopbacks


R1(config)#no router bgp 65000
R1(config)#
*Aug 14 11:24:40.063: %BGP-5-ADJCHANGE: neighbor 192.168.1.2 Down BGP protocol initialization
R1(config)#router bgp 65000
R1(config-router)#neighbor 20.20.20.1 remote-as 65000

R2(config)#no router bgp 65000
R2(config)#router bgp 65000
R2(config-router)#neighbor 10.10.10.1 remote-as 65000

At this point you're probably sitting there quietly waiting...waiting...waiting...but nothing is happening.  Why isn't the peering session coming up?


Let's issue the 'show ip bgp summary' command on both routers and see what we get:

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

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
20.20.20.1      4 65000       0       0        0    0    0 never    Active
R1#

R2#show ip bgp summary
BGP router identifier 20.20.20.1, local AS number 65000
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.10.10.1      4 65000       0       0        0    0    0 never    Active
R2#

You'll notice that each router has a neighbor listed but look at the 'Up/Down' column.  Anytime you see 'never' in this column it's usually a good indicator that something is wrong.

It's because the loopback IP that you use to establish the session with the neighboring router MUST BE REACHABLE (ie. it must be in the routing table) otherwise the router will not establish a BGP session.

Let's go ahead and try configuring a static route on each router, telling it how to get the loopback IP of the neighboring router:

R1(config)#ip route 20.20.20.0 255.255.255.0 192.168.1.2

R2(config)#ip route 10.10.10.0 255.255.255.0 192.168.1.1

Hmmmmmmmm...we're still not getting the session to come online.  This is because we need to configure the loopback0 interface of each router to be the source for BGP updates.  I won't get into the details of why this needs to be done because it is beyond the scope of this simple tutorial but I promise I will go over this topic again in more detail when we get into the more complex configurations of BGP.

For now let's just specify the update source on each router:

R1(config)#router bgp 65000
R1(config-router)#neighbor 20.20.20.1 update-source loopback0
R1(config-router)#

R2(config)#router bgp 65000
R2(config-router)#neighbor 10.10.10.1 update-source loopback0
R2(config-router)#

And voila!  The peering session finally comes up on each router:

R1(config-router)#
*Aug 14 11:56:00.243: %BGP-5-ADJCHANGE: neighbor 20.20.20.1 Up

R2(config-router)#
*Aug 14 11:56:00.835: %BGP-5-ADJCHANGE: neighbor 10.10.10.1 Up

Step 4 - Verification

Now we will issue the 'show ip bgp summary' command on each router again and see what we get in the Up/Down column:

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

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
20.20.20.1      4 65000      24      24        1    0    0 00:11:43        0
R1#

R2#show ip bgp summary
BGP router identifier 20.20.20.1, local AS number 65000
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.10.10.1      4 65000      25      25        1    0    0 00:12:03        0
R2#


No comments:

Post a Comment