From point A to point B
Point A: you can already assign addresses and split a network into subnets, but each network is still an island: devices only talk to their own subnet. Point B: by the end you will explain how a router forwards a packet, read any line of its routing table, predict which route it will choose and configure static, default and floating routes in IPv4 and IPv6.
This chapter opens the IP Connectivity domain of the v1.1 exam, worth 25%: topics 3.1 (interpret the components of the routing table), 3.2 (determine how a router makes a forwarding decision by default) and 3.3 (configure and verify IPv4 and IPv6 static routing). It also reviews inter-VLAN routing from topic 2.1 with router-on-a-stick and SVIs.
What a router does
Routing is the process by which a layer 3 device carries a packet toward its destination. The router does two jobs: it chooses the best route to each destination network and it switches the packet from the interface it came in on to the exit interface of that route.
- It works at layer 3 of the OSI model and decides with the destination IP address.
- It joins different networks: each interface is a different network and broadcast domain.
- It does not forward broadcasts, so it segments the network.
- It can be a dedicated device or a function of a layer 3 switch, with physical and logical interfaces (subinterfaces, SVIs, loopbacks).
- For PCs it is the default gateway: the way out to any network other than their own.
There are two ways for a router to learn remote networks:
| Static routing | Dynamic routing | |
|---|---|---|
| Who creates the routes | The administrator, one by one | A routing protocol that exchanges them between routers |
| Where it fits | Small networks, default routes and backups | Medium and large networks |
| Topology changes | Does not adapt on its own | Adapts and finds another path |
| Overhead | No CPU or bandwidth | Uses CPU, memory and some bandwidth |
Routed and routing protocols
Two similar names, two different jobs:
- Routed protocol: carries the user’s data end to end. IPv4 and IPv6 are routed protocols.
- Routing protocol: works between routers to discover networks and choose the paths the routed protocol will travel. OSPF, EIGRP, RIP and BGP are routing protocols.
IGP and EGP, and the four kinds of protocols. Diagram: The House of Routing.
An autonomous system (AS) is a set of networks under one administration, such as a company’s or a provider’s network. IGPs work inside an AS and EGPs connect autonomous systems to each other; the only EGP in use today is BGP.
| Type | How it works | Examples |
|---|---|---|
| Distance vector | Knows the network through what its neighbors tell it (“routing by rumor”). Sends its table periodically and converges slowly. | RIPv2 |
| Link state | Every router knows the full map of its area and computes the shortest-path tree. Converges fast. | OSPF, IS-IS |
| Advanced distance vector (hybrid) | Keeps neighbors, sends only changes and stores backup routes. Converges very fast. | EIGRP |
| Path vector | Chooses by attributes and by the list of ASes each route crosses | BGP |
Depending on whether they send the mask in their updates, protocols are classful (RIPv1, IGRP, now obsolete) or classless (RIPv2, OSPF, EIGRP, IS-IS, BGP). Only classless protocols support VLSM and CIDR. For CCNA v1.1 the dynamic protocol you must master is OSPF.
The forwarding process
It all starts at the host. Before sending a packet, the PC compares the destination’s network with its own (with the AND operation from chapter 4):
- If the destination is on its own subnet, it finds the destination’s MAC with ARP and delivers the frame directly.
- If it is on another subnet, it sends the frame to the MAC of its default gateway, although the final destination’s IP is inside.
IPs travel end to end; frames are rebuilt on every link. Diagram: The House of Routing.
Every router repeats five steps:
- Receives the frame: checks the FCS and that the destination MAC is its own (or a broadcast meant for it). If something fails, it drops it.
- De-encapsulates: removes the layer 2 header and trailer and keeps the IP packet.
- Looks up the destination in the routing table, subtracts 1 from the TTL (if it reaches 0, it drops the packet and reports it with ICMP) and recomputes the header checksum.
- Encapsulates the packet in a new frame for the exit interface. On Ethernet it uses ARP to learn the next hop’s MAC.
- Transmits the frame out of the exit interface.
Reading the routing table
The routing table is the list of networks the router knows and the path to each one. You see it with show ip route:
R_CCS_01# 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
* - candidate default
Gateway of last resort is 172.17.0.2 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 172.17.0.2
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.16.0.0/16 is directly connected, FastEthernet0/0
L 172.16.0.1/32 is directly connected, FastEthernet0/0
172.17.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.17.0.0/16 is directly connected, Serial0/0/0
L 172.17.0.1/32 is directly connected, Serial0/0/0
S 172.18.0.0/16 [1/0] via 172.17.0.2
O 172.20.0.0/16 [110/65] via 172.23.0.4, 00:02:11, Serial0/1/0
Read each route from left to right:
| Field | Example | What it means |
|---|---|---|
| Code | O | How the route was learned: C connected, L local, S static, O OSPF, D EIGRP, R RIP, B BGP. The asterisk marks the candidate default route. |
| Prefix and mask | 172.20.0.0/16 | The destination network |
| [Administrative distance/metric] | [110/65] | How trustworthy the source is and the path cost for that protocol |
| Next hop | via 172.23.0.4 | The neighbor router the packet is sent to |
| Age | 00:02:11 | How long ago the route was learned or updated (dynamic routes only) |
| Exit interface | Serial0/1/0 | Where the packet goes out |
| Gateway of last resort | 172.17.0.2 | Where packets go when no other route matches |
Every active interface with an IP creates two routes: the C route to its network and the L route, a /32 with the interface’s own address. If the interface goes down, both disappear.
For your notes. show ip route 172.20.1.5 tells you which route the router would use for that exact address. show ip route static, connected or ospf filter by source.
How it picks the best route
When a packet arrives, the router applies these rules in order:
- Longest prefix match: of all the routes that contain the destination, the one with the longest prefix, that is the most specific, wins.
- To install a route in the table, if two different sources offer the same prefix, the one with the lower administrative distance wins.
- If the same protocol offers several paths to the same prefix, the lower metric wins.
- If everything ties, the router installs several paths and load-balances across them (ECMP). OSPF and EIGRP use up to 4 paths by default (
maximum-paths).
10.1.1.10 matches three routes; the /24 wins. Diagram: The House of Routing.
Administrative distance
Administrative distance (AD) measures trust in a route’s source: the lower, the better. It is compared only when two different sources offer exactly the same prefix.
Default administrative distances in Cisco IOS. Diagram: The House of Routing.
| Route source | AD | Route source | AD |
|---|---|---|---|
| Connected | 0 | OSPF | 110 |
| Static | 1 | IS-IS | 115 |
| EIGRP summary route | 5 | RIP | 120 |
| External BGP (eBGP) | 20 | External EIGRP | 170 |
| Internal EIGRP | 90 | Internal BGP (iBGP) | 200 |
| Unknown (not used) | 255 | ||
Metric
The metric compares paths within the same protocol, and each one computes it in its own way: RIP counts hops (maximum 15), OSPF adds up link costs (based on bandwidth) and EIGRP combines bandwidth and delay. That is why comparing an OSPF metric with a RIP metric makes no sense: that is what administrative distance is for.
Static routes
A static route tells the router, by hand, how to reach a network. The basic syntax is:
ip route network mask { next-hop | exit-interface [next-hop] } [distance]
A route there on R1 and a route back on R2. Diagram: The House of Routing.
R_CCS_01(config)# ip route 172.18.0.0 255.255.0.0 172.17.0.2
R_MIA_01(config)# ip route 172.16.0.0 255.255.0.0 172.17.0.1
R_CCS_01# show ip route static
S 172.18.0.0/16 [1/0] via 172.17.0.2
R_CCS_01# ping 172.18.0.10
!!!!!
There are three ways to say where the route goes:
| Form | Example | Comment |
|---|---|---|
| Next hop | ip route 172.18.0.0 255.255.0.0 172.17.0.2 | The most common. The router does a recursive lookup to find which interface reaches 172.17.0.2. |
| Exit interface | ip route 172.18.0.0 255.255.0.0 serial0/0/0 | Shows as “directly connected”. Fine on point-to-point links; on Ethernet it relies on proxy ARP and is not recommended. |
| Fully specified | ip route 172.18.0.0 255.255.0.0 g0/1 10.0.0.2 | Interface and next hop: the clearest option on Ethernet links |
And by what they cover:
- Network route: to a subnet, such as 172.18.0.0/16.
- Host route: to a single address, with a /32 mask (
ip route 10.9.9.9 255.255.255.255 172.17.0.2). - Default route: to 0.0.0.0/0, for everything that is unknown.
- Floating route: a backup static with a high administrative distance.
A static route enters the table only if its exit interface is up or its next hop is reachable. Remember to always configure the return route: ping has to go there and come back.
Default route
A branch with a single way out does not need to know every internet network. The default route, 0.0.0.0/0, matches any destination, but with the shortest possible prefix: it is used only when no more specific route exists.
Everything not in the table goes out toward the provider. Diagram: The House of Routing.
R1(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.1
R1# show ip route | include last resort|0.0.0.0
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
A layer 2 switch does not use routes: you configure ip default-gateway for its management traffic. As soon as you enable ip routing on a layer 3 switch, you need a default route like on any router.
Floating static routes
A floating route is a backup static route that you give a higher administrative distance than the primary route. While the primary exists, the floating route stays out of the table; if the primary disappears, the floating route “floats up” and is installed.
OSPF over the primary link and a static with AD 200 over the backup. Diagram: The House of Routing.
! primary: default route through provider 1
R1(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.1
! backup: same route through provider 2, with AD 5
R1(config)# ip route 0.0.0.0 0.0.0.0 198.51.100.1 5
R1# show ip route static
S* 0.0.0.0/0 [1/0] via 203.0.113.1
If the primary is a static (AD 1), any higher value works. If it is dynamic, the floating route must exceed that protocol’s AD: more than 110 to back up OSPF and more than 90 for internal EIGRP. If you set a lower AD, the “floating” route replaces the dynamic route and stops being a backup.
track, which are not on the exam.IPv6 static routes
The logic is the same: prefix, next hop or interface and, optionally, administrative distance. First the router must have IPv6 routing enabled with ipv6 unicast-routing.
R1(config)# ipv6 unicast-routing
! network route with a global next hop
R1(config)# ipv6 route 2001:db8:2::/64 2001:db8:12::2
! default route
R1(config)# ipv6 route ::/0 2001:db8:12::2
! link-local next hop: the interface is required
R1(config)# ipv6 route 2001:db8:3::/64 gigabitethernet0/1 fe80::2
! floating backup
R1(config)# ipv6 route ::/0 2001:db8:13::3 200
R1# show ipv6 route static
If the next hop is a link-local address (FE80::/10), the router needs the exit interface, because the same link-local can repeat on several links. An IPv6 host route uses /128. In the IPv6 chapter you will see full addressing.
Router-on-a-stick and SVIs
In chapter 3 you saw that each VLAN is a subnet and that a layer 3 device is needed to move between them. Videos 3 and 4 of this chapter configure it step by step.
Router-on-a-stick with a native VLAN
R_CCS_01(config)# interface fastethernet0/0
R_CCS_01(config-if)# no shutdown
R_CCS_01(config-if)# interface fastethernet0/0.100
R_CCS_01(config-subif)# encapsulation dot1Q 100
R_CCS_01(config-subif)# ip address 192.168.0.1 255.255.255.0
R_CCS_01(config-subif)# interface fastethernet0/0.200
R_CCS_01(config-subif)# encapsulation dot1Q 200
R_CCS_01(config-subif)# ip address 192.168.1.1 255.255.255.0
R_CCS_01(config-subif)# interface fastethernet0/0.99
R_CCS_01(config-subif)# encapsulation dot1Q 99 native
R_CCS_01(config-subif)# ip address 172.16.99.1 255.255.255.0
Each subinterface is its VLAN’s default gateway and creates its own connected route. The native keyword tells which VLAN arrives untagged; you can also put the native VLAN’s IP directly on the physical interface. The native VLAN must match the switch’s.
SVIs on a layer 3 switch
MLS1(config)# ip routing
MLS1(config)# vlan 10
MLS1(config-vlan)# vlan 20
MLS1(config-vlan)# interface vlan 10
MLS1(config-if)# ip address 10.1.10.1 255.255.255.0
MLS1(config-if)# no shutdown
MLS1(config-if)# interface vlan 20
MLS1(config-if)# ip address 10.1.20.1 255.255.255.0
MLS1(config-if)# no shutdown
MLS1(config-if)# exit
MLS1(config)# ip route 0.0.0.0 0.0.0.0 10.1.99.2
An SVI is up/up only if the VLAN exists on the switch, has at least one active port (an access port in that VLAN or a trunk carrying it in forwarding state) and the SVI is not shut down.
Troubleshooting
When a ping between networks fails, walk the path methodically:
| Step | What you check | Command |
|---|---|---|
| 1 | The PC’s IP, mask and default gateway | ipconfig · ip a |
| 2 | That the router’s interfaces are up/up with the right IP | show ip interface brief |
| 3 | That every router on the path has a route to the destination | show ip route 172.18.0.10 |
| 4 | That the return route exists on the router at the other end | show ip route on the remote router |
| 5 | Where the path breaks | traceroute (router) · tracert (Windows) |
| 6 | Subinterfaces, native VLAN and trunks (if there are VLANs) | show interfaces trunk · show vlan brief |
encapsulation dot1Q tag does not match the switch’s VLAN; an SVI down because the VLAN does not exist or has no active ports; ip routing not enabled on the layer 3 switch.For your notes. A traceroute that shows asterisks from a given hop usually points to the router where the route is missing or where the reply finds no way back.
What you take away
- A router chooses the best route and switches the packet to the exit interface. It does not forward broadcasts.
- IP is a routed protocol; OSPF, EIGRP, RIP and BGP are routing protocols. IGP inside the AS; EGP (BGP) between ASes.
- At every hop the MACs change and the TTL drops; the source and destination IPs stay the same.
- Table: code, prefix, [AD/metric], next hop, age and interface. C and L appear with each active interface.
- Decision order: longest match; then AD between different sources; then metric; then load balancing.
- AD: connected 0, static 1, eBGP 20, EIGRP 90, OSPF 110, RIP 120, external EIGRP 170, iBGP 200.
ip route network mask next-hop; always configure the return route.- Default route:
ip route 0.0.0.0 0.0.0.0 …, shown as S* and the gateway of last resort. - Floating: the same route with a higher AD than the primary (above 110 to back up OSPF).
- IPv6:
ipv6 unicast-routingandipv6 route; with a link-local next hop, give the interface.
In the next chapter you stop writing routes by hand: routers learn them on their own with OSPF, the dynamic routing protocol the CCNA requires.
Slides
These slides support the guided class: view them here, full screen, or download the PDF for your notes. Part 1 is the chapter’s theory base; Part 2 goes with videos 1 and 2; and Part 3 with videos 3 and 4.
Class videos
The videos are in Spanish. The translation of the videos is in development.
Each part of the chapter has its own video. Tap a card and the video opens right here, over the page; use the Close button or the Esc key to go back to where you were. Use them alongside the slides of the same part.
- Chapter 5 · Part 1Configuring static routesWatch video
- Chapter 5 · Part 2Configuring floating static routesWatch video
- Chapter 5 · Part 3Configuring router-on-a-stick and the native VLANWatch video
- Chapter 5 · Part 4Configuring SVIs and troubleshootingWatch video
When you play a video, it loads from YouTube (no cookies until you open it). See the full playlist on YouTube.
Packet Tracer labs
The labs are in Spanish. The translation of the labs is in development.
Download each lab's files and open them with Cisco Packet Tracer. Tap the name to see the two downloads.
Lab 1The routing process
You enable OSPF on the Caracas router R_CCS_01 with router ospf 1 and its networks in area 0, save the configuration and check the table with show ip route. Then, in Simulation mode, you follow a ping and watch how the ARP frame and the IP packet travel from router to router. Console and enable password: gj123.
Lab 2Static routing
With the 172.16.0.0 network split into a /16 per branch, you configure R_CCS_01’s interfaces, create a static route to the Miami LAN (172.18.0.0/16) and, on R_MIA_01, the return route to Caracas (172.16.0.0/16). You verify with show ip route and a ping from PC_MIA_01. Console and enable password: gj123.
Lab 3Inter-VLAN routing with router-on-a-stick
In Caracas you create subinterfaces FastEthernet0/0.100 (192.168.0.1/24) and 0/0.200 (192.168.1.1/24) with encapsulation dot1Q, bring up the trunk on SW_CCS_01 and assign the ports to VLANs 100 and 200 so the PC and the server can talk across VLANs. Console and enable password: gj123.
Chapter assessment
There are 100 single-choice questions, split into 10 tabs of 10. Each tab mixes every topic in the chapter and rises in level: questions 1 to 3 are low difficulty, 4 to 8 are medium and 9 to 10 are high.
We do not save your answers. They run in your browser and, if you close or reload the page, you start from zero. Getting it wrong here is the cheapest way to learn.
Additional resources
These links take you to official sites outside this portal. Use them to practice, go further and confirm what you learned.
To study and practice
- Cisco U.: Implementing and Administering Cisco Solutions (CCNA) pathu.cisco.com
- Cisco Learning Network: community, forums and study resourceslearningnetwork.cisco.com
- Cisco Packet Tracer at Networking Academynetacad.com
Exam and certification
- Official CCNA 200-301 v1.1 exam topics (PDF)learningcontent.cisco.com
- Official CCNA certification pagecisco.com
Cisco documentation
Source and credits. Chapter built from Jesús Espinoza’s “Routers and IPv4 routing” notes (parts 1 and 2) and slides (CCNA 200-301, part 5), paraphrased, updated and aligned with the official CCNA 200-301 v1.1 exam topics. Text drafted with AI assistance; original diagrams by The House of Routing. Technical details were checked against official Cisco documentation.
