BGP Next Hop Self Command


In this post, we will talk about an important and mostly used command of BGP. This command is used under the BGP process in the router and the usage is like below:

neighbor {ip-address | peer-group-name} next-hop-self

In the routing, route advertisement is a common term. And for the route advertisement, the next hop is common. A route is advertised via its next hop ip address. This means that, “You can come to me via this door”.

In BGP configuration, route advertisement is also done between external peers. During this advertisement, the non directly connected routers to this external peer, the IBGP peers, need to learn how to go to the advertised route. Because without any information, they can not go to an unknown place. And their routing table do not have this information.

To give this information to the IBGP peers, “next-hop-self” command is used. Let’s see how, with a configuration example.

The topology used for this next-hop-self command is below:

bgp next-hop-self command example

BGP Next-Hop-Self Command

In this topology, Router A1 and Router B1 are external BGP peers. And the Router A2 and Router B2 are their internal BGP peers. Router A2 advertises its network with the next hop (ip address of Router A1’s external interface).Because of the fact that, this ip address is not in the routing table of Router B2, it do not know this route.

BGP - Part 1
BGP - Part 2 (BGP Peers, BGP Sessions, BGP Messages)
BGP - Part 3 (IBGP, IBGP Topologies and EBGP)
BGP - Part 4 (BGP Administrative Distance and BGP Path Attributes)
BGP - Part 5 (Packet Tracer BGP Configuration Example)


This is also like the same for Router B2’s route advertisement. This time Router B2 will send route with the next hop And the Router A2 will not know this route. Because Router A2 do not know anything about the route.

RouterA1(config)# interface gigabitEthernet 0/0
RouterA1(config-if)# ip address
RouterA1(config-if)# no shutdown
RouterA1(config-if)# interface gigabitEthernet 0/1
RouterA1(config-if)# ip address
RouterA1(config-if)# no shutdown
RouterA1(config-if)# exit
RouterA1(config)# router bgp 64600
RouterA1(config-router)# neighbor remote-as 64700
RouterA1(config-router)# neighbor remote-as 64600
RouterA1(config-router)# network mask

Leave a Reply

Your email address will not be published. Required fields are marked *