Image of Cortney & Jeremy

Configuring Basic BGP

by Jeremy L. Gaddis on November 29, 2008 · 10 comments

in Networking

UPDATE: Added a video demo at the bottom of the post (22-Mar-2008).

Here’s a quick demonstration on how to configure two routers to be BGP neighbors. I’m using dynamips and the same topology from yesterday’s multilink PPP lab (for simplicity):

Autonomous Systems

  • R1 : 42
  • R2 : 69

Networks Advertised

We’ll configure a loopback 0 interface on each of the two routers and then advertise those networks to our BGP neighbors.

  • R1 Loopback0 : 42.42.42.1/24
  • R2 Loopback0 : 69.69.69.1/24

Loopback Configuration

Let’s configure our loopback 0 interfaces first:

R1# configure terminal
R1(config)# interface loopback 0
R1(config-if)# ip address 42.42.42.1 255.255.255.0
R1(config-if)# end
R1#
R2# configure terminal
R2(config)# interface loopback 0
R2(config-if)# ip address 69.69.69.1 255.255.255.0
R2(config-if)# end
R2#

R1 BGP Configuration

Now we’ll configure BGP on R1 and advertise only the 42.42.42.0/24 network into BGP:

R1# configure terminal
R1(config)# router bgp 42
R1(config-router)# network 42.42.42.0 mask 255.255.255.0
R1(config-router)# neighbor 192.168.42.2 remote-as 69
R1(config-router)# end
R1#

R2 BGP Configuration

Likewise, we’ll configure BGP on R2 and advertise only the 69.69.69.0/24 network:

R2# configure terminal
R2(config)# router bgp 69
R2(config-router)# network 69.69.69.0 mask 255.255.255.0
R2(config-router)# neighbor 192.168.42.1 remote-as 42
R2(config-router)# end
R2#

Verification

After a moment we should see a syslog message (on each router) similar to the following, letting us know that an adjacency has formed:

*Mar  1 00:07:28.667: %BGP-5-ADJCHANGE: neighbor 192.168.42.2 Up

BGP is not the fastest protocol when it comes to convergence, but after a moment we should see the neighbors are exchanging routes:

R1# show ip bgp summary
BGP router identifier 42.42.42.1, local AS number 42
BGP table version is 3, main routing table version 3
2 network entries using 234 bytes of memory
2 path entries using 104 bytes of memory
3/2 BGP path/bestpath attribute entries using 372 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 734 total bytes of memory
BGP activity 2/0 prefixes, 2/0 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
192.168.42.2    4    69       5       5        3    0    0 00:01:18        1
R1#
R2# show ip bgp summary
BGP router identifier 69.69.69.1, local AS number 69
BGP table version is 3, main routing table version 3
2 network entries using 234 bytes of memory
2 path entries using 104 bytes of memory
3/2 BGP path/bestpath attribute entries using 372 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 734 total bytes of memory
BGP activity 2/0 prefixes, 2/0 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
192.168.42.1    4    42       6       6        3    0    0 00:02:03        1
R2#

And if we take a look at our routing tables on each router, we should see that the networks we advertised into BGP do, indeed, show up on the other side:

R1# show ip route bgp
     69.0.0.0/24 is subnetted, 1 subnets
B       69.69.69.0 [20/0] via 192.168.42.2, 00:05:00
R1#
R2# show ip route bgp
     42.0.0.0/24 is subnetted, 1 subnets
B       42.42.42.0 [20/0] via 192.168.42.1, 00:04:52
R2#

Success! Later we’ll cover multihoming and the use of weights, local preferences, and MEDs to influence routing decisions.

Previous post:

Next post: