Do you like this site? Remember to share it to all your friends on Facebook and Twitter!

Thursday, June 13, 2013

Propagation of BGP Routing Information among Routers belonging to Different Companies

Another photo of Jih Yueh Shan Jing Leisure Farm (日月山景休閒農場).
Changhua County, Taiwan (Google Plus)

Yes! Most of the books mentioned this scenario as External BGP (sessions).

Autonomous System (AS) and Autonomous System Number (ASN)

I think the experts in IETF just want to invent a new generic term, general enough, to name any single organization, a company, a corporation, a government, an university, or even a club. Because most of them are just companies, I will call an AS simply a company in this post.

Each such company are assigned with a unique ID number so no two different companies could have the same ID number. That identity, the ID number, is called AS Number (or ASN) in BGP.

Every router belongs to only one company. So, every router can be configured with only one ASN.

External BGP (EBGP)

When routers who speaks BGP belong to different companies, the speaking sessions are called External BGP sessions. On the other hand, when routers belong to the same company, the speaking sessions become Internal BGP (IBGP). Because IBGP is quite different from EBGP, I will cover IBGP soon in another post.

Why two routers talk in BGP? To exchange routing information

That's all.

To this aspect, BGP is not different from RIP. A basic element of BGP routing information is called in this post a BGP Route.

BGP is very similar to RIP

In fact, the basic behaviors of External BGP is almost the same as RIP: I, the BGP router, will share all my best BGP Routes in my memory to all my neighbors, no matter whether that best BGP Routes are generated locally by myself, or are learned from other neighbors. The only major difference is BGP Routes are much more complex than RIP Routes.

Because all BGP routers would do the same sharing, as time goes by, any single BGP Route would be propagated to all routers connected together. This is the same as RIP, isn't it!

There are no special restrictions about how these External BGP should be connected to each other. As long as they are connected in one piece, BGP Routes would be propagated to all routers in the end.

In other words, if you are familiar with RIP, then you are now familiar with BGP. Not that difficult, isn't it!

Neighbors, Peers, Adjacent Routers

By the way, when two routers start to talk in BGP, they see each other as neighbors. Some documents might also use the words "peers" or "adjacent routers" to call the routers we speak BGP to. Neighbors, peers, and adjacent routers are exactly the same in most BGP discussion.

Because BGP makes use of TCP to carry all BGP Routes and notifications, there are no automatic neighbor discovery functions in BGP at all! That is, we have to declare all neighbor BGP routers manually and one by one.

To print out all neighbors speaking BGP with this router, we use command "show ip bgp neighbors" in Cisco routers.

Full Internet Routing Information

For Internet Service Providers, because their routers cannot guess to which public destination IP network should the IP packets be forwarded through which network link they installed, they have to learn the full Internet routing information from any other ISPs. Today, the full Internet routing information is defined by the collection of all possible public BGP Routes, which are exchanged using BGP protocol. The number of all possible public BGP Routes today is over 400,000.

Number of BGP Routes today, captured on http://bgp.potaroo.net/

BGP Routes

Every single BGP Routes has only two parts: (1) destination network and (2) its path attributes. Of course, the path attributes are really complex in BGP protocol. Because most of the textbooks would bore you quite enough to explain these attributes in details one after one, I would leave that boring job to those textbooks.

Another unfortunate thing is that experts in IETF call Part (1) as Network Layer Reachability Information (or NLRI). I cannot figure out why they created this long name, so I will just call it as destination network. Again, if we ignore path attributes at this moment, everything is so similar to RIP, isn't it!

BGP routers will record all BGP Routes learned from neighbors. Many of them would have the same destination prefixes. For each destination network, only the best one will be propagated to BGP neighbors. I have a short discussion about what the best BGP Routes are at the end of this post.

To print out all BGP Routes, we use "show ip bgp" command on Cisco routers.

Screen capture of this page on Cisco's Website.

Destination IP Prefix

For destination network, we used to write them down in such format: (IP Address)/(Number of "1"s prefixed at the Network Mask). For example: 10.0.0.0/8 simply means IP network 10.0.0.0 with Network Mask "11111111.00000000.00000000.00000000". Because of this, we also call a destination network as an destination "IP Prefix".

BGP routers avoid routing loops by signing in at AS-PATH of each BGP Route it propagates

Because I mentioned several times BGP is so similar to RIP, we might start to worry about possible routing-loop problems in RIP: will that happen in BGP, too?

The answer is NO! Designers of BGP added one magic to solve such problems!

It goes like this. Whenever a BGP Route is propagated to any neighbor, I, the BGP router, will sign my name at that BGP Route. There is a special path attribute called AS-PATH in each BGP Route. AS-PATH is simply a sign-in list for all ASes who propagate that BGP Route. Of course, the signing is simply putting my ASN on the top of that list.

One major cause of routing loop is I, the router, propagate exactly the same routing information again and again to my neighbors. With AS-PATH path attribute, BGP router can easily tell which BGP Routes have been propagated by itself before. It simply examines whether or not it has signed in at AS-PATH path attributes. If it has already signed in before, which means that BGP Route has been propagate by itself before, BGP router will drop all such looped BGP Routes.

This magic eliminates all the routing loop problems happened in RIP time! Therefore, we do not have to add tricks such as maximum metric value, split horizon, and poisoning at all in BGP.

Installation of BGP Routes into IP routing table

BGP Routes are quite complex and not designed for fast searching against destination address of all forwarded IP packets. They are only good for BGP protocol to exchange with. They are just information stored in router's memory. They are usually implemented in software.

On the contrary, IP routing table is designed for fast searching. Destinations of all IP packets have to be searched against IP routing table. Usually they are optimized in hardware so the processing time of searching and forwarding every IP packets can be minimized.

Because both tables are designed for different purposes, they have to be translated from BGP Routes installed into IP routing table. The translation rule is very simple: for any destination prefix, only the best one will be translated into IP routing table.

For example, a router might receive 3 BGP Routes for destination network 10.0.0.0/8 from 3 neighbors. However, only the best one will be translated and installed in IP routing table.


The best BGP Route

How to define the "best" BGP Route? BGP compares path attributes of all BGP Routes with the same destination IP Prefix to choose the winner. In previous example, all 3 sets of path attributes of those 3 BGP Routes destined for 10.0.0.0/8 will be compared to each other.

However, comparing complex path attributes is a even more complex task. This is another boring section in most of BGP textbooks, so I will leave it to them as well!

To print out all entries in IP routing table, we use "show ip route" command on Cisco routers.


Let's continue soon in another post about IBGP!

[References]



Do you like this post? You really should consider Subscribing by Email!


Related Posts with Thumbnails

No comments:

Post a Comment

Tip: you can also anonymously comment here.

Popular Posts