Week 3 · Lesson 6

Static Routing

A router’s whole job is to move a packet one hop closer to its destination, and it decides each hop from a single table. This lesson explains the routing table, the three kinds of route, and how to add a static route by hand — with the real Cisco IOS commands. The lab that follows puts this into practice.

CCNA 200-301 Domain 3.0 IP Connectivity Verified 2026-10-11
Part 1

Routing: choosing the path

Routing is the process of selecting a path for a packet to travel from its source network to its destination network. A host only knows about its own subnet and a default gateway; it is the routers along the way that decide, hop by hop, where a packet goes next. Each router makes an independent, per-hop decision, and every decision comes from one place: the routing table.

Definition — routing. Routing is the process by which a router examines a packet’s destination IP address, looks it up in its routing table, and forwards the packet out of the interface associated with the best (longest-match) route. Routers forward between different networks; switches forward within one network.
Follow the packet · select the hop
PC-A 192.168.10.10 R1 192.168.10.1 R2 192.168.20.1 Server B 192.168.20.10 packet in flight The host compares the destination with its own subnet.

Part 2

The routing table

The routing table is the list of networks the router knows how to reach, and for each one, the interface or next-hop IP to use. The command that shows it is show ip route. Every line has this shape:

  S    192.168.20.0/24 [1/0] via 10.0.0.2
  ^    ^               ^   ^  ^
  |    |               |   |  +-- metric
  |    |               |   +----- administrative distance
  |    |               +--------- next-hop IP address
  |    +------------------------- destination network
  +------------------------------ route source code (S = static)

The leading code tells you where the route came from. The most important codes:

CodeMeaning
CDirectly connected network — the router has an interface in it.
LLocal route — the router’s own address on that interface (a /32 host route).
SStatic route — added manually by an administrator.
S*Static default route (the candidate default).
OOSPF (a dynamic route learned from a neighbour).
DEIGRP — internal (dynamic).
RRIP (dynamic).
Read the route line · select a code

Part 3

Connected, static, and dynamic routes

A router’s table can hold three kinds of route, and they come from three different places.

TypeHow it gets thereTypical use
ConnectedAdded automatically when you give an interface an IP address and bring it up.Every active interface — the router always knows its own networks.
StaticConfigured by hand with ip route.Small, stable, or edge networks; precise control.
DynamicLearned automatically from neighbours using a routing protocol (OSPF, EIGRP, RIP).Large or changing networks where manual configuration does not scale.
Remember. A router always has connected routes for its own interfaces. It only learns about remote networks either from a static route you type or from a dynamic protocol. With no route to a destination, the packet is dropped (and the router may send back an “unreachable” message).

When a static route is the right choice

A static route is a route an administrator enters manually. It is explicit, it never changes unless you change it, and the router does not advertise it to anyone. Static routes consume no CPU for route calculation and no bandwidth for routing updates. Use them when:

Watch out. Static routes do not adapt. If a link fails or the topology changes, a static route stays exactly as configured and traffic fails with it. In a larger, redundant network that is a reason to prefer a dynamic protocol. Static routes also must be updated by hand as networks are added.
Part 4

The default route and the ip route command

A default route matches every destination. It is written 0.0.0.0 0.0.0.0 (IPv4), which represents “any network / any mask”. Routers use it as the gateway of last resort: if no more-specific route in the table matches the destination, the default route is used.

Why it matters. A stub router does not need to know every network on the Internet. One default route pointing at the next router (or the ISP) covers them all: “if you do not know where it goes, send it this way.” This is exactly how a home or branch router reaches the whole Internet.

The ip route command

The IPv4 command is ip route. The general form is ip route <destination-network> <subnet-mask> <next-hop-ip or exit-interface>. You may specify the next-hop IP, the exit interface, or both:

FormExampleNotes
Next-hop onlyip route 192.168.20.0 255.255.255.0 10.0.0.2 The normal choice, especially on Ethernet/broadcast links.
Exit interface onlyip route 192.168.20.0 255.255.255.0 serial 0/0/0 Common on point-to-point links; the router sends straight out of that interface.
Both (fully specified)ip route 192.168.20.0 255.255.255.0 serial 0/0/0 10.0.0.2 Most explicit; useful when it matters which interface is used.
Default routeip route 0.0.0.0 0.0.0.0 203.0.113.1 Matches every destination — the gateway of last resort.
Build the command · select the form

      

Which route is used? Longest prefix match

The rule the router uses is longest prefix match: the most specific matching route wins. A default route has the shortest possible prefix (/0), so it only catches destinations that match no longer route. This is why a default route never breaks your specific routes — it simply waits behind them.

Route in the tablePrefixUsed for
Static route to LAN B192.168.20.0/24Anything inside 192.168.20.0/24
Connected WAN link10.0.0.0/30Anything inside 10.0.0.0/30
Default route0.0.0.0/0Everything else — the gateway of last resort
Exam tip. Know all three forms — the exam expects you to read and write them. The destination and mask always come first; the next-hop/exit-interface comes last. A static route has an administrative distance of 1 by default, and a connected route is 0.
Part 5

Administrative distance versus metric

When a router knows more than one route, it needs a rule to pick one. Two concepts do that, and the exam loves to test the difference:

Route sourceDefault administrative distance
Directly connected0
Static1
eBGP20
EIGRP (internal)90
OSPF110
RIP120

A connected route (AD 0) always beats a static route (AD 1) to the same network, which always beats a route learned by OSPF (AD 110). In the output [1/0], the first number is the AD and the second is the metric.

Which route wins? · choose the two sources

