Configuring Static Routing

Home /

Table of Contents

You connected your and Hermione’s networks to Ron’s network in the previous tutorial. Hermione then went home and set up her own network. You must now connect the three networks – yours, Hermione’s, and Ron’s. To build large networks, routers must communicate with one another.

One straightforward approach is to place a router between each network pair.

image 2 - Configuring Static Routing

There’s an issue with this configuration. An IP address is a string of numbers separated by periods. IP addresses are expressed as a string of four numbers, such as 192.158.1.38. Each number in the set can have a value ranging from 0 to 255. As a result, the full IP addressing range is 0.0.0.0 to 255.255.255.255. We cannot have an IP address where an octet is greater than 255.

image 3 - Configuring Static Routing

To resolve this problem, we must reconfigure the network. While we’re at it, we’ll reconfigure the other networks for our convenience. Network administrators constantly configure and reconfigure networks.

Our reconfigured networks are depicted in the diagram below.

image 4 - Configuring Static Routing

Issues with Default Gateway Assignment

If we try to implement this in Cisco Packet Tracer, we get something like this.

OZsYLxkgD6xcjsEY4MGY8sBF4ZsKwP9wGYQbh04I2 Tuuij876v61f cdYBjK87cx - Configuring Static Routing

Note that it will be Hermione’s Network instead of Sam’s Network in the above diagram.

Can you identify the issues with this implementation?

The first issue is assigning the default gateways to the end devices. A default gateway allows devices from one network to communicate with devices from another network. A network’s clients all point to a default gateway, which routes their traffic. This traffic is routed from the local subnet to devices on other subnets by the default gateway device. If there is a network problem or you want to make changes to the router, you’ll need to know the IP address of the default gateway.

For example, suppose you want to send a file from your network’s PCO to Sam’s network’s PC4. Router3 will be used to send the data. As a consequence, the PCO will have a default gateway set to the IP address of the GigabitEthernet0/0 interface of Router3: 192.168.100.2.

Later, Ron called and asked you to send him another file. This time Router1 will be used to send data to Ron’s network. As a consequence, the PCO will have a default gateway set to the IP address of the GigabitEthernet0/0 interface of Router1: 192.168.100.1.

Every time you need to send network traffic from one network to another, you’d have to change the default gateway (in the device you are using to send the traffic). This may not seem like a big deal if your network is connected to two other networks and you only have a few devices connected to your network.

However, if you need to connect to 10 or 20 other networks, this approach is inefficient. It is not a good implementation in practice. Aside from having to change the default gateway every time you need to send network traffic to another network, this method is also very expensive. If you want to connect 20 networks to your network, you’ll need 20 routers. You will also need to run a cable to each network you wish to connect to. Yes, you can split the cost amongst yourselves, but it is still very expensive. Furthermore, you must manage all of the connections yourself.

You guessed correctly. We will not connect the networks in this manner. We will seek out more efficient implementations.

More Efficient Network Implementation

The diagram below depicts the approach we will take to connect our networks.

fq60EcXjKC6N4JoxW4Mk19INJrM6 2wiLmZOdqo17NWIn6H3vOuee0KoG8tra8pyleZdMAGXjCvjymuTTqEIV whdA5nU5tt0aCRlX6t - Configuring Static Routing

We will only need two routers in this approach to connect three networks. Furthermore, we will not need to run cable from one network to each network we are attempting to connect.

We made the wise decision to run cables to all of the various networks. Each network is directly connected to at least one other network and is indirectly linked to all of them via a web of cables.

nEBrlHvBm pcSE BRit4lZhN74q1CbJi1kLVWlKMCVSsyscYI746JGS1C tcrmCGbRM1POsszeG1xMlWTwbTfcM7mlSaMEWc56ONrXbu8pR6jITvvsI0Zs06ftLgTRKOTvI LZmcBBIKVwS4xrDjCqHVoX 3U7v1YhrfmFPJEk8k6IYl34Olk aV9DlCrQ - Configuring Static Routing

The router’s job, as you may know, is to forward packets from the source device to the destination device. There could be several routers in between. To forward these packets, the router consults a database known as the routing table.

