Static routing is a process where a network administrator manually configures and defines the paths that data packets take to reach a specific destination network.
Unlike dynamic routing (where routers talk to each other using protocols like OSPF or RIP to find the best path), static routing doesn’t change unless a human manually reconfigures it. It is ideal for small, stable networks or “stub networks” (networks with only one way out).
The Static Route Command Syntax
On Cisco IOS devices (the industry-standard syntax), the command to configure a static route is:
ip route [destination_network] [subnet_mask] [next_hop_address_OR_exit_interface]
Breakdown of the Components:
ip route: The core command telling the router to add a manual route.destination_network: The IP address of the remote network you want to reach.subnet_mask: The subnet mask of that remote network.next_hop_address: The IP address of the next router’s interface along the path.exit_interface: The local interface on the current router (e.g., GigabitEthernet0/0) through which data should be sent out.
Practical Example Configuration
Let’s look at a classic two-router scenario.
The Scenario Setup:
- LAN 1 (connected to Router A):
192.168.1.0/24 - LAN 2 (connected to Router B):
192.168.2.0/24 - WAN Link (The connection between Router A and Router B):
10.0.0.0/30- Router A’s WAN IP:
10.0.0.1 - Router B’s WAN IP:
10.0.0.2
- Router A’s WAN IP:
Currently, Router A only knows about LAN 1 and the WAN link because they are directly connected. It has no idea LAN 2 exists. Router B is in the same situation regarding LAN 1. We must configure static routing so they can talk.
Step 1: Configure Router A (To reach LAN 2)
To tell Router A how to get to LAN 2 (192.168.2.0), we target Router B’s WAN IP (10.0.0.2) as the next hop.
Plaintext
RouterA# configure terminal
RouterA(config)# ip route 192.168.2.0 255.255.255.0 10.0.0.2
RouterA(config)# exit
(Alternatively, using the exit interface instead of the next-hop IP: ip route 192.168.2.0 255.255.255.0 Serial0/0/0)
Step 2: Configure Router B (To reach LAN 1)
Routing is a two-way street. If you don’t configure the return path, Router A can send data to LAN 2, but LAN 2 won’t be able to reply.
Plaintext
RouterB# configure terminal
RouterB(config)# ip route 192.168.1.0 255.255.255.0 10.0.0.1
RouterB(config)# exit
Step 3: Verifying the Configuration
To verify that your static routes have been successfully added to the routing table, run the following command on either router:
Plaintext
RouterA# show ip route
In the output, you will look for a line starting with S, which stands for Static:
Plaintext
S 192.168.2.0/24 [1/0] via 10.0.0.2
Special Type: Default Static Route Configuration
A Default Route is a special type of static route used when a router doesn’t have a specific path for a destination network. It is essentially saying: “If you don’t know where to send it, send it here.” This is most commonly used to direct all unknown traffic out to the Internet Service Provider (ISP).
It uses a wildcard placeholder of all zeros (0.0.0.0 0.0.0.0).
Example:
If Router A connects to an ISP router at IP address 203.0.113.2, you would configure a default route like this:
Plaintext
RouterA(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.2
When you check the routing table with show ip route this, it will appear with an asterisk as S*, indicating it is the “Gateway of Last Resort.”
Advantages vs. Disadvantages
Before implementing static routing across a broader environment, it’s worth weighing its pros and cons:
- Advantages:
- Low Overhead: It uses zero CPU processing power and zero network bandwidth because routers don’t have to constantly exchange updates.
- Security: The administrator has absolute control over exactly where traffic flows.
- Predictability: The path never changes unexpectedly.
- Disadvantages:
- No Redundancy: If a link goes down, a static route cannot automatically reroute traffic around the failure. It will just fail until manually fixed.
- Not Scalable: Manually typing routes for a network with 50 routers and hundreds of subnets becomes an administrative nightmare prone to human error.