Static routing is the routing method in which a network administrator manually defines the path that a router uses to reach a specific destination network. A router learns its directly connected networks automatically from the IP addresses assigned to its interfaces. It must learn the path to a network that is not directly connected either from a routing protocol or from a static route entry written by the administrator. Without this information, the router cannot forward a packet to that destination and drops it.
The dynamic routing protocols RIP, OSPF and EIGRP update the routing table automatically by continuously exchanging information with neighbouring routers. Static routing has no such exchange. An entry stays the same until the administrator changes it. The router does not send updates to its neighbours and does not calculate paths, so CPU and memory usage is very low. The path that traffic takes is also known in advance.
This predictability has a cost. When the topology changes or a link fails, a static route does not correct itself, and every change must be made manually on the routers concerned. For this reason, static routing is preferred in small environments with few routers, in branch networks with a single exit, and in cases where specific traffic must pass over a specific link.
In the steps below, we will first assign IP addresses to the router interfaces in a scenario with 2 branches, and then create the static route entries on both routers. After the configuration is complete, we will follow a ping packet step by step from a client to a client in the other branch, and look at how ARP, switch and router behaviour work together on this path.
How Static Routing Works
A router compares the destination IP address of every packet it receives with the entries in the routing table. If more than 1 entry matches, the entry with the longest subnet mask is selected, which is the entry that defines the destination most narrowly. The selected entry gives the router at least 1 of 2 pieces of information. The first is the next hop, which is the IP address the packet is forwarded to, and the second is the interface the packet leaves from.
Static route entries are shown with the letter S in the routing table, and their default administrative distance (AD) is 1. Administrative distance is the value that determines which path to trust among paths to the same destination learned from different sources, and the lower value wins. The value is 0 for directly connected networks, 110 for OSPF and 120 for RIP. For this reason, if both a static route and a dynamic routing entry exist for the same destination, the router uses the static route.
The table below shows the behavioural differences between the 2 routing methods side by side.
|
Feature |
Static Routing |
Dynamic Routing |
|
How the path is learned |
Written manually by the administrator |
Learned from neighbouring routers by the protocol |
|
Topology change |
Entries are updated manually |
The protocol calculates the new path itself |
|
Resource usage |
Very low, there is no update traffic |
Uses CPU, memory and bandwidth |
|
Scalability |
Management becomes harder as the number of routers grows |
Suitable for large environments |
|
Traffic path |
Known in advance and does not change |
Can change according to metric values |
Scenario Topology and IP Address Plan
The scenario has 2 branches named Taksim and Kadıköy. Each branch has 1 router, 1 switch and clients connected to the switch. The 2 routers are connected to each other over a serial link. The local network of the Taksim branch is 192.168.10.0/24, the local network of the Kadıköy branch is 192.168.20.0/24, and the WAN link between the 2 routers uses the 88.77.66.0/24 network. The topology below shows the whole design.

The table below shows the interface and IP address details of the devices used in the scenario. The addresses of these 2 clients are also in the table, because in the test stage we will send a ping from PC0 in the Taksim branch to PC5 in the Kadıköy branch.
|
Device |
Interface |
IP Address |
Role |
|
Router-Taksim |
GigabitEthernet0/0 |
192.168.10.1/24 |
Default gateway address of the Taksim local network |
|
Router-Taksim |
Serial0/0/0 |
88.77.66.1/24 |
WAN link |
|
Router-Kadikoy |
GigabitEthernet0/0 |
192.168.20.1/24 |
Default gateway address of the Kadıköy local network |
|
Router-Kadikoy |
Serial0/0/0 |
88.77.66.2/24 |
WAN link |
|
PC0 |
FastEthernet0 |
192.168.10.10/24 |
Client in the Taksim branch |
|
PC5 |
FastEthernet0 |
192.168.20.12/24 |
Client in the Kadıköy branch |
The 88.77.66.0/24 block is in the public IP address range and is used here to represent the WAN link in a lab environment. In a real environment, these addresses must be replaced with the addresses given by the service provider.
Assigning IP Addresses to the Router Interfaces
Before a static route is written, the router interfaces must have IP addresses and be active. The router resolves how to reach the next hop address written in the static route from the other entries in the routing table, and in this scenario that entry is the network directly connected to the serial interface. If the interface is shut down or has no address, the next hop address cannot be resolved and the static route is not installed in the routing table. On Cisco routers, interfaces are shut down by default, so the no shutdown command must be run on each of them.
Interface Configuration on the Taksim Router
On the Taksim router, I first change the hostname, and then assign IP addresses to the GigabitEthernet0/0 interface, which faces the local network, and the Serial0/0/0 interface, which faces the WAN. On a serial link, the clock signal is generated by the router at the DCE (Data Communications Equipment) end of the cable. In this scenario the DCE end is on the Taksim side, so the clock rate command is run only on this router.
enable
configure terminal
hostname Router-Taksim
interface GigabitEthernet0/0
ip address 192.168.10.1 255.255.255.0
no shutdown
exit
interface Serial0/0/0
ip address 88.77.66.1 255.255.255.0
clock rate 128000
no shutdown
do write
end
The do write at the end of the commands saves the changes to the startup configuration. If this step is skipped, the configuration is lost when the router restarts. The screen below shows the output of the commands on the Taksim router.

