BGP Issue: Reachable Next-Hop

When troubleshooting BGP, it’s not enough for the eBGP session to be up and for routes to be learned—they must also be installed in the routing table to be actively used. One common issue occurs when BGP learns routes, but they never appear in the routing table. This typically happens when the next-hop IP is unreachable, causing BGP to mark the routes as valid but not best.


The Issue Explained

  • Symptom:
    The eBGP session is up, and BGP learns routes, but they are missing from the routing table (as seen with show ip route).

  • Root Cause:
    The next-hop IP for the learned routes is unreachable. BGP will not install a route into the routing table if the next-hop is not reachable, even if the route is otherwise valid.

  • Observed Behavior:
    On Router2, BGP might show:
    Router2# show ip bgp
       Network          Next Hop       Metric LocPrf Weight Path
    *  50.50.50.0/24   192.168.158.49    0      100      0    i
    *  80.80.0.0/16    192.168.158.49    0      100      0    i
    
    
    However, these routes do not become active (they are marked with an asterisk, but not with the best-route symbol, ">") because Router2 has no route to the next-hop, 192.168.158.49.

Two Effective Solutions

Solution 1: Add a Static Route

Manually add a static route on Router2 to ensure that the next-hop IP becomes reachable. This involves configuring a route that points to the correct next-hop via an interface that Router2 can use.

Configuration Example:

Router2(config)# ip route 192.168.158.0 255.255.255.0 192.168.74.4

Verification:

  • After adding the static route, check BGP routes:
    Router2# show ip bgp
       Network          Next Hop       Metric LocPrf Weight Path
    *> 50.50.50.0/24   192.168.158.49    0      100      0    i
    *> 80.80.0.0/16    192.168.158.49    0      100      0    i
    
  • Then, check the routing table:
    Router2# show ip route
    B   50.50.50.0/24  [200/0] via 192.168.158.49, 00:01:23
    B   80.80.0.0/16   [200/0] via 192.168.158.49, 00:01:23
    Now, the routes appear in the routing table and are ready for forwarding.

Solution 2: Use the next-hop-self Command

Alternatively, rather than adding a static route, you can configure Router1 to rewrite the next-hop to itself. This approach ensures that when Router2 receives the BGP updates, the next-hop is a reachable IP (Router1’s IP).

Configuration on Router1:

Router1(config)# router bgp 2640
Router1(config-router)# neighbor 192.168.74.14 next-hop-self

Verification:

  • On Router2, after applying this configuration:
    Router2# show ip bgp
       Network          Next Hop       Metric LocPrf Weight Path
    *> 50.50.50.0/24   192.168.74.14    0      100      0    i
    *> 80.80.0.0/16    192.168.74.14    0      100      0    i
    
  • And the routing table reflects the change:
    Router2# show ip route
    B   50.50.50.0/24  [200/0] via 192.168.74.14, 00:01:23
    B   80.80.0.0/16   [200/0] via 192.168.74.14, 00:01:23

The next-hop now being Router1’s IP (which is reachable by Router2) ensures that the routes are installed and marked as the best routes.


Comparison of Both Solutions

Solution How It Works When to Use
Static Route Manually adds reachability to the next-hop IP. When you want precise control over route reachability.
next-hop-self Router1 rewrites the next-hop to itself in BGP updates. Ideal in iBGP scenarios or when automating next-hop resolution.


Ensuring that the next-hop is reachable is critical for BGP route installation. Whether you choose to add a static route on the receiving router or use the next-hop-self command on the advertising router, both solutions effectively resolve the issue by making the next-hop reachable. This allows BGP to install the routes into the routing table and ensures that your network can forward traffic as expected.

Download


>