Skip to content

Cisco IOS Routing Fundamentals

Routing is how traffic moves between different networks (Layer 3), as opposed to switching, which moves traffic within a single network/VLAN (Layer 2). See VLANs & Inter-VLAN Routing for the SVI setup this section builds on.

Prerequisite: on a Layer 3 switch, ip routing must be enabled in global config first (see VLANs & Inter-VLAN Routing) — it is disabled by default, and without it static routes and routing protocols do nothing.

The Routing Table

Every router (and Layer 3 switch) keeps a routing table: a list of known destination networks and how to reach them.

Cisco IOS — privileged EXEC:

show ip route

Sample output:

Codes: C - connected, S - static, O - OSPF, D - EIGRP
       * - candidate default

Gateway of last resort is 10.0.99.1 to network 0.0.0.0

C    10.0.10.0/24 is directly connected, Vlan10
C    10.0.20.0/24 is directly connected, Vlan20
S*   0.0.0.0/0 [1/0] via 10.0.99.1
  • C — directly connected network (no config needed beyond an ip address on the interface)
  • S — static route (manually configured)
  • * — candidate default: this route is the gateway of last resort (a static default route shows as S*)
  • O / D — learned dynamically via OSPF / EIGRP

Longest prefix match: when multiple routes could match a destination, the router always picks the most specific (longest) matching prefix.

Static Routes

A static route is a manually configured path to a network. Simple, predictable, and appropriate for small networks or a single upstream path.

Cisco IOS — global configuration mode (conf t):

ip route <destination-network> <subnet-mask> <next-hop-ip>

Example — route to a remote subnet via a next-hop router:

ip route 10.0.30.0 255.255.255.0 10.0.99.1

Default Route (Gateway of Last Resort)

Sends any traffic that doesn't match a more specific route out to the internet/upstream router:

Cisco IOS — global configuration mode (conf t):

ip route 0.0.0.0 0.0.0.0 10.0.99.1

Verify which default route is active:

Cisco IOS — privileged EXEC:

show ip route 0.0.0.0

Floating Static Route (Backup Path)

Add an administrative distance (AD) higher than the primary route so it's only used if the primary fails:

Cisco IOS — global configuration mode (conf t):

! Primary, AD 1 (default)
ip route 0.0.0.0 0.0.0.0 10.0.99.1
! Backup, AD 200 — only used if primary is down
ip route 0.0.0.0 0.0.0.0 10.0.98.1 200

Lower administrative distance = more trusted / preferred. Static routes default to AD 1; connected routes are AD 0.

Caution: The backup only takes over when the primary route is withdrawn — and IOS only withdraws a next-hop static route when the connected path toward 10.0.99.1 goes down. If the gateway dies but the switch port stays up/up (gateway reached through another switch or media converter), the AD-200 route never installs. Pair the primary route with IP SLA tracking so failover triggers on actual reachability:

Cisco IOS — global configuration mode (conf t):

! Ping the primary gateway every 10 seconds
ip sla 1
 icmp-echo 10.0.99.1
 frequency 10
ip sla schedule 1 life forever start-time now

! Track object 1 follows the ping result
track 1 ip sla 1 reachability

! Primary route stays installed only while track 1 is up
ip route 0.0.0.0 0.0.0.0 10.0.99.1 track 1

Dynamic Routing

Dynamic routing protocols let routers automatically discover networks and adapt to topology changes (a link goes down, a new subnet is added) without manual reconfiguration. Worth it once you have more than a couple of routers or need automatic failover.

License note: the 3560-CX ships with the IP Base feature set, which supports static routing, OSPF for routed access, and EIGRP in stub mode only — a stub switch will not re-advertise routes learned from one neighbor to another, which looks like a mysterious routing failure in a three-switch topology. Full OSPF/EIGRP requires the IP Services Right-To-Use license; check which feature set is running with show version.

OSPF (Open Shortest Path First)

Industry-standard, link-state protocol. Works across multi-vendor environments (not Cisco-proprietary).

Cisco IOS — global configuration mode (conf t):

router ospf 1
 network 10.0.10.0 0.0.0.255 area 0
 network 10.0.20.0 0.0.0.255 area 0
  • router ospf 1 — process ID, locally significant only (doesn't need to match between routers)
  • network <ip> <wildcard-mask> area <area-id> — enables OSPF on any interface whose IP falls in that range, and advertises the network into the specified area
  • area 0 — the backbone area; simplest designs put everything in area 0

Verify:

Cisco IOS — privileged EXEC:

show ip ospf neighbor
show ip route ospf
  • show ip ospf neighbor — confirm adjacencies: FULL with the DR/BDR; 2WAY/DROTHER between other routers on a shared VLAN is normal
  • show ip route ospf — show routes learned via OSPF

EIGRP (Enhanced Interior Gateway Routing Protocol)

Cisco-proprietary (though now partially open), advanced distance-vector protocol. Fast convergence, easier to configure than OSPF for simple topologies.

Cisco IOS — global configuration mode (conf t):

router eigrp 100
 network 10.0.10.0 0.0.0.255
 network 10.0.20.0 0.0.0.255
 no auto-summary
  • router eigrp 100 — autonomous system number; must match on all routers in the same EIGRP domain (unlike OSPF's process ID)

Verify:

Cisco IOS — privileged EXEC:

show ip eigrp neighbors
show ip route eigrp
  • show ip eigrp neighbors — confirm adjacencies
  • show ip route eigrp — show routes learned via EIGRP

OSPF vs EIGRP — Quick Comparison

OSPF EIGRP
Type Link-state Advanced distance-vector
Vendor Open standard Cisco (partially open since 2013)
Convergence Fast Very fast
Configuration More complex (areas) Simpler for flat topologies
Use case Multi-vendor, standards-based Cisco-only shops wanting simplicity

Troubleshooting Checklist

  • show ip route — is the expected route present? What's the source (C/S/O/D)?
  • show ip interface brief — is the interface up/up, with the correct IP?
  • show ip protocols — confirm a dynamic routing protocol is actually running and which networks it's advertising
  • ping / traceroute — confirm actual reachability, not just table entries
  • For OSPF/EIGRP: check neighbor state first (show ip ospf neighbor / show ip eigrp neighbors) — no neighbor means no routes will be learned, regardless of network statements