Cisco Tips & Tricks

September 18, 2006

BGP quick tips

Filed under: bgp, IP Routing, Router — ciscotips @ 2:21 am

There are three most important keywords which we should have in mind while setting up BGP neighbor relationship. Even sometimes when we have successful BGP relationship, we are not able to see routes in the routing table. Following are the three important keywords.

1)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.

2)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.

3) next-hop-self:- When ebgp relation replicates , next hop always changes.IBGP  routers only connected with other ibgp routers in same AS will not be able to talk with routers outside the AS, if they are not directly connected with each other. We would require a next-hop-self keyword in the ibgp router which is directly connected with ebgp neighbor so that other router in same AS (IBGP) can talk with ebgp routers. Refer to configuration examples below:-

Lets assume that we have three routers and we have to setup a ebgp relationship in between them.  Router A ( AS :- 34 Serial0 , loopback0 , RouterB ( AS 34, loopback0 , Serial0 , Serial1, RouterC ( AS 400 , loopback0, Serial0

Lets start configuring Router A

router BGP 34 –> As soon as we type 34 BGP process will start in the background
neighbor remote-as 34  –> Bgp will know that this is IBGP looking at  AS

Router B

router BGP 34
neighbor remote-as 34
neighbor remote-as 400  –> neighbor relationship with ebgp peer.
neighbor remote-as 400
neighbor ebgp-multihop 255  –>  255 is number of hops that neighbor is away. we can use any number from 1-255, it can be more specific by using 1 or 2 but my personal fav is 255 as it avoids confusion.
neighbor update-source loopback 0 –> Here is the idea, when its sourcing the packets its sourcing it from serial interface, we need to inform the otherside that source interface is not serial interface, it is looback interface so that it cann match ip ip’s with the right interface and form neighbor relationship.

we would require to do similar configuration on router c

router bgp 400
neighbor remote-as 34
neighbor remote-as 34
neighbor ebgp-multihop 255
neighbor update-source loopback 0

Now after forming the neighbro relationships we’ll use network commands to add neighbors in routing table. Network command in BGP is bit different then Network command in other routing protocols. we ‘ll  need to define mask keywork with network command in order to advertise clasless network where as if it is using a default mask we can ignore the same.


Router C

router bgp 400
neighbor mask
note:- i cannot use network command without mask keyword as it will treat this as  class B network. For any customised subnetting scheme we ‘ll need to specify subnet mask with mask keyword in network command.

Even after configuring above, Router A will not be able to talk with Router C. If we will use show ip bgp command on Router A. we’ll see that it has a valid route for Router C but it will not be able to ping router c. This is because next hop will be which is not directly connected with Router A. . First thing which will come in our mind is that rule of synchronisation has taken in to effect but even after disabling synchronisation between router a and router B, Router C will not be reachable. we would need a special command on Router B so that all IBGP peers of AS 34 can talk with AS 400

To troubleshoot this we can use “debug ip bgp updates” but before using this debug we should use ” clear ip bgp *” command. We’ll see that it will show us that there is no valid path for networks in Router C. Next hop should be Router B but in the updates it will show next hp as router c. to avoid the we will use next-hop self keyword in Router B.

Router B

router bgp 34

neighbor next-hop-self

When Router B is sending an update to Router A it is sending the update without changging its next hop so router A will receive next hop as Router C which is not directly connected. To avoid this we will use next-hop-self command in Router B so that router A should receve valid route.




  1. Please post some tips on MPLS also
    eg. Basics of MPLS, Fundamentals of MPLS

    Comment by Shailender — September 23, 2006 @ 8:32 am

  2. nice one. All in all, can i sum up that “next-hop-self” is used when an IBGP is not directly connected to another AS? Therefore, we need to set the intermediate router that connects the IBGP router to the outside world with “next-hop-self”

    Comment by zibin — November 2, 2006 @ 11:28 am

  3. Or you can redistribute the static routes to your ebgp peers loopback(multi-hop) or add the /30 network (peering directly w/interface) into your IGP. Then all IBGP peers will see valid routes because they have a path to the next-hop without changing the next-hop.

    Comment by jreed — February 14, 2007 @ 7:56 pm

  4. […] BGP quick tips […]

    Pingback by 101 Resource for Self Learning Cisco — May 27, 2007 @ 1:27 pm

  5. Excellent!!!!!!!!!

    Comment by Kiran Khairnar — January 18, 2008 @ 10:40 pm

  6. i think that “neighbor ebgp-multihop 255” from routerB is not necessary as routerB is directly connected to both peer. Other than that, thanks!

    Comment by Chris — February 4, 2008 @ 11:38 pm

  7. True words, some true words man. Totally made my day.

    Comment by Immemygiegats — November 25, 2009 @ 5:42 pm

  8. Hi, just noticed that (as i understand it) perhaps you should change

    Router C

    router bgp 400
    neighbor mask


    Router C

    router bgp 400
    network mask

    Kind Regards

    Comment by Magnus — March 15, 2010 @ 7:08 am

  9. […] BGP quick tips […]

    Pingback by Self learning Cisco? Is it possible? « eMulanetwork — January 18, 2011 @ 10:48 am

  10. hope u will continue in giving best solution and Thanks for clearing my next-hop-self concept

    Comment by dimple jaral — May 26, 2011 @ 10:49 am

  11. gr8 …….

    Comment by rajeev — February 26, 2012 @ 10:27 am

  12. Hi Sir,

    The update-source is required only if you are using loopback interface address as the neighbour BGP address? If we use the interface address, then this “update-source” command is not required right?

    Thank you very much

    Amit Raj

    Comment by Amit Raj — August 1, 2012 @ 1:24 pm

  13. Next-hop-self is modifying next hop detail, according to its IBGP peers need and forwarding it to them to make EBGP router reachable. Its gud.

    Comment by Pranavendra — December 13, 2012 @ 5:53 pm

  14. […] Read More: […]

    Pingback by All Things of World — February 2, 2013 @ 11:20 am

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a free website or blog at

%d bloggers like this: