VMware ESXi and vSphere Cluster Management

Static Routes: Configuration and Verification on Cisco Routers

Learn how IPv4 static routes work, configure Cisco IOS next-hop and exit-interface routes, and verify connectivity with routing-table commands, ping, and traceroute.

A static route is a routing-table entry that an administrator enters manually. It tells a router how to reach a particular destination network or host.

Routers automatically learn about networks attached to their operational interfaces. These are directly connected routes. A router does not automatically know every network beyond its neighboring routers, however. For those remote networks, it needs additional routing information.

This lesson explains how to configure and verify IPv4 static routes on Cisco IOS routers.

Purpose of Static Routing

A router forwards a packet by comparing the packet's destination IPv4 address with entries in its routing table. The routing table contains forwarding information that maps destination prefixes to next hops or outgoing interfaces.

  • A directly connected route is added automatically when an interface has an IPv4 address, a subnet mask, and an operational link.
  • A remote network is not attached directly to the router, so the router needs a route through another router.
  • A static route manually identifies where traffic for a destination network should be sent.

Static routing is different from dynamic routing. With static routing, an administrator creates and maintains each route. With a dynamic routing protocol, routers exchange reachability information and can calculate routes automatically. Static routes are simple and predictable, but administration becomes harder as the network grows.

Routing-Table Fundamentals

Destination networks and masks

A route matches a destination network, which is a network prefix rather than normally a single host address. The prefix is defined by a subnet mask. For example, 192.168.0.0 255.255.255.0 represents the network 192.168.0.0/24.

The mask identifies which bits belong to the network portion of an IPv4 address. When configuring a network route, use the correct network address and matching mask. Do not substitute an individual host address when the intention is to reach an entire subnet.

Next hop and exit interface

The next hop is the IP address of the neighboring router that should receive the packet for onward forwarding. If R1 sends traffic through R2, R2's address on the shared transit network can be used as R1's next hop.

The configured next-hop address must be reachable through a network directly connected to the local router. A router cannot normally forward to an arbitrary address that it has no path to.

An exit interface is the local router interface used to transmit the packet. A static route can identify either the next-hop IP address or the local outgoing interface.

What happens when a route is missing?

If no routing-table entry matches a packet's destination, the router has no forwarding path. Unless a matching default route exists, it drops the packet. This is why a host can be physically connected to a network while communication with a remote network still fails.

Example Two-Router Topology

In this example, R1 has two directly connected networks. R2 shares a transit network with R1 and connects to a third LAN. Initially, R1 does not know how to reach the LAN behind R2.

DeviceInterfaceIPv4 addressConnected networkRole
R1LAN-facing interface10.0.0.1/2410.0.0.0/24Source-side LAN gateway
R1FastEthernet0/1172.16.0.1/24172.16.0.0/24Transit link toward R2
R2Transit-facing interface172.16.0.2/24172.16.0.0/24Next hop for R1
R2LAN-facing interface192.168.0.1/24192.168.0.0/24Destination LAN gateway
Destination hostLAN interface192.168.0.10/24192.168.0.0/24Example remote host

R1 automatically knows about 10.0.0.0/24 and 172.16.0.0/24. It initially has no route for 192.168.0.0/24.

RouterKnown connected networksMissing remote network before configurationStatic route after configuration
R110.0.0.0/24 and 172.16.0.0/24192.168.0.0/24192.168.0.0/24 via 172.16.0.2

Cisco IOS Static-Route Syntax

Entering global configuration mode

Static routes are router-wide settings, so enter them from global configuration mode. The prompt commonly changes from Router# to Router(config)#.

enable
configure terminal

Next-hop form

The next-hop form uses this syntax:

ip route destination-network subnet-mask next-hop-ip-address

Each argument has a specific meaning:

  • destination-network: the network prefix the route should match.
  • subnet-mask: the mask associated with that destination network.
  • next-hop-ip-address: the reachable neighboring router that will receive the packet.

