Static routing is a method where a network administrator manually configures routing entries in the router’s routing table. Unlike dynamic routing, static routing is straightforward and does not consume extra CPU or bandwidth. It is often used in small networks or as a backup for dynamic routing.
Scenario: Configuring Static Routes Between Two Networks
Imagine we have two branch offices connected through routers, and we need to configure static routes to ensure communication between them.
Router1 (R1)
LAN Network: 192.168.1.0/24
Interface to R2: 10.0.0.1/30
Router2 (R2)
LAN Network: 192.168.2.0/24
Interface to R1: 10.0.0.2/30
Objective
Configure static routes on R1 to reach 192.168.2.0/24 via R2.
Configure static routes on R2 to reach 192.168.1.0/24 via R1.
R2#configure terminal
R2(config)#interface fastEthernet 0/0
R2(config-if)#ip address 192.168.2.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit et0/0, changed state to up
R2(config)#interface serial 3/0
R2(config-if)#ip address 10.0.0.2 255.255.255.252
R2(config-if)#no shutdown
On PC1
PC1> ip 192.168.1.100/24 192.168.1.1
Checking for duplicate address...
PC1 : 192.168.1.100 255.255.255.0 gateway 192.168.1.1
PC1> show ip
NAME : PC1[1]
IP/MASK : 192.168.1.100/24
GATEWAY : 192.168.1.1
DNS :
MAC : 00:50:79:66:68:05
LPORT : 20018
RHOST:PORT : 127.0.0.1:20019
MTU : 1500
PC1> save
Saving startup configuration to startup.vpc
. done
PC1>
On PC2
PC2> ip 192.168.2.100/24 192.168.2.1
Checking for duplicate address...
PC2 : 192.168.2.100 255.255.255.0 gateway 192.168.2.1
PC2> show ip
NAME : PC2[1]
IP/MASK : 192.168.2.100/24
GATEWAY : 192.168.2.1
DNS :
MAC : 00:50:79:66:68:00
LPORT : 20020
RHOST:PORT : 127.0.0.1:20021
MTU : 1500
PC2> save
Saving startup configuration to startup.vpc
. done
PC2>
Step 3: Configure Static Routes
Now, we need to inform R1 and R2 about each other’s LAN networks.
R1#show ip rou
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
i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.0.0.0/30 is directly connected, Serial3/0
L 10.0.0.1/32 is directly connected, Serial3/0
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/24 is directly connected, FastEthernet0/0
L 192.168.1.1/32 is directly connected, FastEthernet0/0
S 192.168.2.0/24 [1/0] via 10.0.0.2
R1#
On R1:
R2#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
i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.0.0.0/30 is directly connected, Serial3/0
L 10.0.0.2/32 is directly connected, Serial3/0
S 192.168.1.0/24 [1/0] via 10.0.0.1
192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.2.0/24 is directly connected, FastEthernet0/0
L 192.168.2.1/32 is directly connected, FastEthernet0/0
R2#
Test Connectivity
PC1> ping 192.168.2.100
84 bytes from 192.168.2.100 icmp_seq=1 ttl=62 time=83.568 ms
84 bytes from 192.168.2.100 icmp_seq=2 ttl=62 time=22.819 ms
84 bytes from 192.168.2.100 icmp_seq=3 ttl=62 time=41.801 ms
84 bytes from 192.168.2.100 icmp_seq=4 ttl=62 time=23.112 ms
^C
PC1>