Configuring the Next_Hop Attribute
Context
When an Autonomous System Boundary Router (ASBR) forwards the route learned from an EBGP peer to an IBGP peer, the ASBR does not change the next hop of the route by default. When the IBGP peer receives this route, it finds the next hop unreachable, sets the route to inactive, and does not use this route to guide traffic forwarding. To enable the IBGP peer to use this route to guide traffic forwarding, configure the ASBR to set its IP address as the next hop of the route when the ASBR forwards this route to the IBGP peer. After the IBGP peer receives the route from the ASBR, it finds the next hop of the route reachable, sets the route to active, and uses this route to guide traffic forwarding.
When a BGP route changes, BGP needs to iterate the indirect next hop of the route again. If no restriction is imposed on the iterated route, BGP may iterate the next hop to an incorrect forwarding path, causing traffic loss. To prevent traffic loss, configure routing policy-based route iteration.
Procedure
- Run system-view
The system view is displayed.
- Run bgp { as-number-plain | as-number-dot }
The BGP view is displayed.
- Enter the corresponding address family view based on network type to configure BGP devices on networks.
Run ipv4-family unicast
The BGP-IPv4 unicast address family view is displayed.
Run ipv4-family multicast
The BGP-IPv4 multicast address family view is displayed.
Run ipv4-family vpnv4 [ unicast ]
The BGP-VPNv4 address family view is displayed.
Run ipv4-family vpn-instance vpn-instance-name
The BGP-VPN instance IPv4 address family view is displayed.
Run ipv6-family [ unicast ]
The BGP-IPv6 unicast address family view is displayed.
Run ipv6-family vpnv6 [ unicast ]
The BGP-VPNv6 address family view is displayed.
Run ipv6-family vpn-instance vpn-instance-name
The BGP-VPN instance IPv6 address family view is displayed.
- Perform any of the following operations as required:
Run peer { ipv4-address | group-name | ipv6-address } next-hop-local [ reflect-effective ]
A BGP device is configured to set its IP address as the next hop when the device advertises routes to an IBGP peer or an IBGP peer group.
By default:
- A BGP router sets IP address of the local interface connected to the peer as the next-hop address of routes when advertising these routes to an EBGP peer.
- A BGP router does not change the next-hop address of non-labeled routes if the routes are from an EBGP peer and are to be sent to an IBGP peer. The router sets IP address of the local interface connected to the peer as the next-hop address of labeled routes if the routes are from an EBGP peer and are to be sent to an IBGP peer.
- A BGP router does not change the next-hop address of routes if the routes are from an IBGP peer and are to be sent to an IBGP peer.
- A BGP router sets the IP address of the local interface connected to the peer as the next-hop address of the locally originated routes to be advertised to an IBGP peer.
Run nexthop recursive-lookup route-policy route-policy-name
Routing-policy-based next hop iteration is configured.
By default, routing-policy-based next hop iteration is not configured.
Run the following command in the IPv4 unicast address family view: peer { ipv4-address | group-name } next-hop-invariable [ include-static-route ]
The device is prevented from changing the next-hop address of a route imported from an IGP before advertising the route to an IBGP peer.
By default, a device changes the next-hop address of a route imported from an IGP to the address of the interface connecting the device to its peer when advertising the route to an IBGP peer.
Run the following command in the IPv4 unicast address family view: nexthop third-party
The device is prevented from changing the next-hop address of a route when the device advertises the route to a peer in the specified scenarios.
The default configurations are as follows:- Before advertising a route that is learned from a directly connected peer to a directly connected EBGP peer, the device changes the next hop of the route to the IP address of the local interface that is used to establish the BGP peer relationship with the EBGP peer.
- Before advertising a locally imported route to a directly connected IBGP or EBGP peer, the device changes the next hop of the route to the IP address of the local interface that is used to establish the BGP peer relationship with the IBGP or EBGP peer.
Run the following command in the IPv6 unicast address family view: nexthop third-party
The device is prevented from changing the next-hop address of a route when the device advertises the route to a peer in the specified scenarios.
The default configurations are as follows:- Before advertising a route that is learned from a directly connected peer to a directly connected EBGP peer, the device changes the next hop of the route to the IP address of the local interface that is used to establish the BGP peer relationship with the EBGP peer.
- Before advertising a locally imported route to a directly connected IBGP or EBGP peer, the device changes the next hop of the route to the IP address of the local interface that is used to establish the BGP peer relationship with the IBGP or EBGP peer.
The nexthop recursive-lookup route-policy route-policy-name command does not take effect for the routes received from directly connected EBGP peers.
- Run commit
The configuration is committed.