On R1, configure a route to R2's LAN through R2's transit address:

R1# configure terminal
R1(config)# ip route 192.168.0.0 255.255.255.0 172.16.0.2

This command means: for traffic destined for the 192.168.0.0/24 network, forward the packet toward the neighboring router at 172.16.0.2.

Exit-interface form

The exit-interface form identifies the local interface through which the router should transmit:

ip route destination-network subnet-mask exit-interface

Using R1's transit-facing interface, the equivalent example is:

R1(config)# ip route 192.168.0.0 255.255.255.0 FastEthernet0/1

The two forms identify forwarding differently. The next-hop form names the neighboring router's IP address. The exit-interface form names R1's own local interface. Do not use an interface name that exists on R2; the interface must be local to R1.

Route typeSyntaxWhen to use itExample
Route using next-hop IP addressip route NETWORK MASK NEXT_HOPWhen the adjacent router's reachable IP address is knownip route 192.168.0.0 255.255.255.0 172.16.0.2
Route using exit interfaceip route NETWORK MASK INTERFACEWhen the local outgoing interface is the preferred route descriptionip route 192.168.0.0 255.255.255.0 FastEthernet0/1
Route removalno ip route NETWORK MASK NEXT_HOPWhen deleting a previously configured routeno ip route 192.168.0.0 255.255.255.0 172.16.0.2

Removing an incorrect route

Prefix the original command with no to remove a static route. The destination, mask, and route identifier must match the configured entry.

R1(config)# no ip route 192.168.0.0 255.255.255.0 172.16.0.99
R1(config)# ip route 192.168.0.0 255.255.255.0 172.16.0.2

Configuration Workflow

  1. Inspect interface addressing and status before changing the routing table.
  2. Inspect the existing routing table and identify the missing remote destination prefix.
  3. Identify the adjacent router's IP address on the shared network if using the next-hop form.
  4. Enter global configuration mode and add the route.
  5. Verify that the route is installed in the routing table.
  6. Use ping and, when appropriate, traceroute to test the forwarding path.
  7. Confirm that the destination side has a return path to the source network.
R1# show ip interface brief
R1# show ip route
R1# configure terminal
R1(config)# ip route 192.168.0.0 255.255.255.0 172.16.0.2
R1(config)# end
R1# show ip route 192.168.0.0
R1# ping 192.168.0.10
R1# traceroute 192.168.0.10

Before-and-After Forwarding Example

Before the route is added, R1 receives a packet destined for 192.168.0.10. R1 checks its routing table, finds no matching route for 192.168.0.0/24, and drops the packet unless another entry, such as a default route, provides a path.

After the route is added, R1 matches the destination to 192.168.0.0/24, sends the packet to R2 through the transit network, and R2 forwards it onto its directly connected destination LAN.

The return path is equally important. R2 or the destination host must know how to reach the source network, such as 10.0.0.0/24. A route in only one direction is not enough for a successful two-way ping.

Verification and Interpretation

Inspect the complete routing table

R1# show ip route

Look for connected entries and the new static entry. Cisco IOS marks a normal static route with the code S. Connected routes commonly appear with C, and local interface addresses may appear with L.

S    192.168.0.0/24 [1/0] via 172.16.0.2

The S indicates a static route. The bracketed values include administrative distance and metric. A normal static route uses administrative distance 1 unless another value is configured.

Inspect one destination prefix

R1# show ip route 192.168.0.0

This focuses on the route selected for the specified destination prefix and helps confirm the next hop or outgoing interface.

Confirm the configuration

R1# show running-config | include ^ip route

The running configuration should display the exact ip route statement. This is useful when checking the network address, subnet mask, next hop, or interface name.

Test the data plane

R1# ping 192.168.0.10
R1# traceroute 192.168.0.10

Ping tests whether packets can reach the destination and replies can return. Traceroute sends probes that reveal intermediate forwarding hops, making it useful for locating where a path stops.

