ITCertFoundryTechnical training system
COMMAND REFERENCE

Routing & OSPF Command List

Static routes, route-table evidence, single-area OSPF, and neighbor troubleshooting.

Read the routing table

show ip route
show ipv6 route
show ip route <address>
show ip protocols

Static routes

ip route <network> <mask> <next-hop>
ip route 0.0.0.0 0.0.0.0 <next-hop>
ipv6 route ::/0 <next-hop>

Single-area OSPF

router ospf 1
router-id 1.1.1.1
network 10.0.0.0 0.0.0.255 area 0
passive-interface default
no passive-interface gi0/0

Verify neighbors and LSDB

show ip ospf neighbor
show ip ospf interface brief
show ip ospf database
show ip route ospf

Command decisions

CommandWhat it doesWhy it mattersip route network mask next-hopCreates a manually defined route toward a remote prefix.Use it when the path is stable or a dynamic protocol is unnecessary.ip route 0.0.0.0 0.0.0.0 next-hopCreates an IPv4 gateway of last resort.Traffic with no more-specific match follows this route.router-id 1.1.1.1Sets the 32-bit OSPF router identifier.A deliberate stable ID makes neighbors and troubleshooting predictable.network ... area 0Enables OSPF on matching interfaces and assigns their area.OSPF forms adjacencies and advertises connected prefixes from enabled interfaces.passive-interfaceAdvertises the connected network without sending OSPF hellos there.User-facing networks should not attempt router adjacencies.

How a router chooses

First, the router selects the longest matching prefix. A /28 beats a /24 even if the /24 came from a more trusted protocol.

For identical prefixes learned from different sources, lower administrative distance wins.

Metric compares paths learned by the same routing protocol. OSPF uses accumulated cost.

Real scenarios you'll actually face

"The PCs can't ping remote servers, but everything on the local subnet works fine." Reachability within a VLAN only needs Layer 2 — it never touches the routing table at all, which is exactly why "my computer works" and "the network works" are different claims. The moment traffic needs to leave the subnet, start with `show ip route <destination>` on the gateway: no matching route (not even a default) means the packet gets dropped right there with no error the user ever sees. If a route IS present, `ping` from the router itself toward the destination isolates whether the problem is the route entry or something further downstream — and `traceroute` from the PC shows you exactly which hop the trail goes cold at, which is faster than guessing at every device between here and there.

"OSPF neighbors won't come up between two routers I just connected." `show ip ospf neighbor` showing nothing, or a state stuck below FULL, means something on the neighbor checklist doesn't match: same subnet, same area number, matching hello/dead timers, matching authentication, compatible MTU. The router gives you no error message explaining which one — you have to check each one deliberately, starting with the two most common in practice: a typo'd area number, or one side still on the default hello timer while the other was changed. `show ip ospf interface` on both routers, side by side, is how you actually spot the mismatch instead of guessing.

"Traffic gets to the remote server, but the reply never comes back." One-way reachability almost always means the return path is missing or wrong — the destination network has a route back toward the source, but it's pointing somewhere else, or doesn't exist at all on that far router. This is the scenario that makes people incorrectly blame the original route, when the actual fix is on the OTHER end: check the routing table on the device that's supposed to be sending the reply, not just the one that sent the original request.

OFFLINE OPTION

Want a printable copy?

This complete guide is also available as a professionally formatted PDF.

Download PDF ↓