Monday, October 08, 2007

BGP - Important Notes

I have spent the last serveral days to read to about BGP. All I can say is BGP is the most complicated routing protocol than any others. That the reason why almost 300 pages on TCP/IP Routing II are all about this protocol. Anyway, here is some important notes I should remember:
- What is NLRI (Network Layer Reachability Info)?-is the network address that the current BGP-speaker can reach. This info is included in the Update message sending to BGP-peer.

-Advertising iBGP-learnt routes rule: BGP does not advertise routes that have been learned from an iBGP peer to another iBGP peer on the same AS. The reason for this is because within the same AS, the router does not append its AS number to AS_PATH so that if iBGP sends update to its iBGP peer, loop will happen.

- Injecting IGP routes into BGP: 2 methods
Method1: use Route Redistribution
Use distribute command to allows all routes learnt by EIGRP to be distributed into Tao’s BGP routing table and then these routes will be advertised to Vail.The advantage of this method is all routes learnt by IGP are automatically redistributed into BGP. In fact, we should always use Route Filter to filter IGP routes that are advertised into BGP. In practice, we rarely use this method to inject IGP routes into BGP. The ORIGIN of routes using this method will be INCOMPLETE.

Method 2: use network command to define advertised network manually.
The network command functions differently under BGP than it does under an IGP. When used with an IGP, the network command specifies the address of an interface or group of interfaces on which the routing protocol is enabled. When used with BGP, network specifies an IP prefix to be advertised. For each prefix specified with the command, BGP looks into the routing table. If an entry in the table exactly matches the network prefix, that prefix is entered into the BGP table and advertised. This method is commonly used because we can control advertised routes. The ORIGIN of routes using this method will be IGP (i)

Rule of BGP Synchronization: If we enable Synchronization, a BGP-router cannot advertise iBGP-learnt routes to an eBGP peer unless the routes are in its routing table. By default, Synchronization is disabled on BGP router.

- Injecting BGP routes into IGP:

We use redistribute bgp [AS] command to redistribute BGP routes into IGP. However, it is rarely to distribute BGP routes into IGP because BGP is normally used in Internet so that the BGP routes are very large, we should not redistribute all of these routes into IGP. A method to redistribute each BGP route manually into IGP is using static route. For example, on eBGP router, we create static route for the network that we want to redistribute into IGP. Then redistribute the static route into IGP.

- NEXT_HOP Attribute: 3 cases

Case1: If the advertising router & receiving router in different AS -->NEXT_HOP = IP of advertising router.

Case2: If the advertising router & receiving router are in the same AS and the NLRI refers to a destination within the same AS, NEXT_HOP = IP of advertising router.

Case3: If the advertising router & receiving router are in the same AS and the NLRI refers to a destination in different AS, NEXT_HOP = IP of external peer from which the route was learnt.

- ebgp-multihop : In EBGP, neighbor relationships are only formed if we have directly connected networks. We would require to use ebgp-multihop keyword with neighbor statement so that neighbors which are not directly connected can form relationship with each other. We need to specify a number with ebgp-multihop keyword, number can be between 1-255. This number represents how many hop counts is the router away.

- update-source: We need to specify the interface which will be used to update neighbor table incase routers are not directly connected. Without update-source we will not be able to form BGP neighbor relationships. update-source keyword will update the interface which will be used to form neighbor relationship. see configuration example below for better understanding.

- next-hop-self:
+ When a Router advertises its eBGP-learnt routes to its iBGP peer, it does not change the next-hop of these routes. For example, RouterA learns eBGP routes from its eBGP peer (RouterB), the routes has the next-hop is RouterB. When RouterA advertises these eBGP-routes to its iBGP peer, the next-hop is kept the same which is RouterB.
+ In contrast, when a Router advertises its iBGP-learnt routes to its eBGP peer, it changes the next-hop of these routes to be itself.
Next-hop-self is a command that allows the router change the next-hop of eBGP routes to be itself before it advertises these routes to its iBGP neigh

- Synchronization:
Before advertising a route to eBGP peer, iBGP router must check to assure that route is in its routing table. By default, Synchronization is disable.

No comments: