BGP NEXT_HOP Attribute: How eBGP and iBGP Change It

Cover image: BGP NEXT_HOP attribute, eBGP and iBGP rewrite rules, next-hop-self, third-party next hops and IPv6 link-local next hops

Every BGP engineer meets this one early: the route is in show ip bgp, the AS path looks fine, and yet nothing is installed and traffic goes nowhere. Very often the problem is the BGP next hop attribute. NEXT_HOP is the address a router has to forward packets to, and BGP itself only carries it: the IGP has to make it reachable. The rules for who rewrites it are short but full of exceptions. eBGP rewrites it, iBGP keeps it, route reflectors must not touch it, IXP route servers pass someone else's address on purpose, and IPv6 adds a second, link-local address in a different attribute. This part of the series goes through each rule with the RFC text, real bytes from a GoBGP lab, and 7 million real routes from an Internet exchange.

TL;DR
  • What it is: NEXT_HOP is type code 3, well-known mandatory, value length always 4 (IPv4). For IPv6 and every other address family the next hop travels inside MP_REACH_NLRI, 16 or 32 bytes for IPv6.[1][2][3]
  • Default rules: to an eBGP peer a router puts its own session address; to an iBGP peer it leaves the received next hop unchanged; a route reflector SHOULD NOT change it; an IXP route server MUST NOT change it.[1][5][7]
  • Reachability: the next hop is resolved recursively through the routing table. If it is not resolvable, the route MUST stay out of best-path selection. Next-hop tracking makes that reaction event driven (Cisco default trigger delay 5 s).[1][8]
  • Lab: GoBGP 4.11 rewrote, kept and validated next hops as the RFCs say, with three gaps: it accepted a next hop on no shared subnet, it sent a peer its own address as next hop for a locally configured route, and it ignored an IPv6 next hop with a broken length instead of resetting the session.[16]
  • Real Internet: at RIPE RIS rrc14 (Equinix Palo Alto) 15.4% of ISC's IPv4 routes carried another member's address as a third-party next hop, and 70.3% of all IPv6 routes carried a global plus a link-local next hop.[17][18]
Lab topology showing BGP NEXT_HOP kept unchanged towards iBGP peers and rewritten to the local address towards an eBGP peer
Figure 1. One route, three receivers: r1 keeps NEXT_HOP for its iBGP peers and rewrites it for its eBGP peer X. Measured in our GoBGP 4.11 lab.

What the BGP next hop attribute is

RFC 4271 defines NEXT_HOP as a well-known mandatory attribute that holds "the (unicast) IP address of the router that SHOULD be used as the next hop to the destinations listed in the Network Layer Reachability Information field of the UPDATE message".[1] Two words in that sentence carry most of the weight. Unicast means a multicast or broadcast address is invalid. SHOULD be used means the address is advice: the receiving router still has to find out how to reach it, and it may choose a different path if policy says so.

It is the third of the three mandatory attributes, next to ORIGIN and AS_PATH. Mandatory has a twist here. RFC 4760 moved the next hop for every non-IPv4 address family into the MP_REACH_NLRI attribute and says that an UPDATE carrying only MP_REACH_NLRI SHOULD NOT carry the classic NEXT_HOP at all.[3] RFC 7606 therefore notes that RFC 4760 "reclassifies NEXT_HOP as what is effectively discretionary": it is mandatory only when the UPDATE carries IPv4 prefixes in its classic NLRI field.[4]

The attribute does two jobs. First, it is the forwarding address: the router installs the prefix with the next hop resolved through its routing table. Second, it is a best-path filter: RFC 4271 s.9.1.2 says that a route whose NEXT_HOP is not resolvable "MUST be excluded from the Phase 2 decision function".[1] A route with a dead next hop is not a worse route; it is no route at all.

NEXT_HOP on the wire

For IPv4 unicast the attribute is seven bytes: flags 0x40 (well-known, transitive), type 0x03, length 0x04, and the address. RFC 7606 says that any length other than 4 is malformed and the UPDATE must be handled as treat-as-withdraw.[4] Here is the UPDATE that our raw iBGP peer I received from r1 for 203.0.113.0/24 (GoBGP 4.11 lab output, bytes after the 19-byte BGP header):[16]

00 00 00 1b 40 01 01 00 40 02 06 02 01 00 00 fd eb 40 03 04 7f 00 02 53 40 05 04 00 00 00 64 18 cb 00 71
withdrawn len 0 | path attributes 0x1b = 27 bytes
40 01 01 00                  ORIGIN IGP
40 02 06 02 01 0000fdeb      AS_PATH: SEQUENCE of 1, AS 65003
40 03 04 7f 00 02 53         NEXT_HOP 127.0.2.83   <- r3, the eBGP peer, unchanged
40 05 04 00000064            LOCAL_PREF 100 (iBGP only)
18 cb0071                    NLRI 203.0.113.0/24

IPv6 is different. RFC 4760 puts the next hop inside MP_REACH_NLRI (type 14), after the AFI, the SAFI and a one-byte length field, and RFC 2545 says that for IPv6 the field holds the global address of the next hop "potentially followed by the link-local IPv6 address". The length is 16 when only the global address is present and 32 when the link-local address is also included. The link-local address is included only if the sender shares a subnet with the next-hop router and with the peer it is advertising to.[2][3]

BGP NEXT_HOP wire format with real bytes: IPv4 NEXT_HOP attribute type 3, IPv6 MP_REACH_NLRI with a 32-byte global plus link-local next hop, and an IPv4-mapped IPv6 next hop
Figure 2. Real bytes from the lab: (A) the classic 7-byte NEXT_HOP, (B) a 32-byte IPv6 next hop in MP_REACH_NLRI sent by eBGP peer E, (C) the same route as r1 sent it to eBGP peer X.

Two more encodings show up in production. RFC 8950 (November 2020, replacing RFC 5549) lets an IPv4 route carry an IPv6 next hop, negotiated with the Extended Next Hop Encoding capability (code 5); the next-hop field is then 16 or 32 bytes, or 24 or 48 for VPN-IPv4.[6] The reverse, an IPv4 next hop for IPv6 routes, is usually encoded as an IPv4-mapped IPv6 address. That is what GoBGP did in our lab: the session between r1 and X ran over IPv4, so r1 sent the IPv6 route to X with next hop ::ffff:127.0.2.81 (Figure 2, row C).[16]

Who changes the next hop: the RFC 4271 rules

Section 5.1.3 of RFC 4271 is the whole rulebook. It splits the cases by the kind of peer the route is sent to:[1]

  1. To an internal peer (iBGP). If the route was not originated locally, the speaker "SHOULD NOT modify the NEXT_HOP attribute unless it has been explicitly configured to announce its own IP address as the NEXT_HOP". That configuration is next-hop-self. For a locally originated route the speaker uses the address of the interface through which the network is reachable, or its own address if the network is directly connected.
  2. To an external peer one IP hop away. The default is the address the speaker uses for the BGP session to that peer. Before that default the RFC lists two forms of third-party next hop: if the peer shares a subnet with the internal router (or the adjacent external router) that the traffic should really go to, the speaker can advertise that router's address instead of its own. There is also a first-party form using another of its own interfaces on a shared subnet.
  3. To an external peer several hops away (multihop eBGP). The speaker MAY be configured to propagate the received NEXT_HOP unchanged; by default it uses its own session address.

Three short sentences follow, and each of them is the root of a well-known operational rule. A speaker "MUST be able to support the disabling advertisement of third party NEXT_HOP attributes in order to handle imperfectly bridged media". A locally originated route "SHALL NOT be advertised to a peer using an address of that peer as NEXT_HOP". And "A BGP speaker SHALL NOT install a route with itself as the next hop".[1]

Table of BGP NEXT_HOP rules for iBGP, route reflectors, eBGP one hop, eBGP multihop, IXP route servers and IPv6 next hops
Figure 3. Default NEXT_HOP per receiver type and the knob that changes it (RFC 4271, RFC 4456, RFC 7947, RFC 2545).

Route reflection and route servers add two rules on top. RFC 4456 says a route reflector "SHOULD NOT modify the following path attributes: NEXT_HOP, AS_PATH, LOCAL_PREF, and MED", because changing them could cause routing loops.[7] RFC 7947 goes further for IXP route servers: because the route server "does not participate in the actual routing of traffic, the NEXT_HOP attribute MUST be passed unmodified to the route server clients".[5]

Why iBGP keeps the next hop

The iBGP rule surprises people because it creates the classic first problem in every BGP lab. Border router r1 learns 203.0.113.0/24 from its eBGP neighbor 192.0.2.1 and gives it to internal router r2 with next hop 192.0.2.1. If the link 192.0.2.0/30 is not in the IGP, r2 cannot resolve 192.0.2.1 and the route stays unused. There are two fixes, and they are not equal. Advertising the external link into the IGP (passive interface) keeps the real exit visible, so each internal router can see which border router and which link a route uses. next-hop-self on r1 hides that: every route now points at r1's loopback, the IGP has fewer prefixes, and the next hop no longer changes when an external link fails, only when r1 itself disappears. In MPLS VPN networks the PE advertises its own loopback as next hop, because that loopback is where the LSP ends.