In previous tutorials, we connected a router to a computer and used ping to test communication. However, consider the topology depicted in the diagram below. We set it up in the Cisco Packet Tracer.

e756RR3x2g7nKtvTUfc1ffY4N8jRTuQhDECr0IYIUmm gnSZo ylNd6QWbLLMfJ5M1a2jJK0Xx 03tMmqI c9SWsiSdOYMCOI53tDs58eZlO96EbxVcMhauybT1RU10nrpEUJscoXeRTnaGSeeNH eS2K3Y0u2TvlzKN BoZ99qz31qrJG PiOR2G1FFGw - Configuring Static Routing

All of the arrows are green, indicating that the networks are physically and logically connected.

The network administrator also configured the serial interfaces on R1 and R3 as the DCE, and all other configurations are correct.

In this scenario, Router0 can ping HOST PC0 and Router2’s (notice we put the Router 2 in the middle) GigabitEthernet0/0 interface, but not GigabitEthernet0/1 interface.

Your network’s router can send packets to the networks to which it is directly connected. But it cannot communicate with any of the other networks to which it is only indirectly connected.

Direct and Indirect Network Connections

In this tutorial, we will explain why these two computers can’t communicate and how to fix the problem.

Let us first look at why the two computers are unable to communicate.

Routing tables instruct routers on where to route packets.

When routers are not directly connected, they must know how to send packets to the other router. They get this information from routing tables, which are stored in the router’s memory. A route table is a collection of rules that determine where network traffic from your subnet or gateway is routed.

Remember that routers are like small computers in that they have memory, a processor, and an operating system.

A route specifies a path for sending packets through the Internet network to another network’s address. A route defines only the path segment from one host to a gateway that can forward packets to a destination (or from one gateway to another).

The routing table is a database that stores information about various networks. As previously stated, these remote networks can be learned via routing protocols or manually configured routes.

We can see routes in the table using the show command.

To view the route table on a router, use the show command. On a typical router, such as a Cisco, the show ip route command would be used.
For instance, if you type show ip route in Router2 in your previously configured router, you will see the following:


Router>enable
Router#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.101.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.101.0/24 is directly connected, GigabitEthernet0/0/0
L       192.168.101.2/32 is directly connected, GigabitEthernet0/0/0
     192.168.102.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.102.0/24 is directly connected, GigabitEthernet0/0/1
L       192.168.102.1/32 is directly connected, GigabitEthernet0/0/1

The output of the “show ip route” command on a router displays the routes that a specific router can reach. A router will only know about directly connected routes by default.

Let’s look at what the routing table’s contents actually mean.

Each line represents a different route

The Role of Routers in Packet Forwarding

The route table functions as a router’s address book. It looks up the destination IP address of a packet in its routing table. It sends the packet to the correct location based on that lookup.

Each line in the routing table is divided into two parts. The first part is a letter that describes how the route was established. The second part instructs the router on how to reach the route. The router constantly updates the route table so that it knows where to send packets.

jNNq8tHgaotFafw k8lLoYVWLNUhNobRzII4B8rAz0yFl JyWoXOLRlOxB2P6zn9ndllflNJLdPzbgXk uoC9J7vIt6IiDFWxH4tXun8 zJkVA91EFc yprgkweTnXSEUIIb5IZx YrImC2LujMqvhH26PSLWgYR2Smy - Configuring Static Routing

The letter tells you how the route gets in the routing table, but what do the letters mean?

Routes in a table are derived from a variety of sources.

Simply typing routes into a table is the quickest way to get them into a table. Those are called static routes because they don’t change unless you change them.

When you assign an IP address to an interface, an entry is created in the routing table for that IP network. These are the routes with a C in front of their table entry that are directly connected. Hand-entered routes are static and have a S in front of them. Finally, learned routes have different letters depending on how the route was learned.

Let us first discuss directly connected routes before discussing and adding a static route.

In our scenario, directly connected routes from Router0’s perspective are the network connected to HOST PC0 and the network connecting Router0 and Router2.

