NetForge-AI
Networking CourseAI-ledLessonsCommunityFeaturesProtocolsPricing
Sign inSign up
NetForge-AI
Networking CourseAI-ledLessonsCommunityFeaturesProtocolsPricing
Sign inSign up
All lessons
Intermediate·30 minute read

Static routing & default gateways

Static routing is the simplest possible way to teach a router which way to send packets for a given destination network. This lesson covers connected, static, and default routes, longest-prefix match, and the gotchas that catch every student the first time.

Open this lab

What a routing table actually contains

A routing table is a list of (destination network, next hop, outgoing interface) tuples. When a packet arrives, the router looks up the destination IP, finds the most specific matching route, and forwards the packet out the listed interface toward the listed next hop.

Routes come from three sources in NetForge-AI: connected (learned automatically when you assign an IP to an interface), static (manually configured with ip route), and default (a 0.0.0.0/0 catch-all set with ip default-gateway or ip route 0.0.0.0 0.0.0.0).

Longest-prefix match

When two routes both match a destination, the router uses the one with the longer prefix. A /24 beats a /16. A /32 host route beats everything except an identical /32. This rule is why you can have a default route to the Internet and more-specific internal routes simultaneously, with internal traffic always preferring the specific match.

Configuring a static route

Static routes are written as: ip route <network> <mask> <next-hop>. For a router that wants to reach 10.0.2.0/24 via 10.0.99.2:

R1> enable
R1# configure terminal
R1(config)# ip route 10.0.2.0 255.255.255.0 10.0.99.2
R1(config)# end
R1# show ip route
S 10.0.2.0/24 via 10.0.99.2, Se0/0/0

Default gateway: the most common mistake

Endpoints (PCs, servers) don't run a routing protocol — they just have one default gateway. If a PC's destination IP is in its own subnet, it ARPs the destination directly. Otherwise, it sends the frame to the gateway's MAC and lets the router worry about it.

A misconfigured default gateway is the #1 reason 'my network is down' tickets are created. If the PC's gateway is wrong, even pings to other subnets fail with no useful error.

Note: In NetForge-AI, set a PC's gateway in the right-hand panel. The simulator immediately rebuilds the device's routing table to add a 0.0.0.0/0 entry.

Practice this in the lab

Reading helps. Wiring it up yourself and breaking it makes it stick.

Open the lab
NetForge-AI

A browser-native network lab and networking course, beginner to advanced. Free account opens Module 1 + a 3-device lab; Pro unlocks the rest.

Product

  • Lab
  • Networking Course
  • Lessons
  • Community
  • Features

Course modules

  • 1 · Fundamentals
  • 2 · Addressing
  • 3 · Access (L2)
  • 4 · Connectivity
  • Mock exam

Resources

  • FAQ
  • Privacy Policy
  • Terms of Service

NetForge-AI is an independent educational platform and is not affiliated with, endorsed by, or sponsored by any networking vendor or certification body. All product names, protocols, and standards referenced are the property of their respective owners and are used for descriptive, educational purposes only.

© 2026 NetForge-AI. All rights reserved.Built for networking learners worldwide.