Our lab shows the default and the knob side by side. r2 is an iBGP neighbor of r1 (GoBGP 4.11 lab output):[16]

$ gobgp -p 50072 global rib -a ipv4 203.0.113.0/24        # phase A, default
   Network              Next Hop             AS_PATH              Age        Attrs
*> 203.0.113.0/24       127.0.2.83           65003                00:00:03   [{Origin: i} {LocalPref: 100}]

$ gobgp -p 50072 global rib -a ipv4 203.0.113.0/24        # phase B, r1 export policy set-next-hop self
   Network              Next Hop             AS_PATH              Age        Attrs
*> 203.0.113.0/24       127.0.2.81           65003                00:00:03   [{Origin: i} {LocalPref: 100}]

The lab: three phases, five neighbors

We built the topology of Figure 1 on loopback addresses with real GoBGP 4.11 daemons: r1 (AS 65001, 127.0.2.81) is the router under test; r2 (127.0.2.82) is an iBGP neighbor; r3 (AS 65003, 127.0.2.83) is an eBGP neighbor that originates 203.0.113.0/24. Three more neighbors are our own Python BGP speakers that log every byte: I (127.0.2.84) on iBGP, E (AS 65005, 127.0.2.85) as an eBGP sender of test routes, and X (AS 65006, 127.0.2.86) as an eBGP observer. All of them negotiated IPv4 and IPv6 unicast. Phase A used defaults, phase B added export policies (set-next-hop = "self" towards I and r2, set-next-hop = "unchanged" towards X), phase C made r3, E and X route-server clients of r1.[15][16]

All addresses sit in 127.0.0.0/8, so in this lab every neighbor shares one subnet with every other. That is the IXP situation, and it is the condition under which third-party next hops are allowed. GoBGP runs no IGP here, so every next hop counts as reachable (the route with next hop 10.9.9.9 below was installed as best). The lab therefore cannot show unreachable next hops; for that part we use the RFC, vendor documentation and real Internet data.

eBGP rewrites, iBGP keeps

The same UPDATE for 203.0.113.0/24 went from r1 to iBGP peer I and to eBGP peer X. The bytes differ in two places: AS_PATH (r1 adds 65001 only for X) and NEXT_HOP:[16]

