As you prepare for your Cisco CCENT and CCNA exams you will need to understand much more than the basics of how routers work.  But you have to start somewhere so let’s look at the CCENT/CCNA topic of Static Routing. Routers learn about remote networks either dynamically using routing protocols or manually using static routes. In many cases routers use a combination of both dynamic routing protocols and static routes. This chapter focuses on static routing.

Some of the key concepts in this topic which are covered on the CCENT and CCNA exams include:

  • Stub network
  • IP route command
  • Next hop ip address
  • Exit interface
  • Routing table principles
  • Recursive route lookup
  • Summary route
  • Static default route

CCENT & CCNA Static Routing Introduction

As you prepare for your CCNA exam you will find out that a router’s routing table is used to find the best match between the destination IP of a packet and a network address in the routing table.

In previous discussions, we connected a router to computer and verified communication by using ping. However, refer to the topology shown in the exhibit below.

CCNA Lab Static Routing
CCNA Lab Static Routing

The CCNA network topology above shows a small network consisting of 3 routers and 2 hosts. As discussed earlier, each connection to a router should have its own network segment and this is shown in the diagram.

The CCNA certified network administrator also configured R1’s and R3’s serial interfaces as the DCE and all other configurations are correct.

In this scenario, R1 can ping HOST A, R1 can ping R2 s0/0/0 interface but not interface s0/0/1.

R3 can ping HOST B, R3 can ping R2’s s0/0/1 interface ONLY. HOST A and HOST B cannot communicate. As shown in the exhibit below.

Ping Results
Ping Results

In this chapter, we will explain the reasons as to why these two computers cannot communicate and as CCNET certified or CCNA certified administrators we will be able to resolve this problem.

KEEP THIS TOPOLOGY IN MIND AS IT WILL BE USED THROUGHOUT THIS CHAPTER.

Directly Connected Networks

CCENT/CCNA Show IP Route Output
CCENT/CCNA Show IP Route Output

As you can see in the figure, the show ip route command which is a handy CCNA troubleshooting command reveals on R1 the content of the routing table. As we learnt from the previous chapter; A routing table is a data structure used to store routing information acquired from different sources. The main purpose of a routing table is to provide the router with paths to different destination networks.

The routing table consists of a list of “known” network addresses – that is, those addresses that are directly connected, configured statically, and learned dynamically.

Since no other configuration has been made on these routers, R2 and R3, should only have directly connected routes.

When a router only has its interfaces configured, and the routing table contains the directly connected networks but no other routes, only devices on those directly connected networks are reachable.

This means that;

  • Host A can ping R1
  • R1 can ping R2’s s0/0/0 interface but not interface s0/0/1
  • R2 can ping R1’s s0/0/0 interface but not interface fa0/0 or HOST A
  • R2 can ping R3’s s0/0/0 interface but not interface fa0/0 or HOST B
  • R3 can ping R2’s s0/0/1 interface but not interface s0/0/0
  • HOST B can ping R3.
  • Neither hosts can ping each other
  • R1 and R3 cannot ping each other.

The figure shown below shows all the directly connected networks.

CCENT/CCNA Directly Connected Networks
CCENT/CCNA Directly Connected Networks

Static Routing

In your CCNA studies you will find that static routes are commonly used when routing from a network to a stub network.

A stub network is a network accessed by a single route.

In the above scenario, the 192.168.1.0/24 and 192.168.4.0/24 networks are stub networks. This means that for hosts in these network segments only have one way to communicate with other hosts, which is R1 and R3 for the 192.168.1.0/24 and 192.168.4.0/24 networks respectively.

Understanding stub networks is crucial in understanding static routing.

The command needed to configure a static route is shown below.

Router(config)# ip route (network-address) (subnet-mask) (next-hop ip address/ exit interface)

The table below explains the meaning of each of the parameters in the ip route command as well as an example of the command which would be used on R1 to configure a static route to R3’s LAN network (192.168.4.0/24).

