Friday, April 23, 2010

BGP Client-Server Architecture - With Old Myth

Click On Image For better view
BGP is a wonderful application. It always feared me in past. So finally I thought to nail it down. Because If I am going to stay longer in Networks I have to be good in BGP because almost every enterprise these days runs BGP in some way. Anyways...Now after over a month of BGP study I feel quite comfortable with that now.

So lets discuss today - BGP Client & Server Architecture along with digging some Myths.

As discussed in my previous posts, Technically Speaking - BGP is an application and not a routing protocol. It runs over top of TCP. It uses well known TCP Port number 179 for this purpose.

But one thing which many people don't know especially if they have passed CCNP recently is that BGP is a Client Server Mode Of Communication. So basically when ever a BGP session is established between two end points; the one side is always going to be act as Server and Other side is going to be act as Client.

Now how we can determine Which side is Client and Which side is Server ?

Hmmm...Just hold that thought for a min and we will get back to that :)

Other misconception I see among people is about command " neighbor x.x.x.x update-source", most of the people I know feel that unless they put this command on both sides, the BGP is not going to work.

But what I would say is that it's just a Myth but nothing else. Technically if you put it in on one side, the neighborship will be formed without any problem. But you can say that for sake of consistency you can put it on both sides which of-course can save significant time in troubleshooting. Simply it's not a bad idea to save your BRAIN CELLS either :)


 Now let's hop on to command line. First we will put "neighbor x.x.x.x update-source" command on both sides, later we will remove it from one side just to see if what I said was true.




R1#sh ip int b | e un|do
Interface                  IP-Address      OK? Method Status   Protocol
Serial1/0                  12.12.12.1      YES manual   up             up
Loopback0                11.11.11.11     YES manual  up             up
Loopback1                1.1.1.1         YES manual    up             up



R1#sh prot | e un|do
Global values:
  Internet Protocol routing is enabled
Serial1/0 is up, line protocol is up
  Internet address is 12.12.12.1/24
Loopback0 is up, line protocol is up
  Internet address is 11.11.11.11/32
Loopback1 is up, line protocol is up
  Internet address is 1.1.1.1/24

R1#sh run | s r o
router ospf 1
 log-adjacency-changes
 network 11.11.11.11 0.0.0.0 area 0
 network 12.12.12.1 0.0.0.0 area 0

R1#sh run | s r b
router bgp 100
 no synchronization
 bgp log-neighbor-changes
 network 1.1.1.0 mask 255.255.255.0
 neighbor 22.22.22.22 remote-as 200
 neighbor 22.22.22.22 ebgp-multihop 255
 neighbor 22.22.22.22 update-source Loopback0
 no auto-summary
------------------------------------------------

R2#sh ip int b | e un|do
Interface                  IP-Address      OK? Method Status  Protocol
Serial1/0                  12.12.12.2      YES manual    up       up
Loopback0                22.22.22.22     YES manual   up       up
Loopback1                2.2.2.2         YES manual     up       up


R2#sh prot | e un|do
Global values:
  Internet Protocol routing is enabled
Serial1/0 is up, line protocol is up
  Internet address is 12.12.12.2/24
Loopback0 is up, line protocol is up
  Internet address is 22.22.22.22/32
Loopback1 is up, line protocol is up
  Internet address is 2.2.2.2/24

R2#sh run | s r o
router ospf 1
 log-adjacency-changes
 network 12.12.12.2 0.0.0.0 area 0
 network 22.22.22.22 0.0.0.0 area 0

R2#sh run | s r b
router bgp 200
 no synchronization
 bgp log-neighbor-changes
 network 2.2.2.0 mask 255.255.255.0
 neighbor 11.11.11.11 remote-as 100
 neighbor 11.11.11.11 ebgp-multihop 255
 neighbor 11.11.11.11 update-source Loopback0
 no auto-summary

R2#ping 1.1.1.1 so lo 1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 2.2.2.2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 52/108/160 ms


R1#sh ip ro b
Gateway of last resort is not set

      2.0.0.0/24 is subnetted, 1 subnets
B        2.2.2.0 [20/0] via 22.22.22.22, 00:10:04

R1#ping 2.2.2.2  so lo 1 rep 10

Type escape sequence to abort.
Sending 10, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!!!!!!
Success rate is 100 percent (10/10), round-trip min/avg/max = 4/54/140 ms



So far everything looks perfectly functional.


Now lets make some changes:


R2(config)#router bgp 200
R2(config-router)#no neighbor 11.11.11.11 update-source Loopback0
R2(config-router)#do cle ip bgp *


R2(config-router)#do sh ip ro b
Gateway of last resort is not set

      1.0.0.0/24 is subnetted, 1 subnets
B        1.1.1.0 [20/0] via 11.11.11.11, 00:00:47



And sure enough, R2 still have route in it's table for 1.1.1.0/8 network.


Now lets put it back and make same changes on the other side:

R2(config-router)#neighbor 11.11.11.11 update-source Loopback0
............................................................................................

R1(config)#router bgp 100
R1(config-router)#no neighbor 22.22.22.22 update-source Loopback0
R1(config-router)#do cle ip bg *

R1(config-router)#do sh ip ro b
      2.0.0.0/24 is subnetted, 1 subnets
B        2.2.2.0 [20/0] via 22.22.22.22, 00:01:10



Hmmm...still everything is working as I expected.


Now lets talk back about Client Server Part. Actually there I see some difference between books and real world Cisco implementation.


Most of the books says that between two the router with higher Router ID will be chosen as Client and Router with Lower RID will be chosen as Server. It's going to be the client which will initiate BGP session from Random Higher port to Destination port 179. But in my scenario the things were opposite:


R1#sh ip bgp
BGP table version is 5, local router ID is 11.11.11.11

R1#sh ip bg ne | i po
  Transport(tcp) path-mtu-discovery is enabled
Local host: 11.11.11.11, Local port: 22104
Foreign host: 22.22.22.22, Foreign port: 179



R2#sh ip bgp
BGP table version is 3, local router ID is 22.22.22.22

R2#sh ip bg ne | i po
  Transport(tcp) path-mtu-discovery is enabled
Local host: 22.22.22.22, Local port: 179
Foreign host: 11.11.11.11, Foreign port: 22104




So Another Myth Busted...

Regards,
Deepak Arora


 

3 comments:

Bhuvanesh Rajput said...

But your Router sare taking incorrect BGP Router ID. Highest Loopback should be your BGP ROUTER ID. In your scenario...BGP ROUTER ID should be as
R1: 1.1.1.1
R2: 2.2.2.2

Theory is absolutely right as you mentioned in the blog...but behaviour toatl depends upon the ROuter and running IOS as well how they behave at that point of time..

I would advice you to try the same thing to see server/client slection.

Regards
Bhuvanesh Rajput

Anil said...

Hi,

How could this bgp application can be installed on the ubuntu system without purchasing for the router.

Anil said...

How could the BGP Application installed on the ubuntu server system without purchasing the router for this.

Any good sites for installation.

Thanks in advance.