to I (iBGP):  ... 40 03 04 7f 00 02 53 ...   NEXT_HOP 127.0.2.83 (r3, unchanged)
to X (eBGP):  ... 40 03 04 7f 00 02 51 ...   NEXT_HOP 127.0.2.81 (r1's session address)

Note what r1 did not do. All five neighbors share the 127/8 subnet, so RFC 4271 would have allowed r1 to send 127.0.2.83 to X as a third-party next hop (the second form in rule 2). GoBGP does not do that by default: it always put its own address towards eBGP peers. That is legal, because the third-party forms are "can", not "MUST", and it is also what most routers do on point-to-point links.

The two policy knobs

In phase B the export policy towards X said set-next-hop = "unchanged". This is the equivalent of Cisco's next-hop-unchanged and FRR's attribute-unchanged next-hop.[9][14][15] X now received every next hop exactly as r1 had learned it (GoBGP 4.11 lab output):

$ gobgp -p 50071 neighbor 127.0.2.86 adj-out -a ipv4      # phase B
   ID  Network              Next Hop             AS_PATH              AttrsFiltered
   1   192.0.2.0/24         127.0.2.85           65001 65005          [{Origin: i}]not filtered
   1   198.18.0.0/24        127.0.2.81           65001                [{Origin: i}]not filtered
   1   198.18.1.0/24        127.0.2.86           65001                [{Origin: i}]not filtered
   1   198.18.2.0/24        127.0.2.99           65001                [{Origin: i}]not filtered
   1   198.18.10.0/24       127.0.2.87           65001 65005          [{Origin: i}]not filtered
   1   198.18.11.0/24       10.9.9.9             65001 65005          [{Origin: i}]not filtered
   1   198.18.16.0/24       127.0.2.86           65001 65005          [{Origin: i}]not filtered
   1   198.51.100.0/24      10.255.0.4           65001                [{Origin: i}]not filtered
   1   203.0.113.0/24       127.0.2.83           65001 65003          [{Origin: i}]not filtered

Two lines in that table should make you nervous. 198.51.100.0/24 came from iBGP peer I with next hop 10.255.0.4, an internal loopback that X cannot reach. And 198.18.16.0/24 arrived with next hop 127.0.2.86, which is X's own address: X must now refuse to install it, because "A BGP speaker SHALL NOT install a route with itself as the next hop".[1] An unconditional next-hop-unchanged towards an external peer hands your internal addressing to that peer. Use it only where it belongs: multihop eBGP between route reflectors in inter-AS VPN option C, or a route server.

Matrix of BGP NEXT_HOP values received by iBGP and eBGP peers with default settings, next-hop-self, next-hop unchanged and route-server mode in a GoBGP lab
Figure 4. The NEXT_HOP each peer received for six routes in three phases. Bytes read from the UPDATEs the raw peers captured.

Locally originated routes

When r1 originates a prefix itself, GoBGP stores it with next hop 0.0.0.0 and sends its own address (127.0.2.81) to both iBGP and eBGP peers, which matches the RFC. It gets more interesting when the operator types a next hop. We added 198.18.1.0/24 with nexthop 127.0.2.86, which is X's address. GoBGP sent it to X unchanged, with next hop 127.0.2.86 (bytes 40 03 04 7f 00 02 56).[16] RFC 4271 says a route originated by a speaker "SHALL NOT be advertised to a peer using an address of that peer as NEXT_HOP".[1] The configuration was ours, and it is a corner case, but the router did not stop it.

What the receiver checks

RFC 4271 s.6.3 separates two kinds of errors. A syntactic error means the field is not a valid IP host address; the original rule was to send a NOTIFICATION with subcode 8, Invalid NEXT_HOP Attribute. A semantic error means the address is well-formed but wrong: it is the receiver's own address, or, on a one-hop eBGP session, it is neither the sender's address nor an address on a subnet the receiver shares. For semantic errors "the error SHOULD be logged, and the route SHOULD be ignored", without a NOTIFICATION.[1] RFC 7606 later replaced the session reset for most UPDATE errors with treat-as-withdraw: a malformed NEXT_HOP (length not 4) or a missing one withdraws the prefixes and keeps the session up.[4]

Peer E sent r1 one UPDATE per test value. The session never went down. GoBGP logged each rejected UPDATE (gobgpd log, phase A):[16]

invalid nexthop address
nexthop length isn't correct
well-known mandatory attributes are not present. type : 3
flags are invalid. attribute type: BGP_ATTR_TYPE_NEXT_HOP, expect: TRANSITIVE, actual: TRANSITIVE|OPTIONAL
invalid nexthop address in MP_REACH_NLRI
Table of GoBGP handling of unusual BGP NEXT_HOP values: third-party, off-subnet, own address, multicast, malformed length and missing NEXT_HOP
Figure 5. Ten NEXT_HOP values sent by eBGP peer E and what GoBGP 4.11 did with them, next to the standards.

Most of it matches the standards. 0.0.0.0, 224.0.0.5 and 255.255.255.255 are not unicast host addresses and were withdrawn with a log line. A 5-byte NEXT_HOP and a NEXT_HOP with the optional bit set raised the Discarded counter. A missing NEXT_HOP was treated as withdraw, as RFC 7606 s.3 d) requires for any missing well-known mandatory attribute. Three results deserve a note:

  • Off-subnet next hop accepted. 10.9.9.9 is on no subnet r1 shares with E, which is the semantic error (b) from s.6.3. RFC 4271 says such a route SHOULD be ignored. GoBGP 4.11 installed it and passed it on. Test how each implementation in your network handles this before you rely on the check.[1]
  • Own address kept in Adj-RIB-In. The route with next hop 127.0.2.81, r1's own address, appeared in adj-in but never in the RIB, and no log line was written. The result is right; the silence makes it hard to troubleshoot.
  • Broken IPv6 next-hop length. A 12-byte next hop in MP_REACH_NLRI was logged as "invalid nexthop address in MP_REACH_NLRI" and treated as withdraw. RFC 7606 s.7.11 asks for a session reset or AFI/SAFI disable, because the receiver cannot reliably find the NLRI behind a wrong length. GoBGP chose the softer path.[4]
$ gobgp -p 50071 neighbor 127.0.2.85 adj-in -a ipv4       # what E sent and r1 kept
   ID  Network              Next Hop             AS_PATH              Age        Attrs
   0   192.0.2.0/24         127.0.2.85           65005                00:00:31   [{Origin: i}]
   0   198.18.10.0/24       127.0.2.87           65005                00:00:29   [{Origin: i}]
   0   198.18.11.0/24       10.9.9.9             65005                00:00:27   [{Origin: i}]
   0   198.18.12.0/24       127.0.2.81           65005                00:00:25   [{Origin: i}]
   0   198.18.16.0/24       127.0.2.86           65005                00:00:17   [{Origin: i}]

Recursive lookup and next-hop tracking

The NEXT_HOP is rarely on a directly connected subnet. On iBGP it is usually a loopback of a border router several hops away. RFC 4271 describes the fix: the router performs "a recursive route lookup operation for the IP address in the NEXT_HOP attribute, using the contents of the Routing Table". The routing-table entry that resolves the next hop gives the outgoing interface and the immediate next hop that is actually used for forwarding.[1]

