# Day 11: Routing Fundamentals

# CCNA 200-301 Study Guide: IP Routing Fundamentals &amp; Static Routing

## 1.0 Introduction: The Core of IP Connectivity

IP routing is the Layer 3 function that enables communication across different network segments. It is a major component of the IP Connectivity domain, representing 25% of the CCNA exam.

### Layer 2 Switching vs. Layer 3 Routing

<div align="left" dir="ltr" id="bkmrk-function-layer-2-swi"><table><colgroup><col width="130"></col><col width="227"></col><col width="245"></col></colgroup><tbody><tr><td>Function

</td><td>Layer 2 Switching

</td><td>Layer 3 Routing

</td></tr><tr><td>Primary Role

</td><td>Forwards traffic within a single LAN/broadcast domain.

</td><td>Forwards traffic between different IP networks/subnets.

</td></tr><tr><td>PDU Handled

</td><td>Frame. Decisions based on Destination MAC.

</td><td>Packet. Decisions based on Destination IP.

</td></tr><tr><td>Unknown Destination

</td><td>Floods the frame to all ports (except source).

</td><td>Drops the packet if no matching route is found.

</td></tr></tbody></table>

</div>## 2.0 Deconstructing the IP Routing Table

The routing table is a RAM-based map of the network. The command to view it is show ip route.

### Routing Table Components

<div align="left" dir="ltr" id="bkmrk-component-descriptio"><table><colgroup><col width="135"></col><col width="204"></col><col width="264"></col></colgroup><tbody><tr><td>Component

</td><td>Description

</td><td>Significance

</td></tr><tr><td>Source Code

</td><td>A letter code (e.g., S, C, L, O, R).

</td><td>Identifies how the route was learned and its trustworthiness.

</td></tr><tr><td>Destination Network

</td><td>The remote network prefix and mask.

</td><td>The "destination" target for incoming packets.

</td></tr><tr><td>Admin Distance (AD)

</td><td>A value from 0–255.

</td><td>Tie-breaker for trustworthiness (Lower is better).

</td></tr><tr><td>Metric

</td><td>Path "cost" calculated by the protocol.

</td><td>Tie-breaker if multiple routes have the same AD.

</td></tr><tr><td>Next Hop

</td><td>The IP of the next router in the path.

</td><td>The immediate next device to receive the packet.

</td></tr><tr><td>Exit Interface

</td><td>The local physical/virtual outbound port.

</td><td>The "door" the packet leaves through.

</td></tr></tbody></table>

</div>### Automatically Populated Routes

- Connected (C): The network segment directly attached to an active interface.
- Local (L): A host route ($/32$) for the specific IP assigned to the router's interface.

## 3.0 The Path Selection Process: A Router's Logic

Routers follow a non-negotiable, three-step hierarchical logic to determine the "Best Path."

1. Longest Prefix Match (LPM): The router prefers the most specific route (the one with the longest subnet mask).
- Example: For destination 10.1.1.5, a /32 route beats a /24 route.

3. Administrative Distance (AD): If prefix lengths are identical, the router selects the source with the lowest AD.
- Connected: 0
- Static: 1
- OSPF: 110

5. Metric: If both prefix length and AD are identical, the path with the lowest cost (metric) is chosen.

## 4.0 Static Routing: Manual Network Navigation

Static routes are manually configured using the ip route command. They are ideal for "Stub" networks with a single exit path.

<div align="left" dir="ltr" id="bkmrk-advantages-disadvant"><table><colgroup><col width="290"></col><col width="315"></col></colgroup><tbody><tr><td>Advantages

</td><td>Disadvantages

</td></tr><tr><td>Low CPU/RAM overhead (no protocol calculations).

</td><td>Not scalable for large, complex networks.

</td></tr><tr><td>Highly predictable and explicit traffic flow.

</td><td>Requires manual intervention for every topology change.

</td></tr><tr><td>Secure (does not advertise network info).

</td><td>High administrative effort.

</td></tr></tbody></table>

</div>### Configuration Methods

- Next-Hop IP: Recommended for multi-access (Ethernet) segments.
- ip route 10.2.2.0 255.255.255.0 192.168.1.2

- Exit Interface: Primarily for point-to-point links.
- ip route 10.2.2.0 255.255.255.0 g0/1

- Fully Specified: Provides both interface and next-hop; avoids recursive lookups.
- ip route 10.2.2.0 255.255.255.0 g0/1 192.168.1.2


## 5.0 The Default Route: Gateway of Last Resort

The default route acts as a safety net for packets that do not match any other specific entry in the routing table.

- Syntax: 0.0.0.0 0.0.0.0 (CIDR notation: /0).
- Logic: Because it has a prefix length of zero, it is the least specific route possible and is only used if all other entries fail to match.
- Verification: Identified in the routing table by the code S\*. The asterisk (\*) signifies the active candidate for the gateway of last resort.

## 6.0 Packet Forwarding Mechanics: L2 and L3 Journey

As a packet travels across routers, its encapsulation changes.

- IP Addresses (Layer 3): Remain unchanged from source to destination (unless NAT is applied).
- MAC Addresses (Layer 2): Are rewritten at every hop. Each router replaces the source MAC with its own exit interface and the destination MAC with the next hop's address.

### The Forwarding Procedure

1. De-encapsulate: Strip the L2 frame to see the L3 packet.
2. Lookup: Find the best path in the routing table.
3. Re-encapsulate: Wrap the packet in a new L2 frame for the next hop.

## 7.0 Core Troubleshooting for Static Routes

1. Verify Interface Status: Use show ip interface brief. Interfaces must be up/up. A static route is removed if its exit interface is down.
2. Confirm Route Presence: Use show ip route. Ensure no typos were made during configuration.
3. Recursive Lookup Check: The router must have a valid route to the Next-Hop IP for the static route to be installed in the table.
4. Ensure Route Symmetry: Check that the return path exists on the remote router. Routing is a one-way decision.

## 8.0 Summary of Key Concepts

- LPM is the first rule of routing; specificity always wins.
- Static Routes have a default AD of 1.
- Connected Routes have the lowest possible AD of 0.
- Default Routes handle all otherwise unmatchable traffic and use the /0 mask.