Next-Hop Attribute shows some different behavior in shared media.

When BGP is configured in shared network (example: Ethernet), the BGP peer uses the appropriate next-hop address to avoid additional hops into the path. This feature is sometimes also called Third Party Next Hop.

Consider the diagram below:

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#sh ip bgp | i
 *>                 0             0 400 i
R1 advertises to R2 in shared network. The next-hop for on R2 will remain same

For understanding Next-Hop Attribute and Rules, please check our related Post (NEXT-HOP ATTRIBUTE & RULES)

R2#sh 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#sh ip bgp | i
 *>                              0 100 400 i

Hope you have enjoyed reading this Post. Please share your feedback if you liked this post. You can also write to us on