The peer next-hop-local command configures a BGP device to set its IPv6 address as the next hop of routes when the BGP device advertises the routes to an IBGP peer.
The undo peer next-hop-local command restores the default setting.
By default:
When advertising a route to an EBGP peer, BGP sets the next hop of the route to the address of the interface that connects BGP to the EBGP peer.
When advertising non-labeled routes to IBGP peers through EBGP, BGP does not change the next hop of the routes. When advertising labeled routes, BGP changes the next hop of the routes to the IP address of the interface that connects BGP to the IBGP peers.
BGP does not change the Next_Hops of the routes advertised from IBGP peers to IBGP peers.
Before advertising a locally generated route to an IBGP peer, BGP sets the next hop of the route to the IP address of the interface that connects BGP to the IBGP peer.
Usage Scenario
The peer next-hop-local command is generally configured on an ASBR. When a device forwards a route learned from an EBGP peer to other IBGP peers, the device does not change the next hop of the route by default. However, the next hop of the route sent by an EBGP peer is the IP address of the EBGP peer. After an IBGP peer in the AS to which the local peer belongs receives the route, the route cannot be active because the next hop is unreachable. Therefore, you need to run the peer next-hop-local command on the ASBR for the IBGP peers so that the ASBR changes the next hop of the route advertised to the IBGP peers to its own IP address. After receiving the route, the IBGP peers find that the next hop is reachable because an IGP is configured in the AS, a route is an active route.
Configuration Impact
If the command is run more than once, the latest configuration overrides the previous one.
Precautions
The peer next-hop-local command is applicable only to IBGP peers.
When routes are advertised to an IBGP peer group, the peer next-hop-local and peer next-hop-invariable commands are mutually exclusive<HUAWEI> system-view [~HUAWEI] bgp 100 [*HUAWEI-bgp] peer 2001:db8:1::1 as-number 100 [*HUAWEI-bgp] l2vpn-family evpn [*HUAWEI-bgp-af-evpn] peer 2001:db8:1::1 enable [*HUAWEI-bgp-af-evpn] peer 2001:db8:1::1 next-hop-local