Configuring BGP Next Hop Unchanged

Feature history for BGP next hop unchanged

This table provides release and related information for the features explained in this module.

These features are available in all the releases subsequent to the one they were introduced in, unless noted otherwise.

Release

Feature

Feature information

Cisco IOS XE 26.2.1ea

BGP Next Hop Unchanged: BGP Next Hop Unchanged feature support has been introduced.

Cisco C9550 Series Smart Switches

Cisco IOS XE 17.18.1

The BGP Next Hop Unchanged feature allows BGP to send an update to an eBGP multihop peer with the next hop attribute unchanged.

Cisco C9350 Series Smart Switches

Cisco C9610 Series Smart Switches

Use the Cisco Feature Navigator to find information about platform and software image support. To access Cisco Feature Navigator, go to https://cfnng.cisco.com/

Information about BGP next hop unchanged

In an external BGP (eBGP) session, by default, the router changes the next hop attribute of a BGP route to its own address when the router sends out a route. If you configure the BGP Next Hop Unchanged feature, BGP sends routes to an eBGP multihop peer without modifying the next hop attribute. The next hop attribute is unchanged.


Note


There is an exception to the default behavior of the router changing the next hop attribute of a BGP route when the router sends out a route. When the next hop is in the same subnet as the peering address of the eBGP peer, the next hop is not modified. This is referred to as third party next hop.


Use cases for BGP next hop unchanged

The BGP Next Hop Unchanged feature provides flexibility when you design and migrate networks. You can use it only between eBGP peers that are configured as multihop. You can use it in a variety of scenarios between two autonomous systems. One scenario is when multiple autonomous systems that share the same IGP are connected, or at least the routers have another way to reach each other's next hops, which is why the next hop can remain unchanged.

A common use of this feature is to configure Multiprotocol Label Switching (MPLS) inter-AS with multihop MP-eBGP for VPNv4 between route reflectors.

Another common use of this feature is a VPNv4 inter-AS Option C configuration, as defined in RFC 4364, Section 10. In this configuration, VPNv4 routes are passed among autonomous systems between route reflectors of different autonomous systems. The route reflectors are several hops apart, and have neighbor next-hop unchanged configured. Provider edge routers of different autonomous systems establish a label-switched path (LSP) between them, through a common IGP or by advertising the next hops that lead to the provider edge routers through labeled routes among the autonomous system boundary routers. Provider edge routers are able to reach the next hops of the provider edge routers in another autonomous system through the LSPs, and can therefore install the VPNv4 routes in the VRF RIB.

Restrictions for BGP next hop unchanged

You can configure the BGP Next Hop Unchanged feature only between multihop eBGP peers. The following error message appears if you try to configure this feature for a directly connected neighbor:


%BGP: Can propagate the nexthop only to multi-hop EBGP neighbor

How to configure BGP next hop unchanged

The following procedures contain the steps to configure BGP next hop unchanged.

Configure the BGP next hop unchanged for an eBGP peer

To configure the BGP next hop unchanged for an eBGP peer, use the following procedure:

Procedure


Step 1

enable

Example:


Device> enable

Enables privileged EXEC mode.

Enter your password if prompted.

Step 2

configure terminal

Example:


Device# configure terminal

Enters global configuration mode.

  1. router bgp as-number

    Example:

    
    Device(config)# router bgp 65535

    Enters router configuration mode, and creates a BGP routing process.

Step 3

address-family { ipv4 | ipv6 | l2vpn | nsap | rtfilter | vpnv4 | vpnv6 }

Example:


Device(config-router-af)# address-family vpnv4

Enters address family configuration mode to configure BGP peers to accept address family specific configurations.

Step 4

neighbor { ip-address | ipv6-address | peer-group-name } remote-as as-number

Example:


Device(config-router-af)# neighbor 10.0.0.100 remote-as 65600

Adds an entry to the BGP neighbor table.

Step 5

neighbor { ip-address | ipv6-address | peer-group-name } activate

Example:


Device(config-router-af)# neighbor 10.0.0.100 activate

Enables the exchange of information with the peer.

Step 6

neighbor { ip-address | ipv6-address | peer-group-name } ebgp-multihop ttl

Example:


Device(config-router-af)# neighbor 10.0.0.100 ebgp-multihop 255

Configures the local router to accept and initiate connections to external peers that reside on networks that are not directly connected.

Step 7

neighbor { ip-address | ipv6-address | peer-group-name } next-hop-unchanged

Example:


Device(config-router-af)# neighbor 10.0.0.100 next-hop-unchanged

Configures the router to send BGP updates to the specified eBGP peer without modifying the next hop attribute.

Step 8

end

Example:


Device(config-router-af)# end

Exits address family configuration mode, and enters privileged EXEC mode.

Step 9

show ip bgp

Example:


Device# show ip bgp

(Optional) Displays entries in the BGP routing table.

The output indicates if the neighbor next-hop-unchanged command has been configured for the selected address.


Configure BGP next hop unchanged using route maps

To configure BGP next hop unchanged using route maps, use the following steps.

Procedure


Step 1

Configure an outbound route map for the eBGP neighbor.

To define the route map and apply the outbound policy for the neighbor, use the set ip next-hop unchanged command.

In the following configuration, the next hop for prefix 1.1.1.1 is not changed while sending to the eBGP neighbor 15.1.1.2:

Example:


enable
config terminal
router bgp 2
 bgp log-neighbor-changes
 neighbor 15.1.1.2 remote-as 3
 neighbor 15.1.1.2 ebgp-multihop 10
 !
 address-family ipv4
  neighbor 15.1.1.2 activate
  neighbor 15.1.1.2 route-map A out
  exit address-family
!
route-map A permit 10
 match ip address 1
 set ip next-hop unchanged
!
access-list 1 permit 1.1.1.1
end

Step 2

Configure next hop unchanged for both iBGP and eBGP path prefixes while sending to the eBGP neighbor.

To configure next hop unchanged for both iBGP and eBGP path prefixes while sending to the eBGP neighbor, use the next-hop-unchanged allpaths command.

In the following configuration, the next hop is not changed for both iBGP and eBGP path prefixes while sending to the eBGP neighbor 15.1.1.2:

Example:


enable
config terminal
router bgp 2
 bgp log-neighbor-changes
 neighbor 15.1.1.2 remote-as 3
 neighbor 15.1.1.2 ebgp-multihop 10
!
address-family ipv4
 neighbor 15.1.1.2 activate
 neighbor 15.1.1.2 next-hop-unchanged allpaths
 exit address-family
!
end

Configuration example for BGP next hop unchanged for an eBGP peer

The following example configures a multihop eBGP peer at 10.0.0.100 in a remote autonomous system. When the local router sends updates to that peer, it sends them without modifying the next hop attribute.


router bgp 65535
 address-family ipv4
 neighbor 10.0.0.100 remote-as 65600
 neighbor 10.0.0.100 activate
 neighbor 10.0.0.100 ebgp-multihop 255
 neighbor 10.0.0.100 next-hop-unchanged
 end

Note


All address families, such as IPv4, IPv6, VPNv4, VPNv6, and L2VPN, support the next-hop unchanged command. However, for the address family L2VPN BGP VPLS signaling, you must use the next-hop self command for proper functioning.