I’m not going to lie. The first time I used BGP it confused the crap out of me. If you come from an enterprise environment (like me) then you are probably pretty familiar with  how IGPs (for me it was OSPF) behave – if not how they work.

You insert a network statement and your IGP of choice starts working on all the interfaces within that network statement and hey presto – everything more or less straight up works. You don’t really need to understand how LSAs are propagated to get OSPF up and running.

Then one day you will undoubtedly have to configure BGP. BGP is a fairly different beast. The commands work differently, the protocol works differently.

So this post is a little about some of the differences between an IGP that we are all used to and BGP. BGP is probably my favourite protocol to work with in networking for the amount of granularity and options you have to play with.

The Basics

So some very basic 101 on how BGP works compared to an IGP.

With an IGP, you use the network statement to activate the IGP on any interface that is matched to that statement. For example network area 0 will active OSPF in area 0 all interfaces on that router that have an address 192.168.x.x. The fact that the network associated with these interfaces is advertised is sort of secondary.

Usually this activation will mean that the router begins sending hellos out the interface to in whatever manner used by the IGP. Sticking with OSPF this means sending out hellos to (all routers) multicast address. If there are other routers on the segment and the appropriate parameters match then a neighbourship forms and the routers will begin exchanging their LSDB.

BGP, is not like that. BGP does not send hellos out some multicast address, and neighbourships can not beformed dynamically. Also, the network command has nothing to do with forming neighbourships in BGP. But we’ll get back to that shortly.

To form a neighbourship you need 2 basic commands within your router bgp config:

neighbor [IP address] remote-as [AS number]
neighbor [IP address] update-source [Interface]


This specifies 3 important things. The neighbours IP address, the neighbours AS and the interface to use as a source.

The source interface must match the IP address used by the neighbour.

What these commands do is open up TCP port 179 to accept incoming connections from the IP address specified in the neighbor command. Simultaneously the router will also begin attempting to connect to TCP port 179 on the IP address specified.

Once both sides are configured, and assuming that both sides can route to their neighbours IP address – then a neighbourship will form.

Distant Neighbours

Something to note with BGP neighbours – they don’t have to be directly connected or in the same subnet. Often it is desirable that they aren’t. One common scenario is to form neighbourships between loopbacks. This ensures your BGP neighbourship remains up even if a physical interface goes down. You can’t normally do this with IGPs (ignoring things like virtual-links).

The Network Command and Advertised Routes

In an IGP all routes will be advertised if they either run the IGP (ie, are matched by the network command) or they are redistributed into the protocol by a redistribute command.

In BGP, things are a little different. Routes can be advertised via redistribution which works much the same, or via a network command. The network command in BGP takes a different form and has a different function. It is used only to advertise routes – not to activate the protocol on an interface. In BGP the network command takes the form of:

network [IP address] mask [subnet mask]

Note that the mask is not a wildcard mask, but a subnet mask. The network command must match exactly a network that is already in the routers routing tabling – even the subnet mask must match. For example, if a router has a route for then the command network mask will NOT advertise this route in BGP as the masks do not match.

Second, this network command does not have to reference a locally connected interface or static route. If can reference the fact that it has learnt this route via another source, say, an IGP. For example, if is learnt via OSPF, the local router can advertise this route to its BGP neighbours with the command network mask, the router will withdraw this route from BGP is it looses this route from its local routing table (eg, OSPF dies).

Hopefully this makes configuring and understanding BGP a little easier. I will try and do a follow up post with some examples of some of the BGP show commands and filtering options that makes BGP so nice.

This entry was posted in BGP by Tom. Bookmark the permalink.

Leave a Reply

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