Introduction to IP Routing
Chapter 9 — Introduction to IP Routing
Routing connects separate IP networks and guides packets one hop at a time. This expanded study guide develops the complete process—from local-versus-remote delivery and routing-table interpretation to longest-prefix selection, ARP, TTL, static routes, convergence, and dynamic routing families.
Routing Foundations
When two devices belong to different IP networks, a switch alone cannot complete the delivery. The packet must pass through a router or another Layer 3 device that knows how to reach the destination network.
IP routing is the process of examining a packet’s destination IP address, consulting a routing table, and forwarding the packet toward an appropriate next hop. A Layer 2 switch forwards frames by MAC address inside a broadcast domain; a router connects separate IP networks and makes a Layer 3 forwarding decision at every hop.
Three terms form the foundation of this chapter. A routed protocol carries user data, a routing protocol lets routers exchange reachability information, and the routing table stores the routes available to the local router. The routing protocol learns paths; the routed protocol uses them.
Routing protocol
OSPF, EIGRP, BGP, and RIP exchange reachability information and calculate paths.
Routed protocol
IPv4 and IPv6 carry application data through the routed network.
Routing table
Contains prefixes, next hops, interfaces, sources, administrative distances, and metrics.
How Routes Enter the Table
A router cannot forward a packet merely because an interface has an IP address. It needs a route that describes the destination prefix and indicates where matching traffic should go.
Some routes appear automatically, while others are entered manually or learned from neighboring routers. The source matters when the same destination is learned in multiple ways. Connected and local routes describe the router’s own interfaces; static and default routes reflect administrator intent; dynamic routes are exchanged and recalculated by routing protocols.
Connected
Appears when an interface is up/up with an assigned prefix; disappears when the link fails.
Local
A host route for the address assigned directly to a router interface.
Static
An administrator configures the destination and next hop or exit interface.
Default
0.0.0.0/0 is used when no more-specific route matches.
Dynamic
A routing protocol advertises and calculates reachability, adapting after convergence.
Routing-Table Anatomy
A routing-table entry is a set of instructions for reaching a group of destination addresses. Reading each field as an answer to a practical question makes command output much easier to interpret.
The destination prefix defines which addresses match. The route source identifies how the entry was learned. The next hop names the neighboring Layer 3 address that should receive the packet, while the exit interface identifies the local interface used to transmit it. Administrative distance and metric help choose between competing entries.
Select a field to see the question it answers.
Route-Selection Order
Route selection is a sequence of decisions. Each stage answers a different question, so administrative distance and metric do not override a more-specific prefix.
First, the router finds every route containing the destination and prefers the longest prefix. Only when different sources offer the same prefix does administrative distance identify the more trusted source. If one routing protocol supplies several paths to that same prefix, its metric identifies the preferred path. Equal-cost routes may be installed together for load balancing.
Longest-Prefix Route Selector
A router may find several matching entries for one destination. It does not choose the route with the smallest metric first; it chooses the route describing the narrowest, most-specific address range.
For example, 10.20.30.77 matches 0.0.0.0/0, 10.0.0.0/8, 10.20.0.0/16, and 10.20.30.0/24. The /24 wins because its first 24 bits match the destination, making it more specific than /16, /8, or /0. A default route is therefore used only when no more-specific entry matches.
Enter a destination and let the router apply longest-prefix matching.
| Candidate | Matches? | Result |
|---|
Administrative Distance Explorer
Administrative distance (AD) ranks the reliability of route sources on one router. Lower values are preferred, but AD is compared only when the candidate routes describe the same destination prefix.
Suppose a router learns 172.16.0.0/16 from both OSPF and a static route. The static route normally wins because its default AD of 1 is lower than OSPF’s 110. However, an OSPF /24 route can still beat a static /16 route for a destination inside that /24 because longest-prefix matching occurs first.
Metrics by Protocol
After a route source has been selected, a routing protocol may still know several paths to the same prefix. Its metric measures path desirability according to that protocol’s own rules.
Metrics are not directly interchangeable. A RIP hop count of 2 is not meaningfully compared with an OSPF cost of 20. Each protocol first selects its own best path; administrative distance then helps the router choose between protocols when they offer the same prefix.
| Protocol | Main path measure | Association |
|---|---|---|
| RIP | Hop count | Distance-vector |
| OSPF | Cost, commonly bandwidth-derived | Link-state |
| EIGRP | Composite: mainly bandwidth and delay | Advanced distance-vector |
| BGP | Path attributes and policy | Path-vector |
Local or Remote?
Before sending an IPv4 packet, a host compares the destination address with its own address and subnet mask. This determines whether delivery is local or requires the default gateway.
For a local destination, the host uses ARP to discover the destination host’s MAC address and sends the frame directly. For a remote destination, it keeps the remote host’s IP address in the packet but uses ARP to discover the default gateway’s MAC address. The switch simply carries that frame to the router.
Direct delivery
Packet destination IP is the host; first-frame destination MAC is that same host’s MAC.
Gateway delivery
Packet destination IP remains the remote host; first-frame destination MAC is the default gateway interface.
Packet-Hop Animator
End-to-end delivery is a repeating cycle of encapsulation, forwarding, decapsulation, route lookup, and re-encapsulation. The packet travels across networks, while each Ethernet frame exists only on its current local link.
Host A first decides that Host B is remote, resolves its gateway with ARP, and places the IP packet inside a frame addressed to Router 1. The router removes that frame, checks the packet, decreases TTL, selects a route, resolves the next-hop MAC if necessary, and builds a new frame. This process repeats until the destination network is reached.
Use the animator to follow the sequence one action at a time.
What Changes at Each Hop?
Routing preserves the logical conversation while adapting delivery to each physical or data-link segment. This is why IP and MAC addresses behave differently across a routed path.
The source and destination IP addresses normally remain Host A and Host B from end to end. By contrast, source and destination MAC addresses are meaningful only on one local Ethernet link and are replaced at every routed hop. Because a new frame is created, its Frame Check Sequence (FCS) is recalculated. The router also decreases TTL to prevent indefinite routing loops.
| Field/object | End-to-end | Per-hop behavior |
|---|---|---|
| Source IP | Normally remains Host A | Not replaced by router |
| Destination IP | Normally remains Host B | Used for each route lookup |
| Source MAC | Changes | Sender on current link |
| Destination MAC | Changes | Next hop on current link |
| Ethernet FCS | Recalculated | New frame, new check |
| TTL | Decreases | Reduced by each router |
ARP, Failures & Return Path
A correct route does not by itself guarantee successful forwarding. The router must resolve the next hop on the outgoing local network, the packet must retain a usable TTL, and the destination must have a valid path back.
ARP resolves an on-link IPv4 address to a MAC address. ARP broadcasts remain on the local Layer 2 segment; routers do not forward them across networks. If next-hop resolution fails, the router cannot construct the outgoing frame even when its routing table contains the correct route.
Routing is bidirectional from an application’s perspective. A request can reach a server yet still time out if the server or an intermediate router lacks a return route, or if a firewall blocks the reply. Expand the cases below to connect routing decisions with common symptoms.
Static versus Dynamic Routing
Static and dynamic routing solve the same reachability problem in different ways. The right choice depends on network size, rate of change, redundancy needs, operational simplicity, and control requirements.
A static route is predictable and consumes no routing-protocol bandwidth, making it useful for small stable networks, stub networks, and controlled paths. Its weakness is maintenance: a topology change does not automatically produce a new path. A dynamic routing protocol exchanges information and responds to failures, but introduces configuration complexity and control-plane overhead.
A floating static route combines both approaches. It has an AD higher than the preferred dynamic route, so it remains inactive until that route disappears. After a change, routers detect the event, exchange information, recalculate paths, and install consistent routes; this process is called convergence.
Static routing
Low overhead and predictable, but maintenance and failure response are manual unless tracking is configured.
Dynamic routing
Routers exchange and calculate routes, consume control resources, and reconverge after changes.
Floating static
Uses deliberately higher AD so it activates only after the preferred dynamic route disappears.
Convergence
Routers detect change, exchange updates, recalculate, and install consistent routes.
Dynamic Routing Families
Dynamic protocols can be compared by where they operate, what information they exchange, how they calculate paths, and which metric or policy they apply.
Interior Gateway Protocols (IGPs) operate within an autonomous system. RIP is distance-vector and uses hop count. OSPF and IS-IS are link-state protocols that build a topology database and calculate shortest paths. EIGRP is commonly described as advanced distance-vector and uses a composite metric based mainly on bandwidth and delay.
BGP is a path-vector Exterior Gateway Protocol used between autonomous systems. Rather than relying on a simple speed-based metric, it evaluates path attributes and administrative policy. This suits Internet-scale routing, where business relationships and traffic engineering matter as much as raw path length.
PowerShell 7 Practice
Troubleshooting routing works best in a deliberate order: verify local addressing, inspect the routing table, confirm next-hop resolution, test reachability, and then trace the path.
Begin with Get-NetIPConfiguration to confirm the address, prefix, gateway, and interface state. Use Get-NetRoute or route print -4 to verify that a matching route exists. Get-NetNeighbor shows ARP or neighbor-cache state. Finally, Test-NetConnection and tracert help identify whether failure occurs locally or at a later hop.
Get-NetIPConfiguration
Addresses, gateways, interface state
Get-NetRoute -AddressFamily IPv4
IPv4 routing table
Get-NetRoute -DestinationPrefix 0.0.0.0/0
Default route
Get-NetNeighbor -AddressFamily IPv4
ARP mappings
Test-NetConnection 1.1.1.1
Remote reachability and interface
Test-NetConnection example.com -TraceRoute
Routed path
tracert -d 1.1.1.1
Trace without DNS delays
route print -4
Classic IPv4 route table
Exam Check
Use these fifteen questions to check whether you can apply the chapter’s ideas—not merely recall definitions. Pay particular attention to longest-prefix matching, the difference between AD and metric, per-hop frame changes, and return routing.