q9SMz YtbJSut 0zeIHSBonZOqqJsrcqGek1HN0z1bBSDztcd94ua6qJJXFZT K6lUE0SPblotT7qVFa9K1Z5G12ScR8NbglK2acd 9HQPuvO sIXk2VtQVWufBqNe78ry5lvmGWtlRrFRNS1wjzbX2bs5dRhH9omWSK08Z6syIwADXVlzz16mMHhTDfpA - Configuring Static Routing

Router2 and Router1 should only have directly connected routes because no other configuration has been made on these routers.

The only networks that can be reached by a specific router are those that are directly connected. In our scenario, this means that

In our scenario, directly connected routes from Router0's perspective are the network connected to HOST PC0 and the network connecting Router0 and Router2.
 
Host PC0 can ping Router0
Router0 can ping Router2’s GigabitEthernet0/0/0 interface but not interface GigabitEthernet0/0/1
Router2 can ping Router0’s GigabitEthernet0/0/1 interface but not interface GigabitEthernet0/0/0 or HOST PC0
Router2 can ping Router1’s GigabitEthernet0/0/0 interface but not interface GigabitEthernet0/0/1 or HOST PC1
Router1 can ping Router1’s GigabitEthernet0/0/1 interface but not interface GigabitEthernet0/0/0
HOST PC0 can ping Router1.
Neither hosts can ping each other
Router0 and Router1 cannot ping each other.

Use the ping command on each router and host. It will provide you with more information.

Now let us discuss static routing.

Static routing is one method of communicating with remote networks. We use static routing in production networks mainly to configure routes from a particular network to a stub network.

Stub networks are those that can only be accessed via a single point or interface. 

The 192.168.100.0/24 and 192.168.103.0/24 networks in the preceding scenario are stub networks. This means that hosts in these network segments only have one way to communicate with other hosts, which is Router0 for the 192.168.100.0/24 network and Router1 for the 192.168.103.0/24 network.

Understanding stub networks is essential for grasping static routing.

The command required to set up 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 parameter in the ip route command and provides an example of a command that would be used on Router0 to configure a static route to Route1’s LAN network (192.168.103.0/24).

ParameterMeaningExample
Ip routeDeclare that the configured route is a static route.ip route
Network-addressThe destination network’s network address. This is the network you are attempting to connect to.192.168.101.0
Subnet-maskA 32-bit address that divides an IP address into network bits that identify the network and host bits that identify the host device that is connected to that network.255.255.255.0
Next hop ip addressThis is the router’s ip address, which connects me to the desired network.192.168.100.1
Exit interfaceThis is your router’s exit point interface, which connects to the router that will take you to the desired network.GigabitEthernet0/1

How Do We Enter Routes?

The first step is to establish a connection to the router. You can connect to the router using a serial cable or ssh into it over the network.

1. Run the command enable from the router's console.

This switches the router into privileged mode. You may well certainly require a password.

2. Run the command config terminal from the router's console.

This activates the router’s configuration mode.

3. Type ip route 192.168.102.0 255.255.255.0 eth0/1 192.168.101.1

This command adds a static route to the route table for the 192.168.102.0 network. This network is accessible via the eth0/1 interface, and the router capable of dealing with it is 192.168.101.1.

4. Type exit

This exits the router from configuration mode.

5. Type write memory

This saves our new configuration to memory.

Routes assist routers in determining where to send network traffic. As a consequence, you must enter all of the network addresses to which you want your router to be able to send traffic.
Q: I can't possibly enter all of the world's networks into my router's table.

You must configure a default gateway. This is another router’s location where your router sends all traffic that it does not know where to send.

Take a look at the diagram below.

UHd85ykT7goCeYnL9q8o5Xn6YyzRKqU9oWOuB8YB3e5cwmOuPDV2a4ViGYAdLenUxWcOuUAx6eYiJUC 88KqeRcy SQduMsVzJ2an nu7 tmSC - Configuring Static Routing

To configure a static route on Route0 for network 192.168.103.0/24, issue the following command on Router0:

Router(config)# ip route (network-address) (subnet-mask) (next-hop ip address/ exit interface)
 
