8.6 BGP Attributes
8.6.2
The Next Hop attribute
The Next Hop attribute is a well-known mandatory attribute (type code 3). In terms of an IGP, such as RIP, the "next hop" to reach a route is the IP address of the router that has announced the route.

The Next Hop concept with BGP is more complex and takes one of the following three forms:

  • For EBGP sessions, the next hop is the IP address of the neighbor that announced the route.
  • For IBGP sessions, where routes originated inside the AS, the next hop is the IP address of the neighbor that announced the route. For routes injected into the AS via EBGP, the next hop learned from EBGP is carried unaltered into IBGP. The next hop is the IP address of the EBGP neighbor from which the route was learned.
  • When the route is advertised on a multiaccess medium (such as Ethernet or Frame Relay) the next hop is usually the IP address of the interface of the router.  This will be the interface connected to the media that originated the route.

The figure illustrates the BGP Next Hop attribute. RTC is running an EBGP session with RTZ router and an IBGP session with the RTA. RTC is learning route 128.213.1.0/24 from the RTZ. In turn, RTC router is injecting the local route 128.212.1.0/24 into BGP.

RTA learns route 128.212.1.0/24 via 2.2.2.2, the IP address of the IBGP peer announcing the route. Thus, according to the definition, 2.2.2.2 is the next hop for RTA to reach 128.212.1.0/24. Similarly, RTC sees 128.213.1.0/24 coming from RTZ via Next Hop 1.1.1.1. When it passes this route update to RTA via IBGP, RTC includes the Next Hop information, unaltered. Thus, RTA receives the BGP update about 128.213.1.0/24 with Next Hop 1.1.1.1. This is an example of the EBGP next hop being carried into IBGP.

As you can see, the Next Hop is not necessarily reachable via a direct connection. RTA's next hop for 128.213.1.0/24 is 1.1.1.1, but reaching it requires a pathway through 3.3.3.3. Thus, the next-hop behavior mandates a recursive IP routing table lookup for a router to know where to send the packet. To reach the Next Hop 1.1.1.1, RTA will consult its IGP routing table to see if and how 1.1.1.1 is reachable. This recursive search continues until the router associates destination 1.1.1.1 with an outgoing interface. The same recursive behavior is performed to reach Next Hop 2.2.2.2. If a hop is not reachable via an IGP, BGP would consider the route as being inaccessible.