Networking

Five things you should know about Cisco IOS BGP configuration


The Border Gateway Protocol (BGP) is the routing protocol of the Internet. However, routers usually only use BGP when there are multiple connections to the Internet.

But if you did have a BGP router configuration, would you know what to look for? Let's look at a sample configuration and discuss what you need to know.

If you used the show running-configuration command or the show runn|beg bgp command, would you know what you were looking at in the output? Below is an example of a BGP router configuration from an actual working router. (I've changed the passwords, IP addresses, and AS numbers for security purposes.)

TechRepublic-Router# show running-configuration | beg bgp

router bgp 55555

no synchronization

bgp log-neighbor-changes

bgp dampening

network 3.3.3.0

neighbor 1.1.1.1 remote-as 1234

neighbor 1.1.1.1 description Provider1

neighbor 1.1.1.1 password 7 09823490822093482F

neighbor 1.1.1.1 update-source Loopback1

neighbor 1.1.1.1 version 4

neighbor 1.1.1.1 route-map Provider1 out

neighbor 2.2.2.2 remote-as 5678

neighbor 2.2.2.2 description Provider2

neighbor 2.2.2.2 password 7 09823490822093482F

neighbor 2.2.2.2 update-source Loopback2

neighbor 2.2.2.2 version 4

neighbor 2.2.2.2 weight 50

What can we tell from this output? We can tell that this router connects to two ISPs, and it's probably performing dynamic, shortest AS path routing between the two. In addition, we can tell that passwords exist on each connection, and there are descriptions to help identify each connection.

Now that you have an idea what we're working with, here are the five most important things you need to know about BGP configuration.

1. What is the AS number?

A very important number in this configuration is the autonomous system (AS) number. In this example, it's 55555, in the line route bgp 55555.

This number uniquely identifies the routing domain under your control that connects to the Internet. BGP is a "path vector" routing protocol. In its most basic sense, BGP's job is to choose the shortest path through the Internet cloud of autonomous systems.

You can obtain the BGP AS number from the American Registry for Internet Numbers (ARIN). The AS number uniquely identifies you in the BGP cloud of the Internet.

2. What is the minimum needed to configure a BGP neighbor?

The minimum BGP configuration that a router needs to communicate with a BGP peer (i.e., a neighbor) is a neighbor statement and a route to that neighbor. The configuration could be as small as this:

router bgp 55555

neighbor 1.1.1.1 remote-as 1234

However, more realistically, you're also advertising a network. For example:

network 3.3.3.0

With this command, you're telling BGP neighbors which IP network you're advertising to them. That way, when you send traffic out, they know how to get the response back to you. In addition, you should configure a password to perform secure MD5 encryption on BGP transactions.

3. Which BGP show commands should I use?

Here are the two most important BGP show commands:

  • Show ip bgp summary: This command displays the status of your BGP peering relationships.
  • Show ip bgp: This command displays all routes received from your BGP peers.

You'll use these commands over and over again when using BGP. In fact, I've used them so much that I created command shortcuts. Here's an example:

alias exec sib show ip bgp

alias exec sibs show ip bgp summary

Now, I can just type sib or sibs to get this important BGP command output.

4. Which metrics does BGP use?

When using BGP, you need to know how BGP makes its decisions. I mentioned that BGP chooses the shortest AS path through the Internet. While this is true, it also uses a number of other important metrics to make decisions.

To find out, read Cisco's BGP Best Path Selection Algorithm documentation. For example, the metric of "shortest AS path" is actually fourth in the list of metrics used. BGP only uses it if there's a "tie" when comparing the weight, local preference, and locally originated vs. aggregate addresses.

5. What's with the no synchronization command?

One of the more confusing BGP commands is the no synchronization command. By default, BGP only advertises routes (i.e., networks) to neighbors if it already has an internal route with that route in the routing table. Many times, this is one of the first things that admins do when configuring BGP -- simply because they don't have a dynamic internal routing protocol running on their Internet router.

But there's a purpose for this command -- to only advertise networks that the router can communicate with. However, you can still disable it. Here's an example:

Router bgp 55555

no synchronization

Get more resources

David Davis has worked in the IT industry for 12 years and holds several certifications, including CCIE, MCSE+I, CISSP, CCNA, CCDA, and CCNP. He currently manages a group of systems/network administrators for a privately owned retail company and performs networking/systems consulting on a part-time basis.

Want to learn more about router and switch management? Automatically sign up for our free Cisco Routers and Switches newsletter, delivered each Friday!

9 comments
mvwilkison
mvwilkison

my question is-- when using BGP which is best practice. to announce static network routes or to redistribute static subnets. one way saves typing more lines in the configuration. the other way uniquely distributes specific static routes. thanks for your opinion

bjones
bjones

Great tips... I just completed a Cisco BGP class last week and am eager to learn more. Please feature more articles on BGP. Thanks! -Brad Sr. Network Engineer

ashu.bid
ashu.bid

well i like these problem and solution

keeleym
keeleym

Hi David Great article and timely too as I am going over BGP for my CCNP BSCI certification. Also excellent "Get More Resources" links. Best Regards, Michael

avradutta
avradutta

Hi, A nice and concise article for starters. If someone takes a printout of this a admin can easily configure BGP between routers at least the basic configs. All in all helps us all to brush up the basics once in a while. Thanks a lot.

IT cowgirl
IT cowgirl

This is an excellent article and also perfect timing. I just pased my CCNA exam last week and started studies for the CCNP BSCI. I actually noticed questions for this information in my practice questions for BGP! Keep up the fantastic work!

ddavis
ddavis

Hi Avradutta, Thanks for the comments! I am glad you found it useful! And thanks for reading TechRepublic! -David Davis Personal Website: http://www.HappyRouter.com