Static Routing
Static routing is a method of route control in which the administrator manually configures the mapping between destination networks and next hops on a router. Routing falls into two categories: this static routing, and dynamic routing, in which routing protocols exchange route information with neighboring routers to learn routes automatically. This article focuses on static routing, going into more depth on command syntax and the points to keep in mind when configuring it. For the basics of how routing itself works, see Routing.
On Cisco IOS(-XE), static routes are configured using the ip route command.
Router(config)# ip route <destination network> <subnet mask> {<next-hop IP address> | <exit interface>} [administrative distance]Specifying the Next Hop
The ip route command lets you specify the packet’s forwarding destination as a “next-hop IP address,” an “exit interface,” or a combination of both.
Specifying a Next-Hop IP Address
This method directly specifies the IP address of the adjacent router. On multi-access links such as Ethernet, this is the commonly used approach.
Router(config)# ip route 192.168.2.0 255.255.255.0 10.1.2.2With this configuration, for packets destined to 192.168.2.0/24, the routing table must look up a separate route again (typically a directly connected route) to reach the next hop 10.1.2.2. This is called a recursive lookup. Note that if no route to the next hop 10.1.2.2 itself can be found, this configuration will not take effect.
Specifying an Exit Interface
This method directly specifies which of the router’s own interfaces to send the packet out of.
Router(config)# ip route 192.168.2.0 255.255.255.0 GigabitEthernet1On point-to-point links (such as serial links, where only one device is connected on the other end of the link), specifying just the exit interface is enough to uniquely determine the forwarding destination, so this method works fine. However, using this method on a multi-access link such as Ethernet is not recommended, because when resolving the destination host’s MAC address via ARP, the router may end up sending an ARP request to every neighbor on that segment rather than just the intended destination.
Specifying Both
You can also specify both the next-hop IP address and the exit interface together.
Router(config)# ip route 192.168.2.0 255.255.255.0 GigabitEthernet1 10.1.2.2Because the exit interface is explicit, no recursive lookup is needed, and the forwarding destination is uniquely identified even on a multi-access link — making this the recommended syntax in many environments. The static routes used in the test environment in Routing are also configured using this syntax.
1. Floating static routes, which build on this concept, are covered in Administrative Distance (AD).Default Route (Static)
By specifying both the destination network and subnet mask as 0.0.0.0, you can statically configure a default route — the forwarding destination for packets that match no other route.
Router(config)# ip route 0.0.0.0 0.0.0.0 10.1.2.1In the test environment used in Routing, R2 is configured with a default route in this form, which also appears in the show ip route output as S* (candidate default). This is especially common in configurations such as stub networks (networks with only a single exit point to the outside), where there’s no need to configure individual routes in detail.
Configuration Example on Real Hardware
We use the same test environment (R1-R3, PC1-PC3) as in Routing.
In this environment, each router has static routes configured using the “next-hop IP address plus exit interface” syntax described above.
| Router | Configured Static Routes |
|---|---|
| R1 | ip route 192.168.0.0 255.255.0.0 GigabitEthernet3 10.1.3.3ip route 192.168.2.0 255.255.255.0 GigabitEthernet2 10.1.2.2 |
| R2 | ip route 0.0.0.0 0.0.0.0 GigabitEthernet2 10.1.2.1 (default route) |
| R3 | ip route 192.168.1.0 255.255.255.0 GigabitEthernet2 10.1.3.1ip route 192.168.2.0 255.255.255.0 GigabitEthernet2 10.1.3.1 |
Each router’s show ip route output and full show running-config are posted in Routing. The two static routes configured on R1 are also used as a concrete example of longest match, so refer to that section as well.
Advantages and Disadvantages of Static Routing
A comparison between static routing and dynamic routing is summarized in Routing, but a point specific to static routing worth calling out is that route changes or failures require manual intervention by the administrator. In small networks with few routes, or in configurations like stub networks where the routes essentially never change, this is far outweighed by the benefit of avoiding the learning and operational overhead of a dynamic routing protocol.
References
| RFC | Title | Overview |
|---|---|---|
| RFC 1812 | Requirements for IP Version 4 Routers | Defines requirements for IPv4 routers, including concepts related to route selection and administrative-distance-like preference. |