Parameter Meaning example
Ip route State that the route being configured is a static route Ip route
Network-address The network address of the destination network. This is the network I am trying to reach. 192.168.4.0
Subnet-mask The network address of the destination network that I am trying to reach 255.255.255.0
Next hop ip address This is the ip address of the router that is connecting me to the desired network 192.168.2.4
Exit interface This is the exit point interface on my router that connects to the router that will take me to the desired network s0/0/0

Refer to the exhibit. Therefore to configure a static route on R1 for network 192.168.4.0/24, the command to be issued on R1 is:

R1(config)# ip route 192.168.3.0 255.255.255.0 192.168.2.4

R1(config)# ip route 192.168.4.0 255.255.255.0 192.168.2.4

OR

R1(config)# ip route 192.168.3.0 255.255.255.0 s0/0/0

R1(config)# ip route 192.168.4.0 255.255.255.0 s0/0/0

NOTE: When configuring static routes you should only use either the exit interface or the next hop ip address and not both. This will be explained later.

EXAMINE THE ROUTING TABLE ON R1:

R1#show ip route

Codes: C – connected, S – static, I – IGRP, 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

C    192.168.1.0/24 is directly connected, FastEthernet0/0

C    192.168.2.0/24 is directly connected, Serial0/0/0

S    192.168.4.0/24

[1/0] via 192.168.2

Highlighted in red at the bottom of the show ip route output on R1, is the static route that we just added. The “S” at the beginning means that the routing table got this route as a result of a static route configuration.

In the brackets, “1”, is the administrative distance for static routes, and “0” is the metric. This was explained in the CCNA chapter on understanding the routing table .

From this we can assume that pings from HOST A to HOST B should work. Right?

Let’s try a ping from HOST A TO HOST B and see what happens.

HOSTA>ping 192.168.4.2

Pinging 192.168.4.2 with 32 bytes of data:

Request timed out.

Request timed out.

Request timed out.

Request timed out.

Ping statistics for 192.168.4.2:

Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

As you can see from the exhibit above, all four pings to HOST B are shown as request timed out. Further, highlighted in red at the bottom, no packets were received by HOST B. this means that they could not communicate.

In the next section, we will explore why the two hosts could not communicate yet R1 was correctly configured with a static route.

CCNA Routing Table Principles

There are three CCENT/CCNA routing table principles that dictate how routers communicate.

Principle 1:

Every router makes its decision alone, based on the information it has in its own routing table.”

R1 has 2 routes 192.168.3.0/24 which is the connection between R2 and R3, and 192.168.4.0/24, which is the network on which HOST B is located. Therefore, based on the first principle, R1 will make its forwarding decisions based on this information only. It will not consult R2 or R3.Nor does it know whether or not those routers have routes to other networks. As a network administrator, it is your responsibility to make sure that all the routers in a network know about remote networks.

Principle 2:

“The fact that one router has certain information in its routing table does not mean that other routers have the same information.”

R1 does not know what information other routers have in their routing table. For example, R1 has a route to the 192.168.4.0/24 network through router R2. Any packets that match this route belong to the 192.168.4.0/24 network and will be forwarded to router R2. R1 does not know whether or not R2 has a route to the 192.168.4.0/24 network. Again, you are responsible as the network administrator, for ensuring that the next-hop router also has a route to this network.

Using Principle 2, we still need to configure the proper routing on the other routers (R2 and R3) to make sure that they have routes to these three networks.

Principle 3:

“Routing information about a path from one network to another does not provide routing information about the reverse, or return path.”

Most of the communication over networks is bidirectional. This means that packets must travel in both directions between the end devices involved. A packet from HOST A may reach HOST B because all the routers involved have routes to the destination network 192.168.2.0/24. However, the success of any returning packets going from HOST B to HOST A depends upon whether or not the routers involved have a route to the return path, HOST A’S 192.168.1.0/24 network.

Using Principle 3 as guidance, we will configure proper static routes on the other routers to make sure they have routes back to the 192.16.1.0/24 network.

