BGP which address is used as the next hop
When a route is advertised by a BGP router, it advertises a next hop IP along with it. Which IP address is actually advertised as the next hop IP depends upon a few factors.
- If an iBGP router originates the advertisement, say using the
network
command or redistribution into BGP, then the next hop IP it will advertise with the route is its own. - If an iBGP router advertises a route that it learned from another iBGP router, or from an eBGP router, it will use the originator's IP address as the next hop IP address.
- When an eBGP router advertises a network to its eBGP peer, it advertises its own IP address as the next hop address, even if it didn't originate the route.
The next hop IP address used by a BGP router is always the IP address used in the BGP peering. By default, it is the IP address of the interface via which the peering takes place. This can be changed using the following commands.
What address will be used for the BGP peering can be modified from the default using the update-source
keyword in the neighbor command, as in the following example:
R1(config-router)#neighbor 2.2.2.2 update-source Loopback0
In addition, the next hop IP address that is advertised can be modified using the next-hop self
keyword as follows:
R1(config-router)#neighbor 192.168.12.1 next-hop-self
For more information, take a look at the note titled BGP - next-hop-self vs update source.
Links:
https://networklessons.com/bgp/bgp-next-hop-self#Next_Hop_Self
https://networklessons.com/bgp/troubleshooting-bgp-neighbor-adjacency#IBGP_Update_Source
https://forum.networklessons.com/t/troubleshooting-bgp-route-advertisement/1193/40?u=lagapides