Interface Configuration on the Kadıköy Router
I repeat the same procedure on the Kadıköy router with its own addresses. This router is at the DTE end of the serial cable, so it does not need the clock rate command.
enable
configure terminal
hostname Router-Kadikoy
interface GigabitEthernet0/0
ip address 192.168.20.1 255.255.255.0
no shutdown
exit
interface Serial0/0/0
ip address 88.77.66.2 255.255.255.0
no shutdown
do write
end

At this point, the 2 routers can reach each other's serial interface addresses because they are in the same WAN network. There is no communication between the local networks of the branches yet. The Taksim router does not know the 192.168.20.0/24 network, and the Kadıköy router does not know the 192.168.10.0/24 network. We will supply this missing information with static route entries.
The ip route Command and Its Parameters
A static route is defined with the ip route command in global configuration mode. The command has 2 basic forms. The first specifies the next hop IP address the packet is forwarded to, and the second specifies the interface the packet leaves from.
ip route [Destination Network] [Destination Subnet Mask] [Next Hop IP Address]
ip route [Destination Network] [Destination Subnet Mask] [Exit Interface]
The table below shows what each parameter in the command means and its value in the scenario.
|
Parameter |
Description |
Example in the Scenario |
|
Destination Network |
The address of the remote network to be reached. The network address is written, not the address of a single device. |
192.168.20.0 |
|
Destination Subnet Mask |
Determines which part of the destination address is the network ID and which part is the host ID. For details, see the Subnet Mask article. |
255.255.255.0 |
|
Next Hop IP Address |
The next hop IP address the packet is forwarded to. This address can be resolved through a directly connected network or through another entry in the routing table. |
88.77.66.2 |
|
Exit Interface |
The local interface through which the packet leaves the router. |
Serial0/0/0 |
When a next hop address is written, the router performs a lookup in 2 stages. It first finds the next hop address for the destination network, and then searches the routing table again to find how to reach this address. This second lookup, which is called a recursive lookup, can end with a directly connected network entry or with another route entry. In our scenario, the next hop address 88.77.66.2 is in the network directly connected to the router's serial interface, so the lookup is resolved in the first step. When an exit interface is written, this second lookup is not performed. On point-to-point links such as serial, there is only 1 device at the other end of the link, so both forms work without problems.
If only the exit interface is written on Ethernet interfaces, the router sends a separate ARP query for every destination IP address, and communication depends on the proxy ARP feature of the opposite router. A next hop address must be used on Ethernet.
Defining Static Routes on the Routers
Routing must be considered in both directions. It is not enough for the outgoing packet to reach the destination, the reply must also be able to return. For this reason, a static route is defined on both routers, pointing to the local network of the other branch. If it is defined on only 1 side, the packet reaches the destination but the reply cannot return, and the ping fails.
Static Route Configuration on the Taksim Router
I tell the Taksim router to deliver packets for the 192.168.20.0/24 network to 88.77.66.2, the WAN address of the Kadıköy router.
configure terminal
ip route 192.168.20.0 255.255.255.0 88.77.66.2
do write
end

