Cyber Services / All lessons / Diploma in Network Technology / Static & Dynamic Routing

Static & Dynamic Routing

Module 14 of 36 · 4 min read · Free to read

MODULES ↓ Command blocks have a COPY button

Your Gateway to a Career in Network Engineering

Static & Dynamic Routing

A router's core function is to act as a "traffic director" for data, forwarding packets from one network to another. To do this, it consults its internal map, called a **routing table**. But how does a router build this map? It uses one of two methods: Static Routing (being manually given a map) or Dynamic Routing (automatically discovering the map by talking to other routers).

Static Routing: The Hand-Drawn Map

Static routing is the process of manually programming a router with every path it needs to know. You, the network administrator, act as the cartographer, drawing every single road on the router's map.

Advantages and Disadvantages

  • Secure: The router doesn't broadcast its routes, making it invisible to attackers trying to map your network.
  • Efficient: Uses zero router CPU or bandwidth, as there's no communication or calculation needed.
  • Labor-Intensive: In a large network, manually adding or changing routes is a tedious and error-prone process.
  • Not Fault-Tolerant: If a path goes down, the router won't automatically find a new one. The "map" is now wrong until you manually fix it.

Configuration Example

To configure a static route, you tell the router the destination network, its subnet mask, and the IP address of the next router it must send the packet to (the "next hop").

! On RouterA, to reach a network behind RouterB (at 10.0.0.2)
RouterA(config)# ip route 192.168.2.0 255.255.255.0 10.0.0.2
! Syntax: ip route [destination_network] [mask] [next_hop_ip]

Dynamic Routing: The Live GPS

Dynamic routing protocols allow routers to function like a live GPS network. They automatically talk to each other, sharing information about the routes they know. This allows them to build a complete, up-to-date map of the entire network and automatically adapt to changes, like a link going down.

An Introduction to RIP (Routing Information Protocol)

RIP is one of the simplest dynamic routing protocols, making it great for learning. It's a **distance-vector** protocol, which means it chooses the best path based on a single factor: **distance**, which it measures in **hop count** (the number of routers to cross).

It's crucial to distinguish between its two versions, as only RIPv2 is usable in modern networks.

RIPv1 vs. RIPv2
FeatureRIP version 1 (Obsolete)RIP version 2
Class SupportClassful OnlyClassless (Supports Subnetting)
UpdatesBroadcastMulticast (More Efficient)
AuthenticationNoYes (MD5)

Configuration Example (RIPv2)

Configuring RIP is simple. You just tell it which of your own networks to "advertise" to its neighbors.

! On RouterA, connected to the 10.0.0.0 network
RouterA(config)# router rip
RouterA(config-router)# version 2         
RouterA(config-router)# no auto-summary   
RouterA(config-router)# network 10.0.0.0

The Router's Decision: Choosing the Best Route

What happens if a router learns about the same destination from two different sources (e.g., a static route and a RIP update)? It follows two simple rules.

Rule 1: Trustworthiness (Administrative Distance)

First, the router checks the **Administrative Distance (AD)** of the source. AD is a score from 0-255 that rates how trustworthy a routing source is. **The lower the AD, the more the router trusts it.**

Route SourceDefault Administrative Distance (Trust Score)
Directly Connected0 (Perfectly trusted)
Static Route1 (Highly trusted, as an admin set it)
OSPF110
RIP120 (Less trusted than static)

Rule 2: Best Path (Metric)

If a router learns multiple paths to a destination *from the same protocol* (e.g., two different RIP paths), it then uses the **metric** to decide which path is best. For RIP, the metric is simply the hop count. **The lower the metric, the better the path.**

Verification: Reading the Router's Map

The show ip route command displays the router's final routing table—the best routes it has chosen based on AD and Metric.

RouterA# show ip route
Codes: C - connected, L - local, S - static, R - RIP

C        10.0.0.0/24 is directly connected, GigabitEthernet0/1
R        192.168.2.0/24 [120/1] via 10.0.0.2
S        172.16.0.0/16 [1/0] via 10.0.0.2

Decoding the Routing Table

  • The letter at the start tells you how the route was learned (C, S, R).
  • The numbers in brackets [AD/Metric] show the values the router used to make its decision.
  • The RIP route [120/1] has an AD of 120 and a metric of 1 (it's 1 hop away).
  • The Static route [1/0] has an AD of 1 and a metric of 0.
Modules (36) ← Diploma in Network Technology