Static route on Cisco IOS Router

In this lesson, we’ll take a look at static routes and in particular, how to configure them.




Let me show you the following topology:

hq branch router

Look at the network in the picture above. We have a network with two sites, headquarters, and a branch office.

The headquarters is connected to the Branch office. Behind the branch office is a network with the 2.2.2.0 /24 network. We want to ensure that the headquarters can reach the 2.2.2.0 /24 network.

Let me show you how we configure this network using a static route:

HQ>enable
HQ#configure terminal

First, I’ll go to enable mode and enter configuration mode.

HQ(config)#interface FastEthernet 0/0
HQ(config-if)#no shutdown
HQ(config-if)#ip address 192.168.12.1 255.255.255.0
Branch>enable
Branch#configure terminal
Branch(config)#interface fastEthernet0/0
Branch(config-if)#no shutdown
Branch(config-if)#ip address 192.168.12.2 255.255.255.0
Branch(config-if)#exit
Branch(config)#interface fastEthernet 1/0
Branch(config-if)#no shutdown
Branch(config-if)#ip address 2.2.2.2 255.255.255.0

Then I’ll configure the IP addresses on the interfaces; don’t forget to do a no shutdown on the interfaces.

Let’s take a look at the routing tables of both routers:

HQ#show ip route 
Codes: 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, 
       ia - IS-IS inter area, * - candidate default,
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.12.0/24 is directly connected, FastEthernet0/0
Branch#show ip route 
Codes: 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,
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.12.0/24 is directly connected, FastEthernet0/0
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, FastEthernet1/0

Use the show ip route command to view the routing table. This is what a router uses to make decisions about where to forward IP packets to. By default, a router only knows its directly connected networks. We configured an IP address with a subnet mask on the interface, so the router also knows the network address.

  • Router HQ knows about network 192.168.12.0/24.
  • Router Branch knows about network 192.168.12.0/24 and 2.2.2.0/24.

At this moment our HQ router has no idea how to reach network 2.2.2.0/24 because there is no entry in the routing table. What will happen when we try to reach it? Let’s check:

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now!

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You’ve Ever Spent on Your Cisco Career!
  • Full Access to our 799 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)
545 Sign Ups in the last 30 days
satisfaction-guaranteed

  • 100% Satisfaction Guaranteed!
  • You may cancel your monthly membership at any time.
  • No Questions Asked!

Tags: ,


Forum Replies

  1. Hello Renne,

    What does " 2.0.0.0/24 is subnetted, 1 subnets" mean in below output?

    ********

    Branch#show ip route 
    Codes: 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,
           o - ODR, P - periodic downloaded static route
    
    Gateway of last resort is not set
    
    C    192.168.12.0/24 is directly connect
    ... Continue reading in our forum

  2. Hi Rajagopal,

    2.0.0.0 /8 is a class A network and 2.2.2.0 /24 is a “subnet” of this class A network.

    The routing table will always show the class A network address (2.0.0.0 /8) and the subnets below it (2.2.2.0 /24).

    Hope that helps!

    Rene

  3. How could you find the current non-used IP addresses in your LAN?. Is it safe to take any of them?

     

  4. When you assign static IP addresses to devices then you should always keep track which devices are using which IP addresses. Otherwise you might find yourself one day assigning duplicate IP addresses to your devices.

    If you want to find all devices in your LAN then you could try a tool like “nmap” (network scanner).

  5. Hi Rene

    I set up a simple network PC1 <-> R1 <-> R2 <-> PC2
    All the static routes are implemented, pings work from PC1 to PC2. However when i do a trace from PC2 to PC1 or vice versa, I always get the (ICMP type:3, code:3, Destination port unreachable) at the end of the route hop.

    PC2&gt; trace 192.168.1.1
    trace to 192.168.1.1, 8 hops max, press Ctrl+C to stop
     1   192.168.2.254   10.000 ms  9.000 ms  10.001 ms
     2   192.168.12.1   20.001 ms  20.001 ms  19.001 ms
     3   *192.168.1.1   31.002 ms (ICMP type:3, code:3, Destination port unreachable)
    

    I know that the t

    ... Continue reading in our forum

51 more replies! Ask a question or join the discussion by visiting our Community Forum