Next-Hop Attribute shows some different behavior in shared media as well as in Non Broadcast Multi Access Networks.

Below article will explain the both the behaviors in details with help of lab scenarios.

When running BGP over a multiaccess network such as Ethernet, a BGP router uses the
appropriate address as the next-hop address (by changing the next-hop attribute) to avoid inserting additional hops into the path. This feature is sometimes called a third-party next hop.

The third-party next-hop address issue also makes sense when you review it from an ISP
perspective. A large ISP at a public peering point has multiple routers peering with different
neighboring routers; it is not possible for one router to peer with every neighboring router at the major public peering points.

Consider the diagram below:

BGP Next-Hop Behavior in Shared Network

In the diagram, R1,R2, and R3 are connected through a L2 Switch in a shared network Please see the naming scheme in the diagram.
We have formed the BGP peering b/w R1, R2, and R3 on their interface IPs (i.e., 123.2, and 123.3 respectively).

Example config from R2:

router bgp 100
bgp log-neighbor-changes
network mask
neighbor remote-as 100
neighbor remote-as 300

Next-Hop for prefix on R1 is

R1#show ip bgp | i
 *>                 0             0 400 i

R1 advertises to R2 in shared network. The next-hop for on R2 will remain same

R2#show ip bgp | i
 *>i                 0    100      0  400 i

As per the Next-Hop Rule, the next-hop for a BGP prefix changes at eBGP peering.

R2 advertises the prefix to R3 with expected next hop of but this is not the case.

R2 will advertise to R3 with next hop instead of as R1, R2, R3 are connected through the shared network and in shared network it will be weird for R3 to go to R2 and then R1 while R1 knows the arp for and can reach R1 directly via L2 switch. This is to avoid an unnecessary extra hop on R3 while reaching

R3#show ip bgp | i
 *>                              0 100 400 i

However, if the common medium between routers is a Non Broadcast Multiaccess (NBMA) medium, complications might occur.

BGP Next-Hop in NBMA
Router R1 Has as the Next-Hop Attribute to Reach, but It Might Be Unreachable,For example, in above figure, Routers R1, R2, and R3 are connected by Frame Relay. Router R2 can reach network via When Router R2 sends a BGP update to Router R1 about, it uses as the next hop, not its own IP address ( A problem arises if Routers R1 and R3 do not know how to communicate directly. In other words, if Routers R1 and R3 do not have a Frame Relay map entry to reach each other, Router R1 does not know how to reach the next-hop address on Router R3.

This behavior can be overridden in Router R2 by configuring it to advertise itself as the next-hop address for routes sent to Router R1, this configuration is described in the later section “Changing the Next-Hop Attribute.”