Floating static route. If you set a static route’s AD higher than a dynamic protocol (for example 130), it becomes a floating static route: it sits unused until the dynamic route disappears, then takes over as a backup.
Part 6

Example topology: configure and verify

Two routers, each serving one LAN, joined by a serial WAN link. Neither router knows the other’s LAN until we add a static route.

LAN A 192.168.10.0/24 WAN 10.0.0.0/30 LAN B 192.168.20.0/24 PC-A 192.168.10.10 R1 G0/0 .10.1 | S0/0/0 .0.1 R2 S0/0/0 .0.2 | G0/0 .20.1 Server B 192.168.20.10 packet path: PC-A → R1 → R2 → Server B Static routes added On R1: ip route 192.168.20.0 255.255.255.0 10.0.0.2 On R2: ip route 192.168.10.0 255.255.255.0 10.0.0.1 R1 routing table (relevant lines) C 192.168.10.0/24 is directly connected, G0/0 S 192.168.20.0/24 [1/0] via 10.0.0.2

Step 1 — Address the interfaces (connected routes appear automatically)

! --- R1: LAN A interface and WAN serial interface ---
R1> enable
R1# configure terminal
R1(config)# interface gigabitEthernet 0/0
R1(config-if)# description LAN A
R1(config-if)# ip address 192.168.10.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# exit
R1(config)# interface serial 0/0/0
R1(config-if)# description WAN link to R2
R1(config-if)# ip address 10.0.0.1 255.255.255.252
R1(config-if)# clock rate 128000
R1(config-if)# no shutdown
R1(config-if)# exit
R1(config)# exit
R1#
Note. The clock rate command is only needed on the DCE end of a serial link (here, R1). On modern packet-tracer/IOS gear the DCE side is whichever end supplies the clock. Gigabit Ethernet interfaces never need it.

Step 2 — Give R2 its mirror-image addressing

! --- R2 ---
R2> enable
R2# configure terminal
R2(config)# interface serial 0/0/0
R2(config-if)# ip address 10.0.0.2 255.255.255.252
R2(config-if)# no shutdown
R2(config-if)# exit
R2(config)# interface gigabitEthernet 0/0
R2(config-if)# description LAN B
R2(config-if)# ip address 192.168.20.1 255.255.255.0
R2(config-if)# no shutdown
R2(config-if)# exit
R2(config)# exit
R2#

Step 3 — Add the static routes

! --- On R1: reach LAN B through R2's WAN address ---
R1# configure terminal
R1(config)# ip route 192.168.20.0 255.255.255.0 10.0.0.2
! exit-interface form would be:
! ip route 192.168.20.0 255.255.255.0 serial 0/0/0
R1(config)# exit

! --- On R2: reach LAN A through R1's WAN address ---
R2# configure terminal
R2(config)# ip route 192.168.10.0 255.255.255.0 10.0.0.1
R2(config)# exit

Step 4 — Verify the routing table

R1# show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       ... (codes continue) ...
Gateway of last resort is not set

     10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       10.0.0.0/30 is directly connected, Serial0/0/0
L       10.0.0.1/32 is directly connected, Serial0/0/0
     192.168.10.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.10.0/24 is directly connected, GigabitEthernet0/0
L       192.168.10.1/32 is directly connected, GigabitEthernet0/0
S    192.168.20.0/24 [1/0] via 10.0.0.2

Read the last line: S = static, [1/0] = AD 1 / metric 0, via 10.0.0.2 = the next hop. R1 now knows how to reach LAN B. R2’s table shows the mirror image (S  192.168.10.0/24 [1/0] via 10.0.0.1).

Step 5 — Prove connectivity with ping

R1# ping 192.168.20.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.20.10, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms

! For a default route at the Internet edge, add instead:
R1(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.1
! which then appears in the table as:
! Gateway of last resort is 203.0.113.1 to network 0.0.0.0
! S*   0.0.0.0/0 [1/0] via 203.0.113.1
Exam tip. Commit these to memory: connected = AD 0, static = 1, EIGRP = 90, OSPF = 110, RIP = 120. Static routes have AD 1. A default static route (0.0.0.0 0.0.0.0) is the gateway of last resort at the Internet edge — and because it is less specific than any real network, the router uses a specific route whenever one exists.

Key terms

TermMeaning
RoutingSelecting the path for a packet between networks, hop by hop, using the routing table.
Routing tableThe list of known destination networks and their next hops or exit interfaces.
Connected routeA route to a network the router has an interface in; added automatically.
Static routeA route entered manually with the ip route command.
Dynamic routeA route learned automatically from other routers via a routing protocol.
Default routeThe route 0.0.0.0 0.0.0.0 that matches any destination; the gateway of last resort.
Administrative distanceA value (0–255) expressing the trustworthiness of a route’s source; lower is preferred.
MetricThe cost of a path used to choose between routes from the same protocol.
Part 7 · Your turn

Review

Check what you have learned with these review questions.

Review · 6 questions

Sources

Sources & references

  1. Postel, J. RFC 791: Internet Protocol (1981). rfc-editor.org/rfc/rfc791.
  2. Baker, F. (ed.). RFC 1812: Requirements for IP Version 4 Routers (1995) — forwarding, routing tables, and default routes. rfc-editor.org/rfc/rfc1812.
  3. Socolofsky, T. & Kale, C. RFC 1180: A TCP/IP Tutorial (1991) — routing and next-hop forwarding. rfc-editor.org/rfc/rfc1180.
  4. Cisco. IP Routing: Static Route Configuration Guide; Cisco IOS IP Command Reference (ip route, show ip route). cisco.com.
  5. Cisco. CCNA (200-301) Exam Topics, Domain 3.0 IP Connectivity. cisco.com.

Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.