The next-hop is a routing term referring to the neighboring router that a data packet can traverse next. It is part of a series of routers connected in a network and represents the next possible destination for a data packet.
Each router maintains a routing table with a next-hop address, calculated based on the routing protocol and its associated metric. The metric, which varies by protocol (e.g., hop count for RIP, bandwidth for OSPF, or composite for EIGRP), determines the “cost” of a route. The router selects the next-hop with the lowest metric as the optimal path to the destination. For example, in a static route setup, the administrator manually defines the next hop, while dynamic protocols automatically update it based on real-time network conditions.
To maintain this information, the router selects the lowest metric in its routing table as the next hop or the next optimal router. When a packet passes through a router, the hop count increases by one. For example, if a destination is 10 hops away from the source, the packet must pass through 10 different routers to reach it. For every router, the next router connected with the best metric is placed as the next hop in its routing table.
Network Topology Description
Consider a simple network with four routers: Router0, Router1, Router2, and Router3. The topology is as follows:
- Router0 is connected to Router1 via the network 10.10.10.0/30, with Router0’s interface IP as 10.10.10.1 and Router1’s as 10.10.10.2.
- Router1 is connected to Router2 via the network 172.16.0.0/30, with Router1’s interface IP as 172.16.0.2 and Router2’s as 172.16.0.1.
- Router2 is connected to Router3 via another link (not detailed but assumed for context).
- Local Networks:
- Router0 serves the local network 192.168.10.0/24.
- Router1 serves the local network 192.168.20.0/24.
- Router2 serves the local network 192.168.30.0/24.
Each router only knows about its directly connected networks unless configured with static or dynamic routes.
Router0 Routing Table
C 10.10.10.0/30 is directly connected, GigabitEthernet0/0
Router0 only knows its directly connected network to Router1.
Router1 Routing Table
C 10.0.0.0/30 is directly connected, GigabitEthernet0/0 C 172.16.0.0/30 is directly connected, GigabitEthernet0/1 C 192.168.20.0/24 is directly connected, FastEthernet0/0
Router1 knows its connected networks, but not beyond Router2.
Router2 Routing Table
C 172.16.0.0/30 is directly connected, GigabitEthernet0/0 C 192.168.30.0/24 is directly connected, FastEthernet0/0
Configuration Examples for Next-Hop Types
1. Next-Hop Route
Specify only the next hop IP address:
Router(config)# ip route 192.168.20.0 255.255.255.0 10.10.10.2
Router forwards packets for 192.168.20.0/24 to 10.10.10.2.
2. Directly Connected Static Route
Specify only the exit interface:
Router(config)# ip route 192.168.20.0 255.255.255.0 GigabitEthernet0/
Router sends packets out GigabitEthernet0/0 for 192.168.20.0/24.
3. Fully Specified Static Route
Specify both next-hop IP and exit interface:
Router(config)# ip route 192.168.20.0 255.255.255.0 GigabitEthernet0/0 10.10.10.2
Combines interface and IP for redundancy, useful in multi-access networks.
Verifying Next-Hop Connectivity
Below you can see a ping result from Router0 to Router1 using IP address 10.10.10.2; you can see that the ping is successful because network 10.0.0.0 is available in the routing table as a directly connected router.
Router0> Router0>ping 10.10.10.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.10.10.2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/0 ms Router0>
The CLI output is a ping result from Router0 to IP addresses 172.16.0.2, the IP address of the same Router1, but the result is not successful, and 192.168.20.1, also the IP address of the same Router, but the result is not successful.
This is because Router0 does not have an entry in its routing table for Router1’s above networks. So, Router0 doesn’t know where to send the ping request, resulting in an unsuccessful ping.
Router0> Router0>ping 172.16.0.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.0.1, timeout is 2 seconds: ..... Success rate is 0 percent (0/5) Router0>
Router0> Router0>ping 192.168.20.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.20.1, timeout is 2 seconds: ..... Success rate is 0 percent (0/5) Router0>
We can identify the next-hop router by IP address and exit interface, or maybe we can use both. The following are the three types of routing table entries for the router’s next hop.
Next-hop route – We specify only the IP address of the next-hop router in the routing table.
Directly connected static route – We only specify the router exit interface connected to the next-hop router.
Fully specified static route – We specify the next-hop IP address and exit interface.
FAQs
What is a next-hop in routing?
The next-hop is the next router a data packet should traverse toward its destination, determined by the routing table based on the lowest metric.
How is the next-hop selected?
The router selects the next-hop with the lowest metric (e.g., hop count, bandwidth) from its routing table, updated by routing protocols or static configuration.
Why did my ping fail from Router0 to 172.16.0.1?
Router0 lacks a routing table entry for 172.16.0.0/30. You need to configure a static route or use a dynamic protocol to reach it.
What is the difference between next-hop and exit interface?
A next-hop specifies the IP address of the next router, while an exit interface specifies the local interface to send packets out, often used in point-to-point links.
How can I troubleshoot a missing next-hop?
Use show ip route
Ping the next-hop, check the interface status with show ip interface brief
, and add a static route if needed.
Can the next-hop change dynamically?
Yes, with dynamic routing protocols (e.g., OSPF, EIGRP), the next-hop updates are automatically based on network changes.