Configuring and Verifying IPv4 Static Routing
Route static is simple way of routing that uses routes configured manually which does not participate in any dynamic protocols. The use of static routes is best recommended when you have a small network or only for specific cases where simplicity and control are preferred.
Configuring Static Routing
Static routes are configured on different devices, such as Windows, Linux and Cisco routers. Instructions for both platforms are detailed below.
Configuring Static Routing on Windows
- Open Command Prompt with Administrative Privileges:
- Search for cmd in the Start menu.
- Now right-click on Command Prompt and choose Run as administrator.
- Add a Static Route:
route add [destination IP] mask [subnet mask] [gateway IP]
- Example:
shell route add 192.168.2.0 mask 255.255.255.0 192.168.1.1
- This command routes packets destined for
192.168.2.0/24
via the gateway192.168.1.1
.
- Make the Route Persistent:
route -p add [destination IP] mask [subnet mask] [gateway IP]
- Example:
shell route -p add 192.168.2.0 mask 255.255.255.0 192.168.1.1
Configuring Static Routing on Linux
- Open Terminal:
- Add a Static Route:
sudo ip route add [destination IP]/[subnet mask] via [gateway IP]
- Example:
shell sudo ip route add 192.168.2.0/24 via 192.168.1.1
- Make the Route Persistent:
- Edit the network configuration file (e.g.,
/etc/network/interfaces
or/etc/sysconfig/network-scripts/ifcfg-eth0
) and add the static route. - Example for Debian-based systems:
shell sudo nano /etc/network/interfaces
Add the following lines:shell up ip route add 192.168.2.0/24 via 192.168.1.1
Configuring Static Routing on Cisco IOS
- Enter Global Configuration Mode:
enable
configure terminal
- Add a Static Route:
ip route [destination IP] [subnet mask] [next-hop IP address or exit interface]
- Example:
shell ip route 192.168.2.0 255.255.255.0 192.168.1.1
- Exit Configuration Mode and Save Configuration:
end
write memory
Verifying Static Routing
After configuring static routes, it is crucial to verify that they are correctly set up and operational.
Verifying Static Routing on Windows
- View Routing Table:
route print
- This command displays the routing table, including static routes.
Verifying Static Routing on Linux
- View Routing Table:
ip route show
- This command displays the routing table, including static routes.
Verifying Static Routing on Cisco IOS
- View Routing Table:
show ip route
- This command displays the routing table, including static routes.
Practical Example: Configuring and Verifying Static Routing
Scenario:
- Router A (192.168.1.1) is connected to Network A (192.168.1.0/24).
- Router B (192.168.2.1) is connected to Network B (192.168.2.0/24).
- We need to route traffic from Network A to Network B via Router A and Router B.
Configuring Static Route on Router A:
- Enter Global Configuration Mode:
RouterA> enable
RouterA# configure terminal
- Add Static Route to Network B:
RouterA(config)# ip route 192.168.2.0 255.255.255.0 192.168.1.2
- Exit Configuration Mode and Save:
RouterA(config)# end
RouterA# write memory
Configuring Static Route on Router B:
- Enter Global Configuration Mode:
RouterB> enable
RouterB# configure terminal
- Add Static Route to Network A:
RouterB(config)# ip route 192.168.1.0 255.255.255.0 192.168.2.2
- Exit Configuration Mode and Save:
RouterB(config)# end
RouterB# write memory
Verifying Routes on Router A and Router B:
- Verify on Router A:
RouterA# show ip route
- Verify on Router B:
RouterB# show ip route
Conclusion
IPv4 static routing can be used to supplement the dynamic routing criteria, which is quite important in cases with small and/or static networks. Thus, understanding the commands and the sequence of actions within different operating systems and multiple devices results in proper and effective management of networks among the network administrators.