Static Routing Configuration in Cisco Packet Tracer

Aisyah Aldina

Illustration of a map with fixed routes for a guide on static routing in Cisco Packet Tracer

Hi everyone, up to the previous article all of our networks still sat behind a single router. In the real world, a head office and a branch office usually each have their own router, and those two routers need to know how to reach the network on the other side. The most basic way to tell them is static routing, where the admin writes the route to every destination network by hand.

In this article I practice static routing with 2 routers, 2 switches, and 4 PCs in Cisco Packet Tracer 8.2.1. If you have never assigned IP addresses on a Cisco router before, read my guide on Cisco router configuration in Packet Tracer first.

The Topology and Cables Used

Add 2 routers, 2 switches, and 4 PCs

Cisco Packet Tracer window showing a static routing topology with 2 routers and 2 LANs

The devices I used are 2 Cisco 1941 routers, 2 Cisco 2960-24TT switches, and 4 PCs. The window above shows the whole topology in Cisco Packet Tracer.

Topology with two 1941 routers, two 2960 switches, and four PCs in LAN 1 and LAN 2

The green box is LAN 1 with the 192.168.1.0/24 network, and the yellow box is LAN 2 with the 192.168.2.0/24 network. Between the two routers there is a third network, 10.0.0.0/30, used only for the router to router link. A /30 prefix has just 2 usable IP addresses, which is exactly what you need for the two ends of one cable.

PC0 FastEthernet0      ->  Switch0 FastEthernet0/1     (straight)
PC1 FastEthernet0      ->  Switch0 FastEthernet0/3     (straight)
Router0 Gig0/0         ->  Switch0 GigabitEthernet0/1  (straight)
PC2 FastEthernet0      ->  Switch1 FastEthernet0/1     (straight)
PC3 FastEthernet0      ->  Switch1 FastEthernet0/3     (straight)
Router1 Gig0/0         ->  Switch1 GigabitEthernet0/1  (straight)
Router0 Gig0/1         ->  Router1 Gig0/1              (cross-over)

A cross-over cable between the routers

Cross-over cable from Router0 Gig0/1 to Router1 Gig0/1 in Packet Tracer

Router0 and Router1 are the same type of device, so the cable between them is Copper Cross-Over, which Packet Tracer draws as a dashed line. It runs from Gig0/1 on Router0 to Gig0/1 on Router1. The other cables, from the PCs to the switches and from the switches to the routers, use Copper Straight-Through because they connect different types of devices.

In a real lab, the link between routers often uses a serial cable. The 1941 router in Packet Tracer has no built in serial port, so I used the GigabitEthernet ports with a cross cable to avoid adding a module.

Here is the IP plan I used.

Router0 Gig0/0   192.168.1.1/24   (gateway LAN 1)
Router0 Gig0/1   10.0.0.1/30
Router1 Gig0/1   10.0.0.2/30
Router1 Gig0/0   192.168.2.1/24   (gateway LAN 2)
PC0  192.168.1.10   gateway 192.168.1.1
PC1  192.168.1.11   gateway 192.168.1.1
PC2  192.168.2.10   gateway 192.168.2.1
PC3  192.168.2.11   gateway 192.168.2.1

Configuring IP Addresses on Both Routers

Set the IP addresses on Router0

IP configuration of Gig0/0 and Gig0/1 on Cisco Router0

Open the Router0 CLI, answer no to the initial configuration dialog, then type the following commands.

enable
configure terminal
hostname Router0
interface gigabitEthernet0/0
ip address 192.168.1.1 255.255.255.0
no shutdown
exit
interface gigabitEthernet0/1
ip address 10.0.0.1 255.255.255.252
no shutdown
end

Gig0/0 becomes the gateway for LAN 1, while Gig0/1 becomes this end of the link to Router1. The subnet mask 255.255.255.252 is simply the long form of /30.

Set the IP addresses on Router1

IP configuration of Gig0/0 and Gig0/1 on Cisco Router1

Do the same on Router1 using the IP addresses for the other side.