Static Route Configuration on the Kadıköy Router
On the Kadıköy router, I write the same entry in the opposite direction. This time the destination network is 192.168.10.0/24, and the next hop is 88.77.66.1, the WAN address of the Taksim router.
configure terminal
ip route 192.168.10.0 255.255.255.0 88.77.66.1
do write
end

You can check whether the entries are in the routing table with the command below, in privileged EXEC mode on both routers.
On the Taksim router, the line below must appear in the output. The letter S at the start of the line shows that the entry is a static route, the first value in the square brackets shows the administrative distance, and the second value shows the metric.
S 192.168.20.0/24 [1/0] via 88.77.66.2
The Packet's Path from Taksim to Kadıköy
To test the configuration, I send a ping from PC0 in the Taksim branch to PC5 in the Kadıköy branch. The command is run in the Command Prompt window of PC0.
When the ping succeeds, only the reply lines appear on the screen. In the background, the packet passes through 2 switches and 2 routers, and a different decision is made at each step. We will follow this path in order in the steps below.
PC0 Creates the ICMP Echo Request Packet
PC0 creates an ICMP Echo Request packet with the destination IP address 192.168.20.12. The source IP address of the packet is 192.168.10.10 and the destination IP address is 192.168.20.12. Before sending, PC0 compares the destination address with its own subnet mask to find out whether the destination is in its own network. The address 192.168.20.12 does not belong to the 192.168.10.0/24 network, so PC0 understands that it cannot send the packet directly to the destination and decides to deliver it to 192.168.10.1, its default gateway address.
The detail here is that the IP and MAC addresses point to different targets. The destination IP address of the packet remains PC5. The destination MAC address of the Ethernet frame that carries the packet belongs to the GigabitEthernet0/0 interface of the Taksim router.

Learning the Default Gateway MAC Address with ARP
To prepare the frame, PC0 must know the MAC address of the default gateway. It first checks its own ARP cache. If there is an entry for 192.168.10.1, it uses this address and sends the frame immediately. If there is no entry, the ARP (Address Resolution Protocol) process starts. The table below shows the steps of the process when the MAC address is not known.
|
Step |
Action |
Description |
|
1 |
ARP request |
PC0 sends an ARP request that asks for the MAC address of 192.168.10.1. The destination MAC address of the frame is FF:FF:FF:FF:FF:FF, so the switch forwards it as a broadcast to all ports in the same VLAN. |
|
2 |
ARP reply |
All devices in the network receive the request, but only the Taksim router, which has the address 192.168.10.1, replies. The reply is sent as a unicast directly to PC0. |
|
3 |
ARP cache entry |
PC0 writes the MAC address it learned to its ARP cache. While the entry is valid, no new ARP request is sent for the same address. |
|
4 |
Sending the frame |
PC0 sends the waiting ICMP packet to the switch in an Ethernet frame addressed to the MAC address of the router. |
Note that PC0 does not ask for the MAC address of PC5 at any stage. An ARP request is a broadcast message, and routers do not pass broadcasts to another network. For this reason, ARP works only for addresses in the same network, and the MAC address of the default gateway is always used for a destination in a different network.

The Switch Forwards the Frame to the Taksim Router
A switch operates at Layer 2 and does not examine the IP addresses inside the frame. It records the source MAC address of the incoming frame and the port it arrived on in the MAC address table, and then searches the same table for the destination MAC address. If the MAC address of the router is in the table, the frame is forwarded only to the switch port that the router is connected to. If there is no entry, the switch sends the frame to all ports except the port it arrived on. This behaviour is called unknown unicast flooding, and it is not the same as a broadcast, because the destination MAC address of the frame still points to a single device.
The frame reaches the GigabitEthernet0/0 interface of the Taksim router. The router sees that the destination MAC address is its own, removes the Ethernet header and starts to examine the IP packet inside.

