The peer next-hop-local command configures IBGP to set the next hop as its IP address when advertising routes to the peer or peer group.
The undo peer next-hop-local command restores the default setting.
By default:
peer { group-name | ipv4-address | ipv6-address } next-hop-local
undo peer { group-name | ipv4-address | ipv6-address } next-hop-local
| Parameter | Description | Value |
|---|---|---|
group-name |
Specifies the name of the peer group. |
The name is a string of 1 to 47 characters without any space. It is case-sensitive. |
ipv4-address |
Specifies the IPv4 address of the peer. |
It is in dotted decimal notation. |
ipv6-address |
Specifies the IPv6 address of the peer. |
The address is a 32-digit hexadecimal number, in the format of X:X:X:X:X:X:X:X. |
group-name is invalid in BGP-IPv6 unicast address family view and BGP-VPN instance IPv6 address family view.
ipv4-address is valid only in the BGP view, BGP-IPv4 unicast address family view, BGP-IPv6 unicast address family view, BGP-VPN instance IPv4 address family view, BGP-VPN-Target address family view, BGP-VPNv4 address family view, and BGP-L2VPN address family view.
ipv6-address is valid only in the BGP-IPv6 unicast address family view and BGP-VPN instance IPv6 address family view.
BGP view, BGP-VPN instance IPv4 address family view, BGP-VPN-Target address family view, BGP-VPNv4 address family view, BGP-IPv4 unicast address family view, BGP-IPv6 unicast address family view, and BGP-VPN instance IPv6 address family view.
Usage Scenario
The peer next-hop-local command is usually run on an autonomous system boundary router (ASBR). By default, when an ASBR forwards a route learned from an EBGP peer to its IBGP peers, the ASBR does not change the next hop of the route. The next hop address of a route advertised by an EBGP peer is the address of the EBGP peer. After being forwarded to the IBGP peers, the route cannot become an active route because of the unreachable next hop. The peer next-hop-local command needs to be run to configure the ASBR to change the next hop of the route to its IP address when the ASBR advertises the route to an IBGP peer. Therefore, after being forwarded to the IBGP peer, the route can become an active route because the next hop is reachable.
Prerequisites
The peer as-number command has been used to create a peer or peer group.
Precautions
The peer next-hop-local command is applicable to IBGP peers.
Regarding non-labeled BGP routes on a public network, running the peer next-hop-local command on a route reflector to change the next hop of BGP routes does not take effect.
Regarding labeled BGP routes, running this command on a route reflector to change the next hop of BGP routes takes effect.
Running this command on a local device to change the next hop of routes imported or aggregated by the local device does not take effect.
If a device needs to advertise routes to its IBGP peer or peer group, the peer next-hop-local and peer next-hop-invariable commands are mutually exclusive on the device.
The peer next-hop-local command can be configured in the L2VPN-AD address family view, but the configuration does not take effect.
# When sending routes to the peer 1.1.1.2, BGP set its address as the next hop.
<sysname> system-view
[sysname] bgp 100
[sysname-bgp] peer 1.1.1.2 as-number 100
[sysname-bgp] ipv4-family unicast
[sysname-bgp-af-ipv4] peer 1.1.1.2 next-hop-local
<sysname> system-view
[sysname] bgp 100
[sysname-bgp] peer 1::1 as-number 100
[sysname-bgp] ipv6-family unicast
[sysname-bgp-af-ipv6] peer 1::1 enable
[sysname-bgp-af-ipv6] peer 1::1 next-hop-local