Applying the principles:

In this scenario, we need to apply all the three principles on all the routers so that the static routes can work.

Principle 1

R1 knows how to get to network 192.168.3.0/24, and network 192.168.4.0/24, however, R2 and R3 do not know how to get there. Therefore, we need to configure a static route on R2 so that it can know how to get to 192.168.4.0/24.

Principle 2

We configured a static route on R1, however, this does not mean that R2 knows a path to 192.168.4.0/24 network. Therefore this router needs to know about that network.

Principle 3

Even though R1 and R2 have a route to network 192.168.4.0, a ping would still fail because   both R2 and R3 would not know how to get to R1. Therefore, we need to configure a route that gets back to network 192.168.1.0/24 on R1.in this case we are using the next-hop ip address on both R2 and R3.

From this. We can now make the necessary configurations on all the routers to make communication between HOST A and HOST B possible.

On router R2:

R2(config)# ip route 192.168.1.0 255.255.255.0 192.168.2.3

R2(config)# ip route 192.168.4.0 255.255.255.0 192.168.3.3

On router R3:

R3(config)# ip route 192.168.1.0 255.255.255.0 192.168.3.4

R3(config)# ip route 192.168.4.0 255.255.255.0 192.168.3.4

When all the configurations have been made on all the three routers, communication between HOST A and HOST B should be possible. The figure below shows the routing tables of all the three routers, the static routes have been highlighted in red.

R1:

R1#show ip route

Codes: C – connected, S – static, I – IGRP, 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

* – candidate default, U – per-user static route, o – ODR

Gateway of last resort is not set

C    192.168.1.0/24 is directly connected, FastEthernet0/0

C    192.168.2.0/24 is directly connected, Serial0/0/0

S    192.168.3.0/24 [1/0] via 192.168.2.4

S    192.168.4.0/24 [1/0] via 192.168.2.4

R2:

R2#show ip route

Codes: C – connected, S – static, I – IGRP, 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

* – candidate default, U – per-user static route, o – ODR

Gateway of last resort is not set

S    192.168.1.0/24 [1/0] via 192.168.2.3

C    192.168.2.0/24 is directly connected, Serial0/0/0

C    192.168.3.0/24 is directly connected, Serial0/0/1

S    192.168.4.0/24 [1/0] via 192.168.3.3

R3:

R3#show ip route

Codes: C – connected, S – static, I – IGRP, 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

* – candidate default, U – per-user static route, o – ODR

P – periodic downloaded static route

Gateway of last resort is not set

S    192.168.1.0/24 [1/0] via 192.168.3.4

S    192.168.2.0/24 [1/0] via 192.168.3.4

C    192.168.3.0/24 is directly connected, Serial0/0/0

C    192.168.4.0/24 is directly connected, FastEthernet0/0

As a result of this output. We should be able to ping from HOST A to HOST B. the output below shows the results of the ping from HOST A to HOST B.

HOSTA>ping 192.168.4.2

Pinging 192.168.4.2 with 32 bytes of data:

Reply from 192.168.4.2: bytes=32 time=20ms TTL=125

Reply from 192.168.4.2: bytes=32 time=21ms TTL=125

Reply from 192.168.4.2: bytes=32 time=16ms TTL=125

Reply from 192.168.4.2: bytes=32 time=16ms TTL=125

Ping statistics for 192.168.4.2:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 16ms, Maximum = 21ms, Average = 18ms

The output shows that there are replies coming from HOST B which has the ip address 192.168.4.2, the highlighted section in red shows that 4 packets were sent and all 4 were received by HOST B, with 0% loss.

Therefore, we have successfully configured static routing on the routers.

Resolving the next- hop ip address

The next concept you need to understand as a CCNA is the next hop ip address concept.  Suppose we configured R2 with the next-hop ip address not an exit interface, how would the router know which interface to send the packets through?

Refer to the output of the show ip route command on R2, below.

R2#show ip route

