What does next-hop-self do, and when do you need it?
Show the answer
Say this first
When an edge router passes an eBGP route to its iBGP peers, it keeps the original next hop: the ISP's address
on the shared link. If the IGP does not carry that link subnet, internal routers mark the route inaccessible
and never install it. neighbor x next-hop-self on the edge router rewrites the next hop to its own
update-source address (its loopback) on routes it sends to that iBGP peer.
Go deeper
The problem
R1 learns 198.51.100.0/24 from ISP1 at 192.0.2.1 and sends it to R3 over iBGP. R3 has no route to
192.0.2.0/30, so the route is not valid (no *) and not best (no >):
R3# show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
i 198.51.100.0 192.0.2.1 0 100 0 64496 iThe fix on the edge router
router bgp 64500
neighbor 10.255.0.3 remote-as 64500
neighbor 10.255.0.3 update-source Loopback0
neighbor 10.255.0.3 next-hop-selfAfter clear ip bgp 10.255.0.3 soft out on R1:
R3# show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*>i 198.51.100.0 10.255.0.1 0 100 0 64496 iThe other fix
Put the external link into the IGP as a passive interface. It works, but it spreads external subnets through your IGP and has to be remembered for every new peering. next-hop-self is the common choice.
They will ask next
Does a route reflector change the next hop of reflected routes?
No, not by default. The edge router that learned the route from eBGP must set next-hop-self itself.
Does next-hop-self matter in MPLS L3VPN?
PEs send VPNv4 routes to each other with their own loopback as next hop already, and that loopback must have an LDP label. Keeping the next hop a /32 loopback is what lets the label-switched path work.
Traps
- Configuring next-hop-self on the router that receives the route. It belongs on the edge router that sends it into iBGP.