Static Route

  • 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.

    Static route topology with R1 and R2 connecting two networks

    Figure 1 – Basic Static Route Topology

    In this simple topology, there are two routers.
    Router R1 is connected to the 192.168.1.0/24 network through its GigabitEthernet0/1 interface.
    Router R2 is connected to both networks:

    • 192.168.1.0/24 via GigabitEthernet0/0

    • 192.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.

    R1 cannot reach 192.168.2.0/24 network due to missing static route

    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:

    ping failure from R1 to 192.168.2.1 due to missing static route

    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