Diagram of BGP recursive next-hop resolution through the IGP and next-hop address tracking with a 5 second trigger delay
Figure 6. Resolving a BGP next hop through the IGP (illustrative addresses), and how next-hop tracking reacts when that IGP route changes.

The hard part is reacting when the IGP route to the next hop changes. Older Cisco software ran a BGP scanner that polled the RIB every 60 seconds, and Cisco's own documentation warns that in that window "IGP instability or other network failures can cause null routes and routing loops to temporarily form". BGP next-hop address tracking (NHT) replaced polling with events: it is on by default, the RIB tells BGP about changes, and BGP waits a trigger delay (default 5 s, configurable 1-100 s with bgp nexthop trigger delay) before it walks the table. Cisco also applies fixed dampening penalties to next hops that flap.[8] FRR keeps a next-hop cache that you can inspect with show bgp nexthop detail and, by default, does not resolve a next hop through the default route unless ip nht resolve-via-default is configured.[14] That last detail explains many "it works on Cisco but not on FRR" lab puzzles where only a default route exists.

IOS XR has gone a step further for service routes: in the Cisco converged SDN transport designs, a BGP next hop can be validated by the presence of an SR-TE policy instead of a RIB route (nexthop validation color-extcomm sr-policy).[11] The principle stays the same: no valid way to reach the next hop, no best path.

Route reflectors and next-hop-self

A route reflector normally passes NEXT_HOP through untouched (RFC 4456). The surprise is what happens when you configure next-hop-self on it. Cisco IOS XE: "Using the neighbor next-hop-self command on the RR will modify next hop attributes only for non-reflected routes"; to change reflected routes Cisco tells you to use an outbound route map.[9] NX-OS offers next-hop-self all to include reflected routes.[10] IOS XR needs ibgp policy out enforce-modifications; Cisco's Unified MPLS guide shows that without it neither next-hop-self nor a route policy with set next-hop self changes reflected labeled-unicast routes on the ABRs.[11] FRR uses next-hop-self force for the same thing.[14]

Why would you want it? Seamless (unified) MPLS is the textbook case: the ABRs are route reflectors and must put themselves into the path, so that the PE loopbacks of one IGP area never need to be known in another. Every time you do this, the router that sets itself as next hop is now in the forwarding path for those routes and must allocate labels for them.[11]

Third-party next hops at Internet exchanges

An IXP is the shared subnet the RFC had in mind. With a route server, each member keeps one BGP session to the route server instead of one to every other member, but traffic still goes straight from member to member. That only works if the route server leaves the next hop alone, which is why RFC 7947 makes it a MUST.[5] Juniper describes the same behaviour for its route server and notes that for multihop route-server sessions the no-nexthop-change behaviour is implied by route-server-client.[13] In phase C of our lab, X received r3's route exactly as r3 had sent it (GoBGP 4.11 lab output):[16]

$ gobgp -p 50071 neighbor 127.0.2.86 adj-out -a ipv4      # phase C, route-server clients
   ID  Network              Next Hop             AS_PATH              AttrsFiltered
   1   192.0.2.0/24         127.0.2.85           65005                [{Origin: i}]not filtered
   1   198.18.10.0/24       127.0.2.87           65005                [{Origin: i}]not filtered
   1   198.18.11.0/24       10.9.9.9             65005                [{Origin: i}]not filtered
   1   198.18.16.0/24       127.0.2.86           65005                [{Origin: i}]not filtered
   1   203.0.113.0/24       127.0.2.83           65003                [{Origin: i}]not filtered

Next hop 127.0.2.83 and an AS_PATH without 65001: r1 is invisible, as a route server should be. The IPv6 route from E even kept both next hops, global and link-local (Figure 4, last column). Note also what X did not get: 198.51.100.0/24 from iBGP peer I. In GoBGP route-server mode the clients live in their own RIBs.

What a real exchange looks like