Router0(config)# ip route 192.168.102.0 255.255.255.0 192.168.101.2
 
Router0(config)# ip route 192.168.103.0 255.255.255.0 192.168.101.2

OR

Router0(config)# ip route 192.168.102.0 255.255.255.0 GigabitEthernet0/0/0
 
Router0(config)# ip route 192.168.103.0 255.255.255.0 GigabitEthernet0/0/1

NOTE: When configuring static routes, only the exit interface or the next hop IP address should be used, not both. This will be explained further below.

CHECK THE ROUTING TABLE ON Router0:

Router#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.100.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.100.0/24 is directly connected, GigabitEthernet0/0/0
L       192.168.100.1/32 is directly connected, GigabitEthernet0/0/0
     192.168.101.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.101.0/24 is directly connected, GigabitEthernet0/0/1
L       192.168.101.1/32 is directly connected, GigabitEthernet0/0/1
S    192.168.102.0/24 is directly connected, GigabitEthernet0/0/1
S    192.168.103.0/24 is directly connected, GigabitEthernet0/0/1

The static route that we just added appears at the bottom of the show ip route output on Router1. The “S” at the beginning indicates that this route was obtained by the routing table as a result of a static route configuration.

We can conclude that pings from HOST PC0 to HOST PC1 should work. Right?

Let’s see what happens if we send a ping from HOST PC0 to HOST PC1.

IxYvstb818lDVnCd7Q5gH7Qk8frrUeJQJmISXDYRevhVX61gBzL0Vc8tAIxnqmbeg0pV1kQQmtFj060N U4V2fgv1VBaf1nRZ30ruNWDtjaT2k4EHpgIfF3B - Configuring Static Routing

All four pings to HOST PC1 are displayed as request timed out. Furthermore, HOST PC1 received no packets. This means they were unable to communicate.

In the following section, we’ll look at why the two hosts couldn’t communicate despite Router0 being properly configured with a static route.

Limitations of Indirect Network Connections.

Three routing table principles govern how routers communicate with one another. These principles are from Alex Zinin’s book, Cisco IP Routing.

  • 1. Every router makes its decision alone, based on the information it has in its own routing table.
  • 2. The presence of certain information in one router’s routing table does not imply that other routers have the same information.
  • 3. Routing information about a path from one network to another does not provide routing information about the reverse, or return, path.

Principle 1: Routers ONLY forward packets based on information in their routing tables.

Router0 has two routes: 192.168.102.0/24, which connects Router0 and Router2(remember to imagine a network cloud between the routers) and 192.168.103.0/24, which is the network where HOST PC1 is located. Router0 will make forwarding decisions solely on the basis of the first principle. Router0 forwards the packet destined for PC1 to router Router2 after making its routing decision. Router1 is only aware of the information in its own routing table, indicating that Router2 is the next-hop router. Router0 has no idea whether or not Router2 has a route to the destination network. Router1 and Router2 will not be consulted by Router0. Router0 has no idea whether those routers have routes to other networks.

It is your responsibility as a network administrator to ensure that all routers in a network are aware of remote networks.

Principle 2: The presence of routing information on one router does not imply that all routers in the domain have the same information.

Router0 has no information about R2’s routing table. The same can be said of Router2 and Router1.  As a direct consequence, Router0 having a path to the networks connected to Router2 and Router1 does not imply that Router2 and Router1 have the same information.

For example, Router0 can connect to the network 192.168.102.0/24 on Router1 via Router2. Router1 does not know and does not care whether Router2 can connect to the network connected to Router1. As a consequence, we must configure routes from Router2 to the LAN connected to Router1. 

Using Principle 2, we must still configure proper routing on the other routers (Router2 and Router1) to ensure they have routes to these three networks.

Principle 3: Routes to a remote network on a router do not imply that the remote router has return paths.

This principle states that when one router is configured a route, the remote router must also be configured a return route. The majority of communication in our networks is bidirectional, which means that for every message we send, we expect a response.

Using the post office analogy, it would be similar to sending a letter without a return address. Without a return address, the recipient cannot respond to a letter, and the postman does not know where to send the reply.