enable
configure terminal
hostname Router1
interface gigabitEthernet0/0
ip address 192.168.2.1 255.255.255.0
no shutdown
exit
interface gigabitEthernet0/1
ip address 10.0.0.2 255.255.255.252
no shutdown
end

After no shutdown on Gig0/1 of Router1, you will see a line protocol up message. That means the router to router link is now up on both sides.

Set the IP and gateway on each PC

IP 192.168.1.10 and gateway 192.168.1.1 set on PC0 in Cisco Packet Tracer

Click PC0, open Desktop and then IP Configuration, and enter IP 192.168.1.10, subnet mask 255.255.255.0, and default gateway 192.168.1.1. Repeat this for the other PCs using the table above.

Warning: The Default Gateway field in Packet Tracer already contains 0.0.0.0. Clear it before typing the gateway, otherwise you end up with 0.0.0.0192.168.1.1 and get the message Invalid gateway address entered.

Ping Test Before Static Routing

Ping from LAN 1 to LAN 2 still fails

Ping from PC0 to PC2 failing with Destination host unreachable before static routing

Open the Command Prompt on PC0 and ping PC2.

ping 192.168.2.10

The result is Destination host unreachable, and that reply comes from 192.168.1.1, which is Router0. Router0 only knows its directly connected networks, 192.168.1.0/24 and 10.0.0.0/30. The 192.168.2.0/24 network lives behind Router1, so Router0 has no idea where to send the packet. This is exactly the problem static routing solves.

Configuring Static Routes

The command format is ip route, followed by the destination network, the destination subnet mask, and then the next hop. The next hop is the IP address of the neighboring router that acts as the doorway to the destination network.

Add a route on Router0

ip route command to 192.168.2.0 via 10.0.0.2 on Router0

On Router0, the destination is LAN 2 and the doorway is Router1 at 10.0.0.2.

configure terminal
ip route 192.168.2.0 255.255.255.0 10.0.0.2
end
write memory

Add the return route on Router1

ip route command to 192.168.1.0 via 10.0.0.1 on Router1

On Router1, the destination is LAN 1 and the doorway is Router0 at 10.0.0.1.

configure terminal
ip route 192.168.1.0 255.255.255.0 10.0.0.1
end
write memory

This return route is required. If only Router0 has a route, packets from PC0 do reach PC2, but PC2’s reply stops at Router1 because Router1 does not know the way back to 192.168.1.0/24.

Check the routing table

Output of show ip route static and connected on Router0

Go back to Router0 and run the following commands.

show ip route static
show ip route connected

The line starting with S is the static route to 192.168.2.0/24 via 10.0.0.2. The lines starting with C are the directly connected networks. Router0 now knows all three networks in the topology.

Testing Communication Between LANs

Ping and tracert from PC0 to PC2

Successful ping and tracert from PC0 to PC2 through two routers

Open the Command Prompt on PC0 again.

ping 192.168.2.10
tracert 192.168.2.10

The first ping after adding the routes usually times out once or twice because of ARP, and after that every reply comes back. TTL=126 shows that the packet passed through two routers. The tracert output shows the path: 192.168.1.1 (Router0), then 10.0.0.2 (Router1), and finally PC2.

Common Problems and How to Fix Them

Ping still shows Destination host unreachable

Check the route with show ip route static. Make sure the destination network and subnet mask are correct, and that the next hop is the neighboring router’s IP on the 10.0.0.0/30 network, not the router’s own IP.

Ping keeps showing Request timed out

Usually the return route on the other router has not been created yet. The packet reaches its destination, but the reply cannot find its way home. Add an ip route back to the source network on the other router.

The router to router link is down

Check the cable type and the ports. Router to router needs a cross-over cable, and both ends must be on ports that already have an IP address and no shutdown. Run show ip interface brief on both routers.

At this point the two LANs behind two routers can talk to each other using static routing. The downside is that every time a new network appears, we have to add routes by hand on every router. In the next article we will try RIP, a dynamic routing protocol that lets routers exchange route information on their own. If you run into any other error while trying this, just leave a comment below.

Leave a Comment