DEV Community

Khalif AL Mahmud
Khalif AL Mahmud

Posted on

Lab Task 1 - How I Connected Two Isolated Networks Using Static Routing in GNS3

Routing between networks seems like magic until you actually set it up yourself. I recently built a small simulated network where two virtual PCs on completely different subnets needed to talk to each other — with two routers in between and zero dynamic routing protocols.

This is a walkthrough of how I designed the topology, configured everything step by step, and verified it worked using ping.


The Problem

Imagine two computers on two different networks:

  • PC-01 is on 192.168.1.0/24
  • PC-02 is on 192.168.2.0/24

They can't reach each other by default — they're on separate networks. A router bridges them, but the router only knows about networks directly connected to it. If I want Router-01 to send packets to 192.168.2.0/24, I have to tell it how to get there. That's static routing.


Three separate networks, two routers, two end devices. Everything runs inside GNS3 — a free, open-source network simulator that runs real Cisco IOS images.

Network Topology


Tools Used

  • GNS3 — Network simulator
  • Cisco IOS — Router OS running inside GNS3
  • VPCS — Lightweight virtual PC (ping + IP assignment only)
  • Solar-PuTTY — Terminal to access router console

Step 1 — Configure Router-01

Right-click Router-01 in GNS3 → Console. This opens a terminal to the Cisco IOS CLI.

enable
configure terminal

interface f0/0
 ip address 192.168.0.1 255.255.255.0
 no shutdown

interface f0/1
 ip address 192.168.1.1 255.255.255.0
 no shutdown
 exit

ip route 192.168.2.0 255.255.255.0 192.168.0.2

end
write
Enter fullscreen mode Exit fullscreen mode

What each command does:

  • enable — enters privileged (admin) mode
  • configure terminal — enters global config mode
  • interface f0/0 — selects the interface
  • ip address — assigns an IP + subnet mask
  • no shutdown — activates the interface (Cisco defaults all interfaces to down)
  • ip route 192.168.2.0 255.255.255.0 192.168.0.2 — tells Router-01: "to reach 192.168.2.0, forward to 192.168.0.2 (Router-02)"
  • write — saves config to NVRAM so it survives a reboot


Step 2 — Configure Router-02

enable
configure terminal

interface f0/0
 ip address 192.168.0.2 255.255.255.0
 no shutdown

interface f0/1
 ip address 192.168.2.1 255.255.255.0
 no shutdown
 exit

ip route 192.168.1.0 255.255.255.0 192.168.0.1

end
write
Enter fullscreen mode Exit fullscreen mode

The static route here is the mirror: "to reach 192.168.1.0, forward to 192.168.0.1 (Router-01)." Both routes are needed — one for each direction.


Step 3 — Configure the Virtual PCs (VPCS)

VPCS uses a simple command to assign IP, subnet mask, and default gateway all at once:

# PC-01
ip 192.168.1.2 255.255.255.0 192.168.1.1
Enter fullscreen mode Exit fullscreen mode
# PC-02
ip 192.168.2.2 255.255.255.0 192.168.2.1
Enter fullscreen mode Exit fullscreen mode

The third argument is the default gateway — the router interface the PC will forward all off-subnet traffic to.


Step 4 — Verify with Ping

PC-01> ping 192.168.2.2
Enter fullscreen mode Exit fullscreen mode

First packet timed out — that's normal. The first ICMP packet triggers ARP resolution (finding the MAC address of the gateway), which takes a moment.

After that: four consecutive successful replies. ttl=62 confirms the packet passed through exactly 2 routers (VPCS starts at TTL 64, each hop subtracts 1: 64 - 2 = 62).

Then I tested the reverse direction:

PC-02> ping 192.168.1.2
Enter fullscreen mode Exit fullscreen mode

Both directions worked. Bidirectional routing confirmed.


What I Learned

  • Every router interface belongs to one subnet. You can't assign the same subnet to two interfaces on the same router.
  • Static routes are directional. Router-01 needs a route to reach 192.168.2.0, and Router-02 needs a route back to 192.168.1.0. Forget one — ping fails.
  • no shutdown is mandatory on Cisco. Interfaces are administratively down by default. This is a security feature — you explicitly enable what you need.
  • write saves your work. Running config lives in RAM. Reboot = lost config unless you write it to NVRAM.
  • TTL tells you hop count. A TTL of 62 on a VPCS ping means exactly 2 routers were in the path.
  • First ping timeout is normal. ARP hasn't resolved yet — not a routing failure.

Common Mistakes to Avoid

Mistake What Happens Fix
Forgot no shutdown Interface stays down, ping fails Add no shutdown after each IP assignment
Wrong next-hop IP in static route Route exists but packets go nowhere Make sure next-hop is directly reachable
Missing reverse route One-way ping only Add static route on both routers
Forgot to save with write Config lost after restart Always run write before closing
Wrong default gateway on PC PC can't reach router Gateway must match the router's connected interface IP

Conclusion

Static routing is the foundation of understanding how packets actually travel across networks. Once you've manually written the routes that tell each router where to forward packets — and seen a successful ping light up across two hops — the logic becomes intuitive.

This same principle scales to larger networks. The difference is just that in production, dynamic protocols (OSPF, BGP) automate what we did by hand here.

Top comments (0)