Cisco BGP (Border Gateway Protocol) Basics

As all of the people reading this article probably know, BGP can be a beast that very few network engineers and consultants ever really battle, as it is used only on a specific type of network. This type of network is that of ISP’s and large enterprises with multiple external connectivity points. So why is it used in this way?

Well because it is an Exterior Gateway Protocol (EGP) as opposed to an Interier Gateway Protocol (IGP) which is what defines the more commonly known protocols including:

As such it operates in a different way from these other protocols.

The main purpose of BGP is to exchange routing updates like other routing protocols, but BGP typically does not exchange individual network routes (but it technically can), it exchanges summaries of network routes. This is because the typical use of BGP is over very large networks including the Internet.

Without BGP the Internet as we know it would be quite a bit more inefficient. As it is today the Internet BGP routing tables have over 300,000 active forwarding entries and this is with summarization of over 2 billion addresses. Imagine what these tables would be like without summarization.

For those interested, some ISP’s allow the ability to telnet into their edge BGP routers to view the BGP routing tables (Check out ‘route-server.ip.att.net’).

In its most basic configuration BGP acts very similarly to a distance vector routing protocol. Each network which is advertised is selected by choosing the shortest path. BGP just uses a path (Autonomous Systems – AS) hop count instead of a device hop count.

For example, BGP works by routing traffic between AS’s, so if Verizon had AS 12345 and AT&T had AS 54321 then traffic destined for the AT&T network would be routed from Verizon to AT&T with a path of (54321). What this means is in order to reach a specific network on the AT&T network, traffic on the Verizon network would have to be routed to AS 54321.

In the following figure I show three AS’s and their corresponding path metrics:

Figure 1

BGP also has loop prevention built in (although this is an open debate); this is implemented with a simple mechanism which disallows routes to be advertised into an AS if the local AS is part of the path metric.

With the example above, only the most basic AS_Path metric is shown, however there are many different path attributes which can be used with BGP to affect path selection along with AS_Path.

The following is a brief list of the available path attributes, in order of path selection preference:

Attribute Description
Local Preference Used to configure a preferred path
AS_Path Describes the route path (shortest preferred)
Origin Used to specify the source (origin) of the route, internal (preferred) or external
Multiple Exit Discriminator (MED) Used to specify a preferred path into a specific AS (Not necessarily obeyed by peer)

Basic BGP Configuration

The first thing that must be understood is that each BGP device can have both internal and external BGP connections to other devices. Internal BGP connections are within the same AS while external BGP connections are between different AS’s. This is important because the configuration and behavior is slightly different between the two.

eBGP Configuration

At its most basic the configuration of eBGP requires only two commands, these include:

  1. router bgp as-number
  2. neighbor ip-address remote-as remote-as-number

What makes eBGP configuration obvious from iBGP configuration is that the AS-number which is used in the neighbor command is different than the AS-number configured with the router bgp command.

It must also be known that with eBGP by default there is a direct connection requirement which is enforced by an advertised TTL of 1. Now when configuring BGP using loopback interfaces this can become an issue as the packet actually takes two hops from the remote device to the physical interface and from the physical interface to the loopback interface.

This issue can be resolved by using the neighbor ebgp-multihop command on Cisco equipment.

iBGP Configuration

iBGP configuration is very similar to eBGP configuration but requires a little understanding of iBGP requirements. By default, iBGP requires that all iBGP devices being used are fully meshed (although there are ways of getting around this). This does not however mean that a direct connection is required but that each iBGP peer must neighbor with each other iBGP router.

The following configuration shows that configuration of an iBGP neighbor is the same as with eBGP:

  1. router bgp as-number
  2. neighbor ip-address remote-as remote-as-number

The other thing that must be understood is how external BGP routes are advertised into iBGP. See the following figure:

Figure 2

In this example, when Level3-2 advertises the eBGP route for the 192.168.128.0/17 network to Level3-1 it will do this with a next-hop of 10.10.10.1 by default. Now if Level3-1 does not have a valid route to the 10.10.10.1 address then it will be unable to route traffic destined for the 192.168.128.0/17 network.

The most common method of resolving this issue is by using the neighbor neighbor-ip-address next-hop-self command. When using this command the local eBGP peer will advertise the next-hop with its own IP address and not the address configured with the BGP neighbor command.

In this case, Level3-2 could be configured with the neighbor 10.100.100.2 next-hop-self command which would advertise the 192.168.128.0/17 network with a next-hop of 10.100.100.1 instead of 10.10.10.1.

Mastering BGP

When it comes down to learning BGP you must prepare for a change in your perception of network routing. BGP is a different beast than the other internal routing protocols and without the ability to separate the two makes learning BGP almost impossible.

For most engineers, including myself, BGP is a good skill to know but it is rarely used unless your job is specific to carrier routing networks. If you are interested in getting more in depth information on BGP check out Wendell Odom’s ROUTE certification guide as it has BGP information and check out the Cisco or Juniper web sites for in depth information; the links for these are listed below.

Ready to test your skills in CISCO? See how they stack up with this assessment from Smarterer, the newest addition to the Pluralsight family. Start this CISCO test now

0
 in Cisco

Comments