CommandPurposeExpected evidence
show ip routeInspect the complete routing tableConnected entries and an S entry for the static route
show ip route 192.168.0.0Inspect a specific destination prefixThe route points through 172.16.0.2 or the intended exit interface
show running-configConfirm configured commandsThe expected ip route statement appears
ping 192.168.0.10Test end-to-end reachabilityReplies are received after both forward and return paths work
traceroute 192.168.0.10Observe the forwarding pathThe path includes the expected neighboring router

Static-Routing Characteristics and Limitations

  • Small or stable networks: A few manually maintained routes may be easier than deploying a routing protocol.
  • Stub networks: A network with one primary path can often use a small number of static routes.
  • Controlled paths: Static routes provide predictable forwarding when an administrator wants to specify the path.
  • Manual maintenance: Every required route must be configured on every relevant router.
  • No automatic adaptation: A static route does not automatically react when a topology link fails or an address changes.
  • Limited scalability: As the number of networks and alternate paths increases, dynamic routing generally reduces administrative effort.

A default route matches destinations that are not covered by more-specific entries. An optional example using a next hop is:

ip route 0.0.0.0 0.0.0.0 NEXT_HOP_IP_ADDRESS

A default route is not a replacement for understanding specific static routes: it is a catch-all path and should point toward a router that can continue forwarding the traffic.

An optional administrative distance can also be supplied to influence route preference. Administrative distance is a route-preference value; normal static routes use a low preference value compared with most dynamic sources. Floating static routes use a higher distance so they can serve as backups, but that is an extension of the basic configuration.

Common Configuration Considerations

  • Use the network address, such as 192.168.0.0, rather than a host address such as 192.168.0.10 when configuring a network route.
  • Use a subnet mask that matches the intended prefix, such as 255.255.255.0 for /24.
  • Confirm that the next-hop address belongs to a reachable directly connected subnet.
  • Verify that local interfaces have correct addresses and are operational.
  • Use the local router's exit interface, not an interface on the next-hop router.
  • Confirm that the remote router or destination host has a return route to the source network.

Troubleshooting Static Routes

The destination network is absent

If a ping fails and 192.168.0.0/24 is absent from R1's routing table, first confirm the destination network and mask. Then add a route through the adjacent router or the correct local exit interface.

R1# show ip route
R1(config)# ip route 192.168.0.0 255.255.255.0 172.16.0.2

The next hop cannot be reached

A configured next hop may be wrong, may belong to another subnet, or may be connected through a down interface.

R1# show ip interface brief
R1# ping 172.16.0.2

Verify both routers' transit addresses and masks, confirm that they share 172.16.0.0/24, and restore or enable the transit interface if necessary.

The route exists but the ping still fails

Inspect R2's routing table and the destination host's address, mask, and default gateway. The remote side must have a route back to the source network. Test one hop at a time to distinguish a forwarding problem from a host configuration problem.

The route does not match the intended traffic

Calculate the intended network prefix and compare it with the configured prefix and mask. A host address, incorrect network address, or wrong mask can cause the route to match different traffic than intended. Remove the incorrect entry and configure the correct one.

The exit interface is wrong or down

Use show ip interface brief to identify the local interface connected toward R2 and check its status. Correct the route if it names the wrong interface.

Exam-Relevant Notes

Summary

  • Static routes are manually configured entries for destination networks or hosts.
  • Routers know directly connected networks automatically but need routes for remote networks.
  • The Cisco IOS next-hop command is ip route DESTINATION_NETWORK SUBNET_MASK NEXT_HOP_IP_ADDRESS.
  • The alternate form uses the local exit interface.
  • Verify with show ip route, show ip route DESTINATION, and show running-config.
  • Use ping for reachability and traceroute to examine the forwarding path.
  • Successful two-way communication requires both a forward route and a return path.

For a focused review, see Static Routes.