Routing Decision of the Taksim Router and Forwarding over the WAN
The router searches the routing table for 192.168.20.12, the destination IP address of the packet. Because of the static route we wrote, the 192.168.20.0/24 entry matches, and the next hop address is found to be 88.77.66.2. In the second lookup, the router resolves that 88.77.66.2 is reachable from the Serial0/0/0 interface through the directly connected 88.77.66.0/24 network. The TTL (Time to Live) value of the packet is decreased by 1 and the packet is forwarded to this interface.
A serial link is different from Ethernet here. Serial interfaces have no MAC address, and because there is only 1 device at the other end of a point-to-point link, the ARP process does not run either. The router places the IP packet inside an HDLC (High-Level Data Link Control) frame, which is the default encapsulation on Cisco serial interfaces, and sends it on the link. The source and destination IP addresses of the packet do not change at all during this.

The Kadıköy Router Delivers the Packet to the Local Network
The Kadıköy router receives the packet on the Serial0/0/0 interface, removes the HDLC header and searches its own routing table for the destination IP address. The 192.168.20.0/24 network is directly connected to the GigabitEthernet0/0 interface, so this time there is no next hop and the packet will be delivered directly to the destination device. The TTL value is decreased by 1 once more.
For delivery, the router needs the MAC address of PC5. If the ARP cache has an entry for 192.168.20.12, the packet is placed in a new Ethernet frame immediately. If there is no entry, the router sends an ARP request from GigabitEthernet0/0, PC5 returns an ARP reply with its own MAC address, and the router writes this address to its ARP cache. The source MAC address of the new frame is the GigabitEthernet0/0 interface of the Kadıköy router, and the destination MAC address is PC5. The switch in the Kadıköy branch checks its MAC address table and forwards the frame to the port that PC5 is connected to.

A Cisco router can drop the packet it holds while ARP resolution is in progress, instead of keeping it waiting. For this reason, it is normal for the first Echo Request to time out on the first attempt, when the ARP caches are empty.
Return Path of the ICMP Echo Reply Packet
When PC5 receives the Echo Request packet, it creates an ICMP Echo Reply packet. This time the source IP address is 192.168.20.12 and the destination IP address is 192.168.10.10. PC5 makes the same comparison, sees that the destination is not in its own network, and sends the packet to its default gateway 192.168.20.1, that is, to the MAC address of the Kadıköy router. The switch forwards the frame to the port that the router is connected to, according to the destination MAC address.

The static route we wrote on the Kadıköy router is used here. The router finds that the next hop address for the 192.168.10.0/24 network is 88.77.66.1 and sends the packet from the Serial0/0/0 interface. The Taksim router receives the packet on Serial0/0/0, sees that the destination is in the directly connected 192.168.10.0/24 network, and sends it from the GigabitEthernet0/0 interface in a new Ethernet frame addressed to the MAC address of PC0. The MAC address of PC0 is already in the ARP cache of the router because of the ARP exchange during the first packet. The switch forwards the frame to the port of PC0, and the ping reply appears on the screen.

