How to configure static route on Cisco IOS Router

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

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: 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



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 make sure 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 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! Here is why:

  • 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 662 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

515 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. Florian,
    In the case of a point-to-point link, it is always sufficient to specify the outgoing interface. In the case of a broadcast/multi-access interface (like Ethernet), Cisco’s best practice is to specify BOTH the interface AND the next hop IP address. While in most cases, you can get away with using only the next-hop IP, there are a few circumstances where this can result in unexpected behavior. Cisco has a pretty good article explaining how you can get into trouble without specifying both here:

    http://www.cisco.com/c/en/us/support/docs/dial-access/floa

    ... Continue reading in our forum

  3. Hello Said

    As long as you have connectivity between directly connected routers and you’ve installed the remote networks on each router, you should be OK. No additional configuration should be necessary.

    However, keep in mind that if your three routers are connected to each other in a loop, and you have created static routes to all possible networks, you may have created a routing loop.

    I suggest you try to simplify your topology further and try configuring two routers only and have them share their networks. Once you get that working, you can expand to three

    ... Continue reading in our forum

  4. Hello Lazaros,
    Thank you for your valuable reply.
    My lab setup is as follows, I got R1 connected to R2 (in middle) and R2 is connected to R3, no connection is made between R1 and 3 (no loops here) now lets say R1 has networks 10.0.0.0 on fa interface and 192.168.12.0 on S0 —>R2
    R2 has 2 networks 192.168.12.0 and 192.168.23.0 which connects to both R1 and R3
    R3 has similar setup as R1, network 172.16.0.0 on its Fa interface and 192.168.23.0 on S0 -->R2
    R2 have both directly connected networks plus 172.16.0.0 and 10.0.0.0 configured as static routes.
    R1 has a st

    ... Continue reading in our forum

  5. Got it working! my bad, just added a default route on both edge routers and it worked
    Thanks for the help guys.

    Sid

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