RIPE RIS collector rrc14 sits on the Equinix Internet Exchange in Palo Alto, whose peering LAN is 198.32.176.0/24 and 2001:504:d::/64.[17][18] We parsed the routing-table dump of 30 November 2026, 00:00 UTC, with our own MRT parser and compared each route's next hop with the address of the peer that sent it. Of 5,587,145 IPv4 entries, 170,467 (3.1%) had a next hop that was not the sender, and almost all of them came from one session:[17]

  • AS1280 (ISC), IPv4: 170,081 of 1,102,259 routes (15.4%) carried 32 other addresses as next hop. PeeringDB maps them to other members on the same LAN: 17.0.0.0/8, for example, came from ISC with next hop 198.32.176.237, the port of Apple (AS714), and 104.64.0.0/10 with next hop 198.32.176.64, the port of AS4637.[18] This is the third-party next hop of RFC 4271 rule 2 in production: the collector would send that traffic straight to Apple's router.
  • AS6762 (Sparkle): 386 IPv4 and 189 IPv6 routes with third-party next hops, a tiny share of a full table. 1.164.0.0/16, for example, pointed at 198.32.176.195, the port of HiNet (AS9680).[18]
  • AS199524 (G-Core), IPv6: 133,971 of 133,974 routes had the next hop 2400:8800:f100::348 or similar, which is not on the exchange LAN at all. A collector does not forward traffic, so it keeps such routes; a router on the LAN would reject or fail to resolve them. We cannot see from the dump why G-Core sends it.
Bar chart of third-party BGP next hops per peer at RIPE RIS rrc14, Equinix Palo Alto: ISC 15 percent IPv4, G-Core nearly all IPv6 routes; 70 percent of IPv6 next hops include a link-local address
Figure 7. Share of third-party next hops per session at RIPE RIS rrc14 (Equinix Palo Alto), 30 Nov 2026 00:00 UTC, and the IPv6 next-hop length split.

The same dump answers the IPv6 question. 981,779 of 1,396,903 IPv6 entries (70.3%) carried a 32-byte next hop, and in every one of them the second address was link-local, exactly as RFC 2545 describes for a shared LAN. Sessions differ: Hurricane Electric (AS6939) sent 32 bytes on all 253,330 routes, NTT (AS2914) sent 16 bytes on all 250,260. No IPv4 route in the dump used an IPv6 next hop (RFC 8950).[2][6][17]

Compare that with a multihop collector. RouteViews (route-views.routeviews.org) peers with networks across the world, not on one LAN. On 1 December 2026, 00:24 UTC, all 16 paths for Apple's 17.0.0.0/8 and all 10 IPv6 paths for Google's 2001:4860::/32 had the peer's own session address as next hop, and no IPv6 path showed a link-local address:[19]