The table below summarises the addresses that carry the Echo Request packet along the path. The IP addresses stay the same from end to end, while the Layer 2 information is rewritten on every segment.
|
Segment |
Source IP |
Destination IP |
Layer 2 Source |
Layer 2 Destination |
|
Between PC0 and Router-Taksim |
192.168.10.10 |
192.168.20.12 |
PC0 MAC address |
Router-Taksim GigabitEthernet0/0 MAC address |
|
Between Router-Taksim and Router-Kadikoy |
192.168.10.10 |
192.168.20.12 |
HDLC frame, no MAC address |
HDLC frame, no MAC address |
|
Between Router-Kadikoy and PC5 |
192.168.10.10 |
192.168.20.12 |
Router-Kadikoy GigabitEthernet0/0 MAC address |
PC5 MAC address |
ARP Cache Timeout and ARP Security
We saw that ARP was used at 3 separate points on the packet's path. PC0 learned its own default gateway, the Kadıköy router learned PC5, and PC5 learned its own default gateway in this way. Learned entries are not kept in the ARP cache indefinitely. In Cisco IOS, the default ARP timeout is 4 hours and can be changed per interface. In Windows operating systems this time is much shorter, and unused entries are deleted within minutes. For an entry that has expired, the device sends an ARP request again.
The weakness of ARP is that it does not verify who a reply comes from. An attacker can redirect client traffic to their own device by sending forged ARP reply messages that announce the attacker's MAC address for the IP address of the default gateway. Against this attack, known as ARP spoofing, Dynamic ARP Inspection (DAI) is used on Cisco switches. Dynamic ARP Inspection validates the IP and MAC bindings in ARP packets received on untrusted interfaces against the DHCP snooping binding table or configured ARP ACL entries, and drops invalid packets. ARP packets received on trusted interfaces do not go through this validation.
This distinction determines the state in which ports are left. Client ports are configured as untrusted. Uplink ports between switches can be configured as trusted if the switch on the other side performs ARP validation reliably for the relevant VLAN. A link to a switch that does not run Dynamic ARP Inspection must be kept untrusted, and the required ARP ACL validation must be provided for ARP packets that come from that direction. Otherwise, forged ARP packets from a device behind the switch that does not perform validation enter through the trusted port without inspection. In environments with a small number of fixed devices, defining static ARP entries is also an option.
In designs that use a Layer 3 switch, the same mechanism also works during inter-VLAN routing. IPv6 has no ARP, and Neighbor Discovery Protocol (NDP) performs the same task.
Default Route and Floating Static Route
Because static routing is managed manually, the number of entries to write grows as the number of routers and networks grows. There are 2 forms of use that reduce this workload, and both are defined with the same ip route command.
Using a Default Route
A branch router with a single exit does not need a separate entry for every remote network. A default route, written with 0.0.0.0 as the destination network and subnet mask, is used for all destinations that have no more specific entry in the routing table. The internet exit is usually defined in this way.
ip route 0.0.0.0 0.0.0.0 [Next Hop IP Address]
Defining a Backup Path with a Floating Static Route
If there is a second link between the 2 branches, a second static route for the same destination network can be written with a higher administrative distance. The router uses the primary entry, which has the lower value. When the primary static route becomes invalid and is removed from the routing table, the floating static route, whose next hop address is reachable, takes effect.
ip route [Destination Network] [Destination Subnet Mask] [Backup Next Hop IP Address] [Administrative Distance]
The removal of the primary entry from the routing table depends on its next hop address becoming unresolvable. When the interface of the primary link goes down, the directly connected network entry is deleted, but if the router can resolve the same next hop address through another entry in the routing table, for example a default route, the primary static route stays in place. In this way, the fact that the primary next hop address can be resolved through another route can prevent the backup entry from taking effect.
If the fault is at a remote point on the link and the local interface does not go down, the primary static route stays in the routing table. In this case, the floating static route does not take effect automatically.
The most common mistake in static routing is to think of the entry in 1 direction only. When there is an access problem to a network, checking only the outgoing path is misleading. Checking the show ip route output on every router the packet passes through, to see whether a valid path exists for both the destination and the source network, usually shows in a single step which router has the problem.
This article covered static routing configuration on a Cisco router in a scenario with 2 branches. It explained on a technical basis why a router cannot automatically know the path to a network that is not directly connected, how a static route entry is installed in the routing table, and the effect of administrative distance on path selection.
After the steps for assigning IP addresses to the router interfaces, it described the parameters of the ip route command, how the next hop address is resolved through the routing table, how this differs from an exit interface, and the requirement to define static routing on both routers in both directions. It also showed how to verify the configuration with the show ip route command.
A ping packet sent from the client in the Taksim branch to the client in the Kadıköy branch was followed step by step, and the default gateway decision, the ARP process, the MAC address table behaviour of the switch and the HDLC encapsulation on the serial link were examined together. This flow showed that the IP addresses stay the same from end to end, while the Layer 2 information is rewritten on every segment.
The last section covered the ARP cache timeout and the ARP spoofing risk, the trusted and untrusted interface distinction of Dynamic ARP Inspection, and then the use of a default route and a floating static route. In small networks and branch designs with a single exit, static routing is still a valid routing method because of its low resource usage and predictable traffic path.
I hope you find it useful...
Feel free to share your thoughts and questions about this article in the comments below. Every contribution helps the content reach more people and makes for a more useful discussion.