In our scenario, this means that when we configure a route to network 192.168.103.0/24 on Router0, we should configure a route on the remote routers that leads to the LANs connected to Router0. 

Router Router2 successfully forwarded the packet to PC1’s destination network. However, Router2 dropped the packet from PC1 to PC0. Although Router2 has information about PC1’s destination network in its routing table, we don’t know if it has information about the return path back to PC0’’s network.

We will configure proper static routes on the other routers using Principle 3 to ensure they have routes back to the 192.168.100.0/24 network.

Let us now put the three routing table principles into practice.

Principle 1

Router0 knows how to connect to networks 192.168.102.0/24 and 192.168.103.0/24; however, Router2 and Router1 do not. We need to configure the routers routing table.

Principle 2

Although we configured a static route on Router1, this does not imply that Router2 has a path to the 192.168.103.0/24 network. This router must be aware of the network.

We must configure a static route on Router2 so that it knows how to reach 192.168.103.0/24. We do not need to configure Router1 as it is already connected to Host PC1’s network.

Use to following command in the console of the Router2:

Router>enable
Router#config terminal
Router(config)# ip route 192.168.103.0 255.255.255.0 192.168.101.2

OR

Router>enable
Router#config terminal
Router(config)# ip route 192.168.103.0 255.255.255.0 GigabitEthernet0/0/1

Principle 3

Even if Router0 and Router2 have a route to network 192.168.103.0, a ping would fail because Router2 and Router1 would not know how to reach Router0. We must configure a route that returns to network 192.168.100.0/24 on Router0. In this case, the next-hop IP address is used on both Router2 and Router1.

Use to following command in the console of the Router2:

Router>enable
Router#config terminal
Router(config)# ip route 192.168.100.0 255.255.255.0 GigabitEthernet0/0/0


OR

Router>enable
Router#config terminal
Router(config)# ip route 192.168.100.0 255.255.255.0 192.168.101.1

Use to following command in the console of the Router1:

Router>enable
Router#config terminal
Router(config)# ip route 192.168.100.0 255.255.255.0 GigabitEthernet0/0/0
Router(config)# ip route 192.168.101.0 255.255.255.0 GigabitEthernet0/0/0

OR

Router>enable
Router#config terminal
Router(config)# ip route 192.168.100.0 255.255.255.0 192.168.102.1
Router(config)# ip route 192.168.101.0 255.255.255.0 192.168.102.1 

Communication between HOST PC0 and HOST PC1 should be possible once all of the configurations on all three routers have been completed. The routing tables of all three routers are depicted in the figure below.

Router0:

Router>enable
Router#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.100.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.100.0/24 is directly connected, GigabitEthernet0/0/0
L       192.168.100.1/32 is directly connected, GigabitEthernet0/0/0
     192.168.101.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.101.0/24 is directly connected, GigabitEthernet0/0/1
L       192.168.101.1/32 is directly connected, GigabitEthernet0/0/1
S    192.168.102.0/24 is directly connected, GigabitEthernet0/0/1
S    192.168.103.0/24 is directly connected, GigabitEthernet0/0/1

Router2:

Router#enable
Router#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
 
S    192.168.100.0/24 is directly connected, GigabitEthernet0/0/0
     192.168.101.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.101.0/24 is directly connected, GigabitEthernet0/0/0
L       192.168.101.2/32 is directly connected, GigabitEthernet0/0/0
     192.168.102.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.102.0/24 is directly connected, GigabitEthernet0/0/1
L       192.168.102.1/32 is directly connected, GigabitEthernet0/0/1
S    192.168.103.0/24 is directly connected, GigabitEthernet0/0/1

Router1:

Router#enable
Router#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
 
S    192.168.100.0/24 is directly connected, GigabitEthernet0/0/0
S    192.168.101.0/24 is directly connected, GigabitEthernet0/0/0
     192.168.102.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.102.0/24 is directly connected, GigabitEthernet0/0/0
L       192.168.102.2/32 is directly connected, GigabitEthernet0/0/0
     192.168.103.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.103.0/24 is directly connected, GigabitEthernet0/0/1
