Configuring 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. The BGP Next Hop Unchanged feature allows BGP to send an update to an eBGP multihop peer with the next hop attribute unchanged.

Restrictions for BGP Next Hop Unchanged

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


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

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 the BGP Next Hop Unchanged feature is configured, BGP will send 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.


The BGP Next Hop Unchanged feature provides flexibility when designing and migrating networks. It can be used only between eBGP peers configured as multihop. It can be used in a variety of scenarios between two autonomous systems. One scenario is when multiple autonomous systems are connected that share the same IGP, 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 RRs.

Another common use of this feature is a VPNv4 inter-AS Option C configuration, as defined in RFC4364, Section 10. In this configuration, VPNv4 routes are passed among autonomous systems between RR of different autonomous systems. The RRs are several hops apart, and have neighbor next-hop unchanged configured. PEs of different autonomous systems establish an LSP between them (via a common IGP or by advertising the next-hops--that lead to the PEs--via labeled routes among the ASBRs--routes from different autonomous systems separated by one hop). PEs are able to reach the next hops of the PEs in another AS via the LSPs, and can therefore install the VPNv4 routes in the VRF RIB.

How to Configure BGP Next Hop Unchanged

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

Configuring the BGP Next Hop Unchanged for an eBGP Peer

SUMMARY STEPS

  1. enable
  2. configure terminal
  3. router bgp as-number
  4. address-family {ipv4 | ipv6 | l2vpn | nsap | rtfilter | vpnv4 | vpnv6 }
  5. neighbor {ip-address | ipv6-address | peer-group-name} remote-as as-number
  6. neighbor {ip-address | ipv6-address | peer-group-name} activate
  7. neighbor {ip-address | ipv6-address | peer-group-name} ebgp-multihop ttl
  8. neighbor {ip-address | ipv6-address | peer-group-name} next-hop-unchanged
  9. end
  10. show ip bgp

DETAILED STEPS

  Command or Action Purpose

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.

Step 3

router bgp as-number

Example:


Device(config)# router bgp 65535

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

Step 4

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 5

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 6

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 7

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 8

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 9

end

Example:


Device(config-router-af)# end 

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

Step 10

show ip bgp

Example:


Device# show ip bgp 

(Optional) Displays entries in the BGP routing table.

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

Configuring BGP Next Hop Unchanged using Route-Maps

Configuring outbound route-map for eBGP neighbor

To define the route-map and apply outbound policy for neighbor, use 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:
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

Configuring next-hop unchanged for both iBGP and eBGP path prefixes while sending to eBGP neighbor

To configure next-hop unchanged for both iBGP and eBGP path prefixes while sending to eBGP neighbor, use 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 eBGP neighbor 15.1.1.2:
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

Example: BGP Next Hop Unchanged for an eBGP Peer

The following example configures a multihop eBGP peer at 10.0.0.100 in a remote AS. When the local router sends updates to that peer, it will send 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, L2VPN, and so on support the next-hop unchanged command. However, for the address family L2VPN BGP VPLS signaling, you must use the next-hop self command for its proper functioning.

Feature Information for BGP Next Hop Unchanged

The following table provides release information about the feature or features described in this module. This table lists only the software release that introduced support for a given feature in a given software release train. Unless noted otherwise, subsequent releases of that software release train also support that feature.

Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to www.cisco.com/go/cfn. An account on Cisco.com is not required.
Table 1. Feature Information for BGP Next Hop Unchanged

Feature Name

Releases

Feature Information

BGP Next Hop Unchanged

Cisco IOS XE Gibraltar 16.11.1

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