Sunday 13 March 2011

BGP.

With the first post today, I would like to focus on the BGP routing protocol. I know ( for instance from my personal experience! ) that when people are starting to learn about this protocol, they are a little bit confused. One of the reason is related to the thing, that they are thinking in the IGP-way. Let me show you, where is the problem.

Please take a closer view on the picture:


On the picture we see three routers. Each router is in a different AS. There are two BGP sessions: R1-R2 and R2-R3. Moreover, R1 and R3 are injected their LANs (LANs behind SW1 and SW2, respectively) into the BGP routing table. There is only the BGP, no other routing protocols are running between routers.
Now, lets investigate R1's routing table. R1 knows all routes to the LAN2. However, it cannot ping any address in this LAN. R1 can ping R2, and R2 can ping either R3 or LAN2. What is happening?
The thing is, that when a router is sending the ping generated by itself, it puts to the IP header the IP address of interface from which the router sent the packet. In our case, R1 will send the ping out of the fa0/1 and indeed, R1 will put to the IP packet header the IP address of fa1/0. Eventually the ping will reach LAN2, and R3 will receive the ping reply from LAN2. After this, R3 will drop the packet (the ping reply), because R3 doesn't have the route to R1's fa0/1 IP address. That is the reason, why the communication between R1 and LAN2 is unsuccessful.

What we can do about this? Nothing, because we don't have to! In the real network it is pointless to send pings in this way. In real world, devices in LAN1 have to establish the communication with the devices in LAN2. In this situation R3 exactly knows, where to send the reply, because R3 has in routing table route to LAN1.

However, if you are being determinated to send the ping from R1, you can redistribute connected to the BGP table or change the IOS default behavior by:
ping ip_address source [source_ip_address | interface interface mod/num]

At this point I would like to also tell you what is the difference between the network command in IGP and BGP. In the IGP, a router will find all of its interfaces that have the IP address within the network statement and will start to run the IGP process on these interfaces. Beside of this,  the router will start to advertise by IGP process the network to which is directly connected via this interface. Returning to our picture, when you start the IGP between R1 - R2 and R2 - R3, every single network between these routers will be presented in the routing tables of each router.
However, network in BGP works completely different. Whereas the network command in IGP is using to establish the neighborhood between directly connected routers, in BGP this command is only used to insert to the BGP routing table a network and start to advertise it to the other peers. The session between 2 BGP-speaking peers however is configured manually and even it can be configured between non directly connected routers.

So when you establish a BGP-session between 2 routers, the BGP will not start to advertise the network that is between these routers. Whereas when you establish the IGP neighborhood between two directly connected routers, the IGP process will start to advertise the network that is between the routers. That is the reason, why the connection between R1 and LAN2 doesn't work.

No comments:

Post a Comment