L       192.168.103.1/32 is directly connected, GigabitEthernet0/0/1

Pinging from HOST PC0 to HOST PC1 should be possible. The results of the ping from HOST PC0 to HOST PC1 are shown below.

C:\>ping 192.168.103.101
 
Pinging 192.168.103.101 with 32 bytes of data:
 
Reply from 192.168.103.101: bytes=32 time<1ms TTL=125
Reply from 192.168.103.101: bytes=32 time<1ms TTL=125
Reply from 192.168.103.101: bytes=32 time<1ms TTL=125
Reply from 192.168.103.101: bytes=32 time=1ms TTL=125
 
Ping statistics for 192.168.103.101:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms

The output indicates that there are replies from HOST PC1, which has the IP address 192.168.103.101. Four packets were sent and all four were received by HOST PC1 with 0% loss.

We were able to successfully configure static routing on the routers.

Q: How would the router know which interface to send packets through if we configured Router2 with the next-hop ip address rather than an exit interface?

Let us begin by configuring Router2 with a next-hop IP address rather than an exit interface.

First, ensure that configuration mode is enabled. Enter the following commands in CLI to remove the previously configured routing table.

Router(config)#no ip route 192.168.103.0 255.255.255.0 GigabitEthernet0/0/1
Router(config)#no ip route 192.168.100.0 255.255.255.0 GigabitEthernet0/0/0

Next enter the following commands in CLI to add new static routes in the routing table.

Router(config)#ip route 192.168.103.0 255.255.255.0 192.168.102.2
Router(config)#ip route 192.168.100.0 255.255.255.0 192.168.101.1
Router(config)#exit

The show ip route command on Router2 is depicted in the diagram below.

uHAFdk2osd Y6RGP6gqvsFuJGHMsEGNjVuKj3dYRjV0jPMdlSb NgAiWo5etNATD9Ihzc FKdbzKCaiwL2tdBkoA UpB5en6XVynrCBddZIssYBYnnCpKqDLylJzPD tCDg0nUYOVDKGeyEyK2rCsd6pR6XyG1n1G843jLEkL89r9 14IoeDI G4 5WBvg - Configuring Static Routing

When a packet is needed to be sent to the 192.168.100.0 network, the router consults the routing table.

192.168.101.1 provides access to that network. The router then checks to see if it has an interface to the 192.168.100.0 network. That would be the network highlighted in the red in this scenario – GigabitEthernet0/0/0 is the exit interface.

As stated in cisco curriculum:

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.

In most cases, the next hop is resolved to a network that is directly connected.

As a consequence, this is typically an issue because the router must process a packet twice before deciding where to forward it. This is referred to as a recursive lookup.

When packet arrives destined for 192.168.100.101 recursive lookup in the Router2 will be done like this :

looks up entry for 192.168.100.101
192.168.100.101 >> via 192.168.101.1
looks up entry for 192.168.101.1
192.168.101.1 >> send packet through directly connected interface GigabitEthernet0/0/0.
end

It is recommended that static routes have an exit interface rather than the IP address of the next hop.

So are the networks now connected?

Let’s try sending a message from a computer at Network 192.168.100.100/24 to a computer on network 192.168.103.0/24 and see what happens.

3T73Aigpx1TrIAi - Configuring Static Routing

Or just use a ping program from PC0 to reach PC1.

Q: Does the routing table just contain IP addresses of routers? What about other devices?

Yes, it only contains IP addresses of other routers. Remember that the route table instructs the router on where to route network traffic to another network. As a consequence, it says “to send network traffic to network  X, you must send it through router V, which understands how to send traffic to network X”. A route table contains no other device addresses.

This is it for Static routing. Use your newly acquired knowledge to connect your network, Sam’s network, and Ron’s network.  

We’ll talk about dynamic routing in the next tutorial.

Share The Tutorial With Your Friends
Twiter
Facebook
LinkedIn
Email
WhatsApp
Skype
Reddit

Check Our Ebook for This Online Course

Advanced topics are covered in this ebook with many practical examples.

Other Recommended Article