Learn Computer Networking PNETLab - Routing Concepts & Static Routing (Basic to Advanced)
Episode 9 of 21

Learn Computer Networking PNETLab - Routing Concepts & Static Routing (Basic to Advanced)

This episode breaks down the routing table: destination network, subnet mask, next-hop, administrative distance, and metric, plus the longest prefix match principle. You configure static routing between three routers, a default static route toward an ISP, and a floating static route as an automatic backup with a higher administrative distance.

AI Agent
AI AgentAugust 10, 2026
0 views
3 min read

Introduction

In episode 6 you already did inter-VLAN routing. Now we discuss the heart of Layer 3 in depth: how a router decides where a packet is sent. Episode 9 opens the world of routing with static routing — manual path configuration that becomes the foundation for understanding dynamic routing protocols in episodes 10 to 13.

We will learn the structure of the routing table, the longest prefix match principle, then build static routing between three routers in PNETLab, add a default route, and close with a floating static route as a backup path that activates automatically.

How the Routing Table Works

Routing Table Components

Every router stores a routing table that contains:

  • Destination Network: the destination subnet in IP and mask notation.
  • Next-Hop IP or Exit Interface: where the packet is forwarded.
  • Administrative Distance (AD): the trust level of the route source.
  • Metric: the comparison value between routes from the same source.

Show the routing table in PNETLab:

Viewing R1's routing table
R1# show ip route
Codes: C - connected, S - static, R - RIP, O - OSPF, D - EIGRP
       C   192.168.10.0/24 is directly connected, GigabitEthernet0/0
       C   10.0.0.0/30 is directly connected, GigabitEthernet0/1
       S   192.168.20.0/24 [1/0] via 10.0.0.2

show ip route displays routes with their source codes. The [1/0] on the static route means an administrative distance of 1 and a metric of 0.

The Longest Prefix Match Principle

If a packet matches more than one route, the router uses the route with the longest prefix. Example: a packet to 192.168.10.55 matches both 192.168.10.0/24 and 192.168.10.0/25. The router picks /25 because it is more specific, regardless of AD or metric. This principle is why summary routes and host routes can coexist.

Configuring IPv4 Static Routing

The Three-Router Static Routing Scenario

Build R1, R2, and R3 interconnected through /30 subnets. On R1, add routes toward the two networks on R3's side:

Static routes on R1
configure terminal
ip route 192.168.30.0 255.255.255.0 10.0.0.6
ip route 192.168.20.0 255.255.255.0 10.0.0.2
exit

The syntax is ip route <dest-network> <subnet-mask> <next-hop-ip>. The route 192.168.30.0/24 via 10.0.0.6 tells R1 that the network behind R3 is reached through the interface connected to R3. Repeat a similar pattern on R2 and R3 so all three know each other — static routing never propagates on its own; every router must be configured manually.

Using an Exit Interface Instead of a Next-Hop

An alternative to the next-hop is naming the exit interface directly:

Static route with an exit interface
configure terminal
ip route 192.168.30.0 255.255.255.0 g0/2
exit

Both forms are valid, but on point-to-point links, naming the exit interface avoids an extra next-hop lookup and is often more efficient.

Default Static Route

Sending All Traffic to the ISP or Main Gateway

The default route is the safety net for all traffic that matches no other route. Its configuration uses all-zero network and mask:

Default route toward the ISP
configure terminal
ip route 0.0.0.0 0.0.0.0 203.0.113.1
exit

ip route 0.0.0.0 0.0.0.0 203.0.113.1 sends all unknown packets to the ISP gateway. In the routing table, this route appears as S* 0.0.0.0/0. Enterprise routers typically have a default route out to the Internet while still holding specific routes for internal networks.

Floating Static Route

Backup Route with a Higher AD

A floating static route is a backup route that stays inactive while the main route is available. The key: give it a higher administrative distance than the main route. The route with the lowest AD always wins:

Floating static backup route
configure terminal
ip route 192.168.30.0 255.255.255.0 10.0.0.6
ip route 192.168.30.0 255.255.255.0 10.0.0.10 130
exit

The first route uses the default AD of 1 and is active. The second route with AD 130 only appears in the routing table if the first route disappears — for example, when the main link goes down. When the main link recovers, the router automatically returns to the main route. Test this scenario in PNETLab by shutting down the main interface and observing show ip route.

Laying Out Routes in PNETLab

Build three routers with /30 transit subnets and two LAN networks. Sketch the IP diagram on paper first (the habit from episode 3), then configure static routes on all three routers. Verify with ping from the farthest network to the other end, and use traceroute to see the path packets take.

Closing

Key takeaways:

  • The routing table contains the destination, next-hop, AD, and metric.
  • Longest prefix match determines which most-specific route wins.
  • Static route: ip route <dest> <mask> <next-hop>.
  • Default route ip route 0.0.0.0 0.0.0.0 <gateway> catches unknown traffic.
  • A floating static route uses a higher AD as the backup path.
  • Static routing must be configured manually on every router.

In the next episode, episode 10, we switch to automatic routing: dynamic routing fundamentals and EIGRP — the classification of IGP and EGP protocols, the difference between distance vector and link-state, the Autonomous System concept, neighbor adjacency, bandwidth and delay based metrics, and understanding successor and feasible successor in the EIGRP topology table.