route-views> show ip bgp 17.0.0.0/8
BGP routing table entry for 17.0.0.0/8, version 1487617737
Paths: (16 available, best #16, table default)
  ...
  3356 714
    4.68.4.46 from 4.68.4.46 (4.69.184.201)
      Origin IGP, metric 0, localpref 100, valid, external
  ...
  2497 714
    202.232.0.2 from 202.232.0.2 (58.138.96.254)
      Origin IGP, localpref 100, valid, external, best

The line under each AS path is the whole story: next hop "from" peer address (router ID). When the first two differ, you are looking at a third-party next hop, a reflected route or a route-server route.

IPv6 next hops: global, link-local, or both

Back in the lab, peer E sent three IPv6 routes over its IPv4 session: one with a 32-byte next hop (2001:db8:85::1 + fe80::85), one with only the global address, and one with only fe80::85 in a 16-byte field. GoBGP 4.11 stored them like this (lab output):[16]

$ gobgp -p 50071 global rib -a ipv6
   Network              Next Hop             AS_PATH              Age        Attrs
*> 2001:db8:5500::/40   2001:db8:85::1       65005                00:00:05   [{Origin: i}]
*> 2001:db8:5501::/48   2001:db8:85::1       65005                00:00:04   [{Origin: i}]
*> 2001:db8:5502::/48   fe80::85             65005                00:00:03   [{Origin: i}]

What r1 sent on depended on the peer:

  • To iBGP peer I (default): the 32-byte next hop became 16 bytes, global only. RFC 2545 allows exactly that ("a BGP speaker that advertises a route to an internal peer may modify the Network Address of Next Hop field by removing the link-local IPv6 address").[2] The route with a link-local-only next hop got r1's own address instead, ::ffff:127.0.2.81, because a link-local address means nothing to a router on another link.
  • To eBGP peer X (default): r1's own address, again as an IPv4-mapped IPv6 address, because the session ran over IPv4.
  • To X with next-hop unchanged: the global address alone, and for the third route the bare fe80::85, which X cannot use unless it sits on E's link. A route server (phase C) passed both addresses through.

On the receiving side the choice of which address to install is local. FRR stores both and by default installs the link-local one; nexthop prefer-global under the IPv6 address family changes that.[14] Link-local next hops are the reason unnumbered BGP (sessions on fe80:: addresses, RFC 8950 for IPv4 routes) works in data-centre fabrics without any global address on the links.[6]

Configuration examples

These are configuration examples written from vendor documentation, not output from our lab. The GoBGP block is the policy we actually ran.[9][11][12][14][15]

! Cisco IOS XE: border router, next-hop-self towards iBGP
router bgp 65001
 neighbor 10.255.0.2 remote-as 65001
 neighbor 10.255.0.2 update-source Loopback0
 address-family ipv4 unicast
  neighbor 10.255.0.2 activate
  neighbor 10.255.0.2 next-hop-self
! check: show ip bgp 203.0.113.0  (look for "inaccessible" next hops)
!        show ip bgp attr nexthop

! Cisco IOS XR: ABR that must also change reflected routes
router bgp 65001
 ibgp policy out enforce-modifications
 neighbor 10.255.0.3
  remote-as 65001
  update-source Loopback0
  address-family ipv4 labeled-unicast
   route-reflector-client
   next-hop-self

# Junos: export policy on the iBGP group
set policy-options policy-statement NHS term 1 then next-hop self
set protocols bgp group IBGP export NHS

! FRR
router bgp 65001
 neighbor 10.255.0.2 remote-as 65001
 address-family ipv4 unicast
  neighbor 10.255.0.2 next-hop-self force
 address-family ipv6 unicast
  nexthop prefer-global

# GoBGP 4.11 (what our lab ran in phase B)
[[policy-definitions]]
  name = "nh-self"
  [[policy-definitions.statements]]
    name = "s1"
    [policy-definitions.statements.actions]
      route-disposition = "accept-route"
    [policy-definitions.statements.actions.bgp-actions]
      set-next-hop = "self"

On Junos remember the limit in the documentation: when the advertising protocol is BGP, a policy can set the next hop "only when any third-party next hop can be advertised; that is, when you are using IBGP or EBGP confederations". self uses the local address of the BGP session.[12]

Comparison of BGP next-hop-self, next-hop-unchanged, route-server-client and next-hop tracking commands on Cisco IOS XE, IOS XR, Junos, FRR and GoBGP
Figure 8. NEXT_HOP knobs across Cisco IOS XE, IOS XR, Junos, FRR and GoBGP. A dash means our sources did not document it.

Common mistakes and troubleshooting

  1. Route in BGP table, not in the RIB. Check the next hop first. Cisco marks it inaccessible; on FRR look at show bgp nexthop. Then check whether the IGP carries the address, and whether only a default route covers it (FRR ignores the default route for next-hop resolution unless told otherwise).[8][14]
  2. next-hop-self on the route reflector "does nothing". It does not apply to reflected routes on Cisco by default. Use next-hop-self all (NX-OS), an outbound route map (IOS XE), or enforce-modifications (IOS XR).[9][10][11]
  3. next-hop-unchanged on a normal eBGP session. The peer receives your internal addresses (in our lab, 10.255.0.4) and possibly its own address as next hop. It will either drop the routes or blackhole traffic.
  4. Third-party next hop over an imperfect LAN. RFC 4271 requires a way to disable third-party next hops for "imperfectly bridged media": if two members on the exchange LAN cannot reach each other at layer 2, a route-server route with the other member's next hop is a blackhole even though BGP looks perfect.[1]
  5. IPv6 routes with link-local only. A route whose only next hop is fe80:: is usable only on the link it was learned on. If it is passed to another link unchanged, it cannot be resolved there.[2]
  6. Recursive loop. If the BGP next hop is reachable only through a BGP route that itself uses that next hop, the route cannot resolve. Keep next hops (loopbacks, link subnets) in the IGP, not in BGP.
  7. Slow failover. With next-hop-self on a border router the next hop does not change when an external link fails, so internal routers wait for BGP withdrawals instead of reacting to the IGP. Tune next-hop tracking or keep external links in the IGP where fast failover matters.[8]

FAQ

What is the BGP NEXT_HOP attribute?

NEXT_HOP (type code 3) is a well-known mandatory attribute that carries the IP address a router should forward to in order to reach the prefixes in the UPDATE. It is 4 bytes for IPv4 unicast. Other address families, including IPv6, carry their next hop inside MP_REACH_NLRI instead.

Does iBGP change the next hop?

No. By default a router that passes an eBGP-learned route to an iBGP peer leaves NEXT_HOP unchanged (RFC 4271 s.5.1.3), so every internal router must be able to reach the external next hop through the IGP. next-hop-self on the border router replaces it with the router's own address.

Why is my BGP route not installed even though it is in the BGP table?

The most common reason is an unreachable next hop. A router must exclude a route whose NEXT_HOP it cannot resolve in the routing table from the best-path decision (RFC 4271 s.9.1.2); Cisco shows it as inaccessible. Advertise the external link into the IGP or use next-hop-self.

What is a third-party next hop?

A NEXT_HOP that points to a router other than the BGP speaker that sent the UPDATE, allowed when the receiver shares a subnet with that address. IXP route servers rely on it: they pass each member's own address as the next hop, so traffic flows member to member and never through the route server (RFC 7947).

Why do IPv6 BGP routes have two next hops?

RFC 2545 lets the MP_REACH_NLRI next-hop field carry 32 bytes: a global IPv6 address followed by a link-local one, when sender and receiver share the link. On RIPE RIS rrc14 70% of IPv6 routes carried both. FRR installs the link-local address by default unless nexthop prefer-global is set.

Does a route reflector change the next hop?

It should not. RFC 4456 says a reflector SHOULD NOT modify NEXT_HOP when reflecting. Plain next-hop-self on Cisco IOS XE and IOS XR does not touch reflected routes; you need next-hop-self all, an outbound route map, or ibgp policy out enforce-modifications on IOS XR.

Next in the series: part 9 moves from the mandatory attributes to the first discretionary one, LOCAL_PREF, with primary/backup and transit-tier designs.

References

[1] Y. Rekhter, T. Li, S. Hares, RFC 4271: A Border Gateway Protocol 4 (BGP-4), January 2006: s.4.3 (c), s.5.1.3, s.6.3, s.9.1.2.
[2] P. Marques, F. Dupont, RFC 2545: Use of BGP-4 Multiprotocol Extensions for IPv6 Inter-Domain Routing, March 1999: s.3.
[3] T. Bates, R. Chandra, D. Katz, Y. Rekhter, RFC 4760: Multiprotocol Extensions for BGP-4, January 2007: s.3, s.4.
[4] E. Chen, J. Scudder, P. Mohapatra, K. Patel, RFC 7606: Revised Error Handling for BGP UPDATE Messages, August 2015: s.3, s.7.3, s.7.11.
[5] E. Jasinska, N. Hilliard, R. Raszuk, N. Bakker, RFC 7947: Internet Exchange BGP Route Server, September 2016: s.2.2.1.
[6] S. Litkowski, S. Agrawal, K. Ananthamurthy, K. Patel, RFC 8950: Advertising IPv4 Network Layer Reachability Information (NLRI) with an IPv6 Next Hop, November 2020.
[7] T. Bates, E. Chen, R. Chandra, RFC 4456: BGP Route Reflection, April 2006: s.10.
[8] Cisco, IP Routing Configuration Guide, Cisco IOS XE 17.x: BGP Support for Next-Hop Address Tracking.
[9] Cisco, IOS XE 17.x: Configuring Internal BGP Features (route reflector next hop, route map); IOS XE 17.18 Configuring BGP (next-hop-self, BGP Route Map Next Hop Self, next-hop unchanged).
[10] Cisco, Nexus 9000 NX-OS 10.4(x): Configuring Advanced BGP (next-hop-self all).
[11] Cisco, Configure Unified MPLS in Cisco IOS XR, document 119191; Cisco xrdocs, Converged SDN Transport Implementation Guide.
[12] Juniper Networks, Actions in Routing Policy Terms (next-hop self / peer-address).
[13] Juniper Networks, BGP Route Server Overview.
[14] FRRouting, BGP documentation (next-hop-self force, attribute-unchanged, route-server-client, nexthop prefer-global, show bgp nexthop, disable-connected-check, ip nht resolve-via-default), read 1 December 2026.
[15] GoBGP, policy.md (set-next-hop self / unchanged, route-server-client).
[16] Network freak lab: GoBGP 4.11.0 routers r1-r3 (127.0.2.81-83) and raw Python BGP speakers I, E and X (127.0.2.84-86), phases A-C, 1 December 2026, 01:18-01:24 CET. Configs, logs and captured bytes kept with the article sources.
[17] RIPE NCC, RIS raw data, rrc14: bview.20261130.0000.gz (30 November 2026 00:00 UTC), parsed with our own MRT TABLE_DUMP_V2 parser.
[18] PeeringDB API (IXP prefix and member addresses of Equinix Internet Exchange Palo Alto) and RIPEstat as-overview for AS names, queried 1 December 2026.
[19] University of Oregon RouteViews, route-views.routeviews.org (telnet, user rviews): show ip bgp 17.0.0.0/8 and show bgp ipv6 unicast 2001:4860::/32, 1 December 2026, 00:24 UTC.
Figures 1-8: Network freak, drawn from the sources above, our lab, RIPE RIS and RouteViews.

Try it: BGP Route Lookup: origin AS, AS paths and RPKI check - free, runs in your browser.

Comments

Popular posts from this blog

BGP Neighbor States

Reason legend in show ip ospf statistics

Cisco SPAN Port Mirroring for Troubleshooting