Codes: C – connected, S – static, I – IGRP, 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

* – candidate default, U – per-user static route, o – ODR

Gateway of last resort is not set

S    192.168.1.0/24 [1/0] via 192.168.2.3

C    192.168.2.0/24 is directly connected, Serial0/0/0

C    192.168.3.0/24 is directly connected, Serial0/0/1

S    192.168.4.0/24 [1/0] via 192.168.3.3

When the router wants to send a packet to the 192.168.1.0 network, it will look at the routing table.

There is a route to that network via 192.168.2.3. Then the router checks to see whether it has an interface that to the 192.168.2.3 network. In this scenario, that would be the network highlighted in blue. The exit interface is serial 0/0/0.

Every route that references only a next-hop IP address, and does not reference an exit-interface, must have the next-hop IP address resolved using another route in the routing table that has an exit interface.

Typically, these routes are resolved to routes in the routing table that are directly connected networks, because these entries will always contain an exit interface.

Resolving an exit-interface by the router is a recursive lookup.

It is recommended that static routes have an exit interface as opposed to the next hop ip address.

Summary and Default Routes

Hopefully when you are CCNA certified and you are working for a large company that will have a router that has more than 1 LAN connected to it. It would be more practical to use an address that covers all the LANS, and configure 1 static route. Take this scenario, R1 has 5 LANs connected to it;

  • 192.168.1.0/24
  • 192.168.2.0/24
  • 192.168.3.0/24
  • 192.168.4.0/24
  • 192.168.5.0/24

Summarizing these routes is shown in the table below.

Network address Octet 1 Octet 2 Octet 3 Octet 4
192.168.1.0/24 11000000 10101000 00000 001 00000000
192.168.2.0/24 11000000 10101000 00000 010 00000000
192.168.3.0/24 11000000 10101000 00000 011 00000000
192.168.4.0/24 11000000 10101000 00000 100 00000000
192.168.5.0/24 11000000 10101000 00000 101 00000000

The first 2 octets and the first 6 bits from the left, in the third octet.

Therefore the new summary network address and subnet mask for the 5 networks will be: 192.168.0.0/21 with the subnet mask as 255.255.248.0.

When configuring a static route to the summary network out serial0/0/0 on R2, the command would be;

R2(config)# ip route 192.168.0.0 255.255.248.0 s0/0/0

Refer to the exhibit shown below. Suppose HOST A wants to send an email to a friend or wants to view a website on the internet, how would the router know where to send the packets?

CCENT-CCNA Internet Route
CCENT-CCNA Internet Route

The internet has many ip addresses, and configuring one static route to a specific network would not work. Therefore, a default route is needed.

A default static route is a route that will match all packets. Default static routes are used:

When no other routes in the routing table match the packet’s destination IP address. In other words, when a more specific match does not exist. A common use is when connecting a company’s edge router to the ISP network.

When a router has only one other router to which it is connected. This condition is known as a stub router.  This is a term you definitely want to be familiar with for your CCENT or CCNA exam.

The syntax for configuring a static default route is:

Router(config)# ip route 0.0.0.0 0.0.0.0 [next-hop ip address/ exit interface]

A route to this network would tell the router to forward any packet for which it does not have a route to the indicated next-hop ip address or exit interface.

In this scenario, to configure a default static route, the command sequence on R1 would be.

R1(config)# ip route 0.0.0.0 0.0.0.0 12.145.3.2

Or

R1(config)# ip route 0.0.0.0 0.0.0.0 s0/0/0

CCNA Static Routing Summary

In this CCENT/CCNA chapter we have learnt how a router finds a path to a remote network, we have configured static routes using the principles of the routing table, learnt about the recursive lookup, as well as configured summary routes and default static routes.

In the next chapter, we will get into the world of dynamic routing protocols.  But in the meantime if you want to start studying your CCENT and CCNA concepts on the best home lab setups, check out what we have to offer below!

CertificationKits CCENT & CCNA Lab Certification Kits