Static Routers

The purpose of configuring static routes, as well as RIP and IGRP, is to add routes to a router’s routing table. RIP and IGRP do so automatically. Static routing consists of individual configuration commands that define a route to a router. A router can forward packets only to subnets in its routing table. The router always knows about directly connected routes-routes to subnets off interfaces that have an “up and up” status. By adding static routes, a router can be told how to forward packets to subnets that are not attached to it.

Adding static routes to a router is relatively easy. To see the need, and to see the configuration, look at the picture below and the statistics of router R1 under it, which shows a ping command testing IP connectivity from the router R1 to not neighbour networks, attached to the Router R and R3. I’m going to use this picture to explain you all of the routing types, so it will be good if you learn the network topology.

Static Routes

R1#sh 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, 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

10.0.0.0/24 is subnetted, 4 subnets
C       10.10.1.0 is directly connected, FastEthernet0/0
S       10.10.2.0 [1/0] via 10.10.1.2
S       10.10.3.0 [1/0] via 10.10.1.2
S       10.10.10.0 [1/0] via 10.10.1.2
R1#
R1#
R1#ping 10.10.3.3

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 76/187/408 ms
R1#
R1#ping 10.10.10.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.10.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 104/184/424 ms
R1#

The ping command sends an ICMP echo request packet to the stated destination address. The TCP/IP software at the destination then replies to the ping echo request packet with a similar packet, called an ICMP echo reply. The ping command sends the first packet and waits on the response. If a response is received, the command displays a “!”. If no response is received within the default timeout of 2 seconds, the ping command displays a “.”. The IOS ping command sends 5 of these packets by default.

One simple solution to the failure of the ping command is to enable an IP routing protocol on all three routers. In fact, in a real network, that is the most likely solution. As an alternative, you can configure static routes. Many networks have a few static routes, so you need to configure them occasionally. The following example shows the ip route command on router R1, which adds static routes and makes the ping work.

ip route 10.10.2.0 255.255.255.0 10.10.1.2
ip route 10.10.3.0 255.255.255.0 10.10.1.2
ip route 10.10.10.0 255.255.255.0 10.10.1.2

The ip route commands supply the subnet number and the next-hop IP address. One ip route command defines a route to 10.10.2.0 (mask 255.255.255.0), which is the network between the routers R2 and R, so the next-hop IP address as configured on router R1 is 10.10.1.2, which is R2’s FastEthernet 0/0 IP address. Similarly, a route to 10.10.3.0, the subnet between R and R3, points to R2 FastEthernet 0/0 IP address again, as a single output link for R1. Note that the next-hop IP address is an IP address in a directly connected subnet-the goal is to define the next router to send the packet to. Now R1 can forward packets to these two subnets. You can configure static routes in a couple different ways. With point-to-point serial links, you can also configure the outgoing interface instead of the next-hop IP address. For instance, you could have configured ip route 10.10.3.0 255.255.255.0 Serial 1/0 at router R2 for the first route.

Unfortunately, adding these static routes to R1 and R2 does not solve all the network’s routing problems. The static routes help R1 deliver packets to these subnets, but the other routers don’t have enough routing information to forward packets back toward R1. The solution is to put manualy static routes in all of the routers for each network. As you can imagine, if you have huge network with tens or hundreds of routers this is not a solution. Here comes the dynamic routing protocols, which are our main goal in this chapter.

In real life, you might not be able to find a host (HOST on the picture), to ask to test your network by pinging. So you can use the extended ping command on a router to test routing in the same way a ping from HOST to R1 tests routing. Here is an example showing R with the working ping 10.10.1.1 command, but with an extended ping command that works similarly to a ping from HOST to R1 ping.

R#ping
Protocol [ip]:
Target IP address: 10.10.1.1
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: yes
Source address or interface: 10.10.10.1
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.1.1, timeout is 2 seconds:
Packet sent with a source address of 10.10.10.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 52/107/200 ms
R#

Our Recommended Premium CCNA Training Resources

These are the best CCNA training resources online:

Click Here to get the Cisco CCNA Gold Bootcamp, the most comprehensive and highest rated CCNA course online with a 4.8 star rating from over 30,000 public reviews. I recommend this as your primary study source to learn all the topics on the exam. Cisco CCNA Gold Bootcamp
Want to take your practice tests to the next level? AlphaPreps purpose-built Cisco test engine has the largest question bank, adaptive questions, and advanced reporting which tells you exactly when you are ready to pass the real exam. Click here for your free trial. Cisco CCNA Gold Bootcamp