0% found this document useful (0 votes)
12 views8 pages

Understanding Routing: Static vs Dynamic

Routing is the process by which routers determine the best path for packets to reach their destination using routing tables. There are two main methods of routing: dynamic routing, which uses protocols to automatically share routing information, and static routing, which requires manual configuration. The document also covers the configuration of static routes, the differences between dynamic and static routing, and various routing protocols and their metrics.

Uploaded by

vishwa 7dcap
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views8 pages

Understanding Routing: Static vs Dynamic

Routing is the process by which routers determine the best path for packets to reach their destination using routing tables. There are two main methods of routing: dynamic routing, which uses protocols to automatically share routing information, and static routing, which requires manual configuration. The document also covers the configuration of static routes, the differences between dynamic and static routing, and various routing protocols and their metrics.

Uploaded by

vishwa 7dcap
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

routing:

routing is the process that router do to select a best path for a packet to
reach
its destination across a network.

Router uses routing tables that contains the destination ip network address and
next hop address(next
device on the way to reach the destination).

There are two main routing methods (methods that routers use to learn routes):

DYNAMIC ROUTING : ROUTERS use Dynamic Routing Protocols (ie: OSPF) to share routing
information with each other automatically and build their routing tables.
STATIC ROUTING : A network engineer / Admin manually configures routes on the
router.

A ROUTE tells the ROUTER :

to send a packet to Destination X, you should send the pack to next-hop Y


or if the Destination is directly connected to the router(connected routes), send
the packet directly to the destination.
or if the Destination is the router’s own IP address(local route), receive the
packet for yourself (don’t forward it).

when you configure the ip address on the router interface and enable the
iinterface, two routes will be automatically
added to the routing table: connected routes and local route.

local route will be the configured ip address to the interface. (a /32 for that
IP).
connected route will be network address of the configured ip address to the
interface. (e.g., [Link]/24).
If an interface is down/disabled, its connected & local routes do not show.
eg:
C [Link]/24
L [Link]/32
C [Link]/24
L [Link]/32

Routers only know about their own interfaces/networks;


they cannot forward to remote networks unless they have routes to them.
if a router receives a packet with unknown destination ip, it will drop the packet
unless it have default route configured.
if a switch receives a frame with unknown destination mac, it will flood or
broadcast the frame to all its interface except it received from.

default gateway:
End hosts use a default gateway (router IP) to send packets outside their local
network.

Default route:
Default route on a router = route to [Link]/0 (covers all IPv4 addresses).

Most-specific rule reminder:


Router looks for the most specific matching route (longest prefix).
/32 is most specific (single host).
/0 is least specific (matches everything).
Planning static routes for multi-hop reachability:
To enable end-to-end communication (e.g., PC1 ↔ PC4) you need two-way
reachability such that replies can be returned.
Not every router needs routes to all networks in the topology — only enough to
forward toward the destination (next-hop).
Example two alternate paths from PC1 to PC4:
Path A: PC1 → R1 → R3 → R4 → PC4 (video uses this path)
Path B: PC1 → R1 → R2 → R4 → PC4
When using static routes you must choose / plan the next-hops used.

Example next-hop planning from video (path via R3):


To route [Link]/24 via R3:
R1: next-hop = [Link] (R3 G0/0)
R3 needs:
Route to [Link]/24 → next-hop [Link] (R1 G0/0)
Route to [Link]/24 → next-hop [Link] (R4 G0/1)
R4 needs:
Route to [Link]/24 → next-hop [Link] (R3 G0/1)
(These were the exact next-hops used in the video when selecting path via R3.)

Configuring static routes on Cisco IOS — syntax:

Basic syntax (global config):


ip route <destination-network> <netmask> <next-hop-ip>

Example from video:


On R1:
ip route [Link] [Link] [Link]
After configuration, static routes display with code S in the routing table.
You may see two bracketed numbers after the route (administrative distance /
metric) — video mentions these but defers explanation.

Packet forwarding and encapsulation — Layer 2 vs Layer 3:


IP addresses (Layer 3) in the packet do not change as the packet traverses
routers.
router will receive the packet and de encapsulate the packet to see the
destination ip and add the next destination mac address to reach the destination
ip.
And forward it after encapsulating back.

Ethernet frame headers (Layer 2) are replaced at every hop:


PC1 → R1: source MAC = PC1 MAC; dest MAC = R1 G0/2 MAC
R1 → R3: frame dest MAC = R3 G0/0 MAC
R3 → R4: frame dest MAC = R4 G0/1 MAC
R4 → PC4: dest MAC = PC4 MAC (only time dest IP and dest MAC are the same
device)
Each router de-encapsulates (strips L2) and re-encapsulates in a new frame for
the next hop.

Static route configuration alternatives (next-hop / exit-interface / both)

Next-hop only (recommended / common):


ip route <net> <mask> <next-hop-ip>

Exit-interface only:
ip route <net> <mask> <interface>
Example: ip route [Link] [Link] g0/0
If you specify only exit-interface, IOS displays that route as directly
connected in the routing table even though the destination network isn't directly
connected. This relies on Proxy ARP.

Both exit-interface and next-hop:


ip route <net> <mask> <interface> <next-hop-ip>
Example from video (R2 sending to R4):
ip route [Link] [Link] g0/1 [Link]

Notes:
Proxy ARP is behind the scenes when exit-interface-only static routes are used;
it's beyond CCNA scope but be aware it exists.
Generally safe to use next-hop only or both; exit-interface-only is less
explicit.

Default route on a router (gateway of last resort)

Configure as a normal static route but destination + mask are [Link]:


ip route [Link] [Link] <next-hop-ip>

Example:
ip route [Link] [Link] [Link]
In show ip route you may see an asterisk * marking candidate default routes and
a message Gateway of last resort is <ip> to network [Link]
Common use: send all “unknown” (non-internal) traffic to the Internet.

we can configure multiple routes to same destination network and say use route 1 as
main and route 2 as backup(or load balancing)

show commands:
show ip route — view routing table (codes C, L, S, asterisks, gateway of last
resort)
show ip interface brief — interface status & IPs
ping <ip> — test reachability

Dynamic vs. Static Routing:

Static routing involves manually configuring routes for each destination network
using the IP ROUTE command.
Dynamic routing involves configuring a dynamic routing protocol on the router,
which then automatically finds the best paths to destination networks.

Key Benefits of Dynamic Routing:

Automatic Path Discovery: Routers automatically inform each other about how to
reach new networks.
Fault Tolerance: If a path becomes unavailable, routers automatically switch to the
next-best path. This prevents traffic from being sent to dead ends.

How it Works:

Routers use dynamic routing protocols to advertise their connected routes and
routes they have learned from other devices.
They form adjacencies (also known as neighbor relationships or neighborships) with
directly connected routers to exchange this information.
If a router learns multiple routes to the same destination, it uses a metric to
determine which route is superior. A lower metric value is always preferred.

Network Routes vs. Host Routes

Network Route: A route to a network or subnet. It is a route with a mask length


less than /32. Example: [Link]/24.
Host Route: A route to a single, specific host. It is specified with a /32 mask.
These are automatically added for interfaces with an IP address, but can also be
statically configured.

Types of Dynamic Routing Protocols

Dynamic routing protocols are divided into two main categories:

Interior Gateway Protocol (IGP):


Used to share routes within a single Autonomous System (AS), which is typically a
single organization or company.
Examples: RIP, EIGRP, OSPF, and IS-IS.

Exterior Gateway Protocol (EGP):


Used to share routes between different Autonomous Systems.
The only EGP in modern use is BGP (Border Gateway Protocol).

Algorithm Types (within IGPs):

Distance Vector:

Invented in the early 1980s.


Operate on the principle of "routing by rumor." Routers only know the information
their directly connected neighbors tell them.
They learn the "distance" (metric) and the "vector" (direction, or next-hop router)
to a destination.
The protocols are RIP and EIGRP.

Link State:

Each router creates a complete "connectivity map" of the entire network.


Routers advertise information about their own interfaces and connected networks,
and these advertisements are passed to all other routers in the network.
Each router independently uses the map to calculate the best routes.
They use more CPU and memory resources but are faster at reacting to network
changes.
The protocols are OSPF and IS-IS.

Path Vector:

The only algorithm type used by EGPs.


BGP is the only protocol that uses this algorithm.

Metric
Purpose: Used to compare multiple routes to the same destination that are learned
from the same routing protocol. The route with the lowest metric is considered the
best and is placed in the routing table.
Equal Cost Multipath (ECMP): If a router learns two or more routes to the same
destination with the same metric, both routes are added to the routing table.
Traffic is then load-balanced over all of those equal-cost paths. This applies to
both dynamic and static routes.

Different Metrics for Different Protocols:

RIP: Uses hop count. Each router in the path is one hop. It's a simple and
primitive metric because it doesn't consider link speed.

EIGRP: Uses a complex calculation based on bandwidth and delay by default. Only the
bandwidth of the slowest link is used, but the total delay of all links is
considered.

OSPF: Uses cost, which is calculated based on bandwidth. A higher bandwidth link
has a lower cost.

IS-IS: Also uses cost, with a default cost of 10 for all links. Without
configuration, it functions like a hop-count metric.

Static Routes: The metric for static routes is always 0.

Administrative Distance (AD)

Purpose: Used to compare routes to the same destination that are learned from
different routing protocols. Since metrics from different protocols are not
comparable, AD provides a single value to determine which protocol is more
trustworthy.
Preference: A lower AD is always preferred and indicates a more trustworthy routing
source.

AD Values to Memorize:

0: Connected route
1: Static route
20: External BGP (eBGP)
90: EIGRP
100: IGRP (older version of EIGRP)
110: OSPF
115: IS-IS
120: RIP
170: EIGRP External
200: Internal BGP (iBGP)
255: Unusable (the router will not believe the source and won't install the route)

Changing AD: The AD of a static route can be manually changed. This creates a
"floating static route", which is a backup route that only appears in the routing
table if the primary route (learned via a dynamic routing protocol with a lower AD)
becomes unavailable.

Set the AD: if the router uses ospf, For backup static route, a custom
administrative distance of 111 is used. This value is higher than OSPF's AD of 110,
ensuring the static route is only used as a backup.

RIP - Routing information protocol(industry stardard not from cisco)

algorithm: it uses distance vector algorithm from IGP(routing by rumor logic to


learn/share routes)
metric: uses hop count as its metric. one router = one hop(bandwidth is
irrelevant)
maximum hop count is 15. anything more than that is considered
unreachable. so only suitable for small networks.
versions: RIPv1, and RIPv2 for IPV4. RIPng(RIP Next Generation) for IPV6.

message types: request: to ask Rip enabled neighbor routers to send their
routing table.
response: to send the local router's routing table to
neighboriong routers.

by default Rip enabled routers will share their routing table every 30 seconds.

Entering RIP mode

Command: router rip


This puts you into RIP config mode (config-router).

Use RIP Version 2

Command: version 2
RIP v1 is outdated (classful only).
RIP v2 supports VLSM and CIDR (needed in modern networks).

Turn off auto-summarization

Command: no auto-summary
RIP normally converts networks to their classful boundaries (e.g. [Link]/28
→ [Link]/16).
That causes problems, so always disable it.

The network command

Example: network [Link]

Important point: The command is classful.


[Link] or [Link] still gets interpreted as [Link]/8.
So the router checks all interfaces that start with 10.x.x.x.
If an interface matches, RIP is enabled on that interface.
Sends RIP update messages (UDP, port 520) out of that interface.

The network command only decides which interfaces will participate.


The actual advertisements are the subnet prefixes of those interfaces.
RIP doesn’t say “I have [Link]/8.” Instead, it says “I have [Link]/30,
[Link]/30, and [Link]/28.”

👉 What this does:

Activates RIP on the interface.


Forms RIP neighbor relationships on that interface.

Passive Interfaces

If an interface has no RIP neighbors, sending RIP updates out is wasted


bandwidth.
Command: passive-interface g2/0
This stops RIP updates from going out that interface, but the network is still
advertised to other neighbors.
A passive interface is an interface on a router where routing updates are not
sent out, but the router can still receive routing updates
or advertise the connected network into the routing protocol.

In other words:
✅ The network on that interface is still included in the routing table and
advertised.
❌ But no periodic updates (like RIP, OSPF hellos, EIGRP hellos) are sent out that
interface.

Default Route Advertisement

Suppose R1 has an Internet connection ([Link]/0 static route).


You can make R1 advertise this to RIP neighbors:

Command: default-information originate


Now, R2, R3, and R4 learn the default route from R1, so they can reach the
Internet.

Load Balancing in RIP

RIP does Equal-Cost Multi-Path (ECMP) load balancing.


By default, up to 4 equal-cost paths go into the routing table.
You can change this with: maximum-paths [1–32].

RIP doesn’t care about bandwidth – it only looks at hop count.


Even a slow FastEthernet and a fast Gigabit Ethernet link are treated equally
if they’re the same hop count.

What does R1 advertise?

👉 Even though you entered network [Link], R1 does NOT advertise the whole
[Link]/8.
It advertises only the prefixes of its active interfaces:

To both R2 and R3 (neighbors on [Link]/8 range):

[Link]/30 (network of G0/0)


[Link]/30 (network of G1/0)
[Link]/28 (network of G2/0, even though it’s passive, still advertised)
[Link]/0 (default route, because of default-information originate)

What R2 sees in its routing table:

Since R2 is directly connected to [Link]/30, it will ignore it. because its


already knows that one locally.
But from R1, it learns:

R [Link]/30 [120/1] via [Link] ← "there’s a way to reach R3’s link


through R1"
R [Link]/28 [120/1] via [Link] ← "there’s a LAN behind R1"
R [Link]/0 [120/1] via [Link] ← "send unknown traffic to R1 for
Internet"
What R3 sees in its routing table:

Similarly, R3 is directly connected to [Link]/30, it will ignore it. because


its already knows that one locally.
But from R1, it learns:

R [Link]/30 [120/1] via [Link] ← "there’s a way to reach R2’s link


through R1"
R [Link]/28 [120/1] via [Link] ← "there’s a LAN behind R1"
R [Link]/0 [120/1] via [Link] ← "send unknown traffic to R1 for
Internet"

About the ISP link ([Link]/30)

if you add network [Link] under RIP, the ISP ([Link]) will ignore RIP
updates, because ISPs don’t run RIP with customers.
ISPs use BGP (Border Gateway Protocol) to exchange routes.
So your RIP advertisements (like [Link]/28) will not reach the ISP unless
you configure BGP between R1 and ISP.

RIP msg looks like:


RIP Update (sent from R1 → R2):
Entry 1: [Link]/30, metric 1
Entry 2: [Link]/30, metric 1
Entry 3: [Link]/28, metric 1
Entry 4: [Link]/0, metric 1 (if default-information originate is enabled)
🔹 Limits

Each RIP update can carry up to 25 route entries.


If R1 has more than 25 networks to advertise, RIP will split them across multiple
update messages.

You might also like