A static route is a manual way to route traffic. Here, the network administrator defines the route directly in the router’s table.
Static routing stays the same unless you change it. In contrast, dynamic routing protocols adjust automatically to network changes.
Let’s examine a practical example to understand why we need static routes.
Figure 1 – Basic Static Route Topology
In this simple topology, there are two routers.
Router R1 is connected to the192.168.1.0/24
network through its GigabitEthernet0/1 interface.
Router R2 is connected to both networks:192.168.1.0/24
via GigabitEthernet0/0192.168.2.0/24
via GigabitEthernet0/1
The Problem
R1 can't reach the 192.168.2.0/24 network. This is because its routing table lacks a route to that network.
Figure 2 – Missing Static Route Problem
When we look the routing table of R1 by using
show ip route
:R1# show ip route Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set 192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.1.0/24 is directly connected, GigabitEthernet0/1 L 192.168.1.1/32 is directly connected, GigabitEthernet0/1
We can see there is no entry for 192.168.2.0/24 network, if R1 need to send packets to devices into the 192.168.2.0/24, the router will not be able to know where to send the packet.
Testing Connectivity (Before Configuration)
If we try to send a ping to 192.168.2.1:
Figure 3 – Ping Failure Due to Missing Route on R1
R1# ping 192.168.2.1 Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds: ..... Success rate is 0 percent (0/5)
The ping fails because R1 lacks a route to reach the destination.
Answer the question below
Static routes are manually defined paths in a router’s routing table. This type of route need a specific IP address (next-hop IP) that the router will use to reach the given network.
Figure 4 – Static Route Syntax Breakdown
Components of a Static Route
Destination Network: The target network
Subnet Mask: The mask of the destination network
Next-Hop IP: The IP address of the next hop that indicates the path to the destination network
Administrative Distance (AD) (Optional): An optional parameter to define the priority of the route.
Administrative Distance (AD)
Static routes have a default Administrative Distance (AD) of 1. This makes them more reliable than most dynamic routing protocols. For example, RIP has an AD of 120, while OSPF has an AD of 110.
This ensures the static route is preferred over other routes.
Answer the question below
What is the default Administrative Distance (AD) of a static route?
Now that we understand the problem and the theory, let’s solve it by configuring a static route.
Here, R1 wants to reach the192.168.2.0/24
network. The command to use will be:ip route 192.168.2.0 255.255.255.0 192.168.1.2
Figure 5 – Static Route Configuration on R1
The next-hop IP address is the G0/0 interface of R2 (
192.168.1.2
).Router R1 will send traffic destined for the
192.168.2.0/24
network to the next-hop IP address192.168.1.2
.
Then, R2 will be able to forward the traffic to the network.Configuration Command
R1(config)# ip route 192.168.2.0 255.255.255.0 192.168.1.2
Now we can see in the routing table our route to 192.168.2.0/24 using 192.168.1.2 as the next-hop:
R1# show ip route Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set 192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.1.0/24 is directly connected, GigabitEthernet0/1 L 192.168.1.1/32 is directly connected, GigabitEthernet0/1 S 192.168.2.0/24 [1/0] via 192.168.1.2
R1 now has a static route pointing to the 192.168.2.0/24 network via the next-hop 192.168.1.2 with AD set to 1 (by default). The static route is marked with an
S
indicating that it is manually configured.Testing Connectivity After Configuration
R1# ping 192.168.2.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/0 ms
Figure 6 – Static Route Enables Successful Ping
The ping is now successful because the static route allows R1 to forward packets to the 192.168.2.0/24 network via R2.
Troubleshooting Static Route Issues
Common Issues and Solutions:
1. Missing Route Entrie: Ensure the next-hop address is correct.
R1# show running-config | section ip route ip route 192.168.2.0 255.255.255.0 192.168.1.2
2. Interface Down: Check interface status.
R1# show ip interface brief Interface IP-Address OK? Method Status Protocol GigabitEthernet0/1 192.168.1.1 YES manual up up GigabitEthernet0/0 unassigned YES unset administratively down down
Answer the question below
Static routes are manually configured on a router to define a specific path to reach a destination network.
They do not change unless you manually modify them.By default, a static route has an Administrative Distance (AD) of 1, which makes it more trustworthy than dynamic routes like RIP (AD 120) or OSPF (AD 110).
Configuring a Static Route
You configure a static route in global configuration mode using the ip route command:
R1# configure terminal R1(config)# ip route 192.168.2.0 255.255.255.0 192.168.1.2 R1(config)# exit
This tells R1:
→ To reach the 192.168.2.0/24 network, forward packets to the next-hop IP 192.168.1.2.Verifying the Route
Once configured, the static route appears in the routing table marked with an
S
:R1# show ip route ... S 192.168.2.0/24 [1/0] via 192.168.1.2
The route is now active and being used to forward traffic toward the remote network.
In the next lesson, we’ll cover how to set up a Default Static Route. This will act as a gateway of last resort for unknown destinations.Answer the question below
In the routing table, which letter identifies a static route?