Week # 14
Computer Communication & Network
www.pctresearchgroup.com
Powerpoint Templates
ACKNOWLEDGMENTS
Mostly adopted from lecture slides by Behrouz A.
Forouzan.
http://www.inetdaemon.com/tutorials/internet/ip/routing/i
nterior_vs_exterior.shtml#sthash.dhDkYN0q.dpuf
Week 14: Course Plan
Routing
Forwarding techniques and process
Unicast routing protocols
Concept of distance vector routing
Routing Information protocol
Two Key Network-Layer Functions
Forwarding: move packets
from router’s input to
appropriate router output
OR the process of sending
a packet on its way
analogy:
Routing: determine route
taken by packets from
source to destination OR
the process of deciding in
which direction to send
traffic
routing: process of
routing algorithms
forwarding: process of
getting through single
interchange
planning trip from source
to destination
Routing
The process of moving data from one network to
another is called routing.
Routing is unnecessary unless you have multiple
networks on different address ranges
If you have different combinations of IP addresses
and subnet masks, you have separate networks
You don't need to run a routing protocol unless you
have multiple networks (and even then, manual
static routes are easier for small networks).
Routing
Once you get beyond three routers, it's time to start
thinking about dynamic routing protocols.
If you are connecting your networks to the Internet,
you will also need to think about running more
than one kind of routing protocol
Delivery of a Packet
The network layer supervises the delivery of a
packet
the handling of the packets by the underlying
physical networks.
The delivery of a packet to its final destination is
accomplished by using two different methods of
delivery
Direct delivery
Indirect delivery
Delivery of a Packet: Direct delivery
In a direct delivery
Direct delivery occurs when the source and
destination of the packet are located on the same
physical network
The sender can easily determine if the delivery is
direct
It can extract the network address of the
destination (using the mask) and compare this
address with the addresses of the networks to
which it is connected
If a match is found, the delivery is direct
Delivery of a packet: Indirect Delivery
In Indirect delivery
If the destination host is not on the same network
as the deliverer, the packet is delivered indirectly
The packet goes from router to router until it
reaches the one connected to the same physical
network as its final destination.
Note that
a delivery always involves one direct delivery
but zero or more indirect deliveries.
the last delivery is always a direct delivery.
Direct and Indirect Delivery
Forwarding Techniques
Next-hop Vs route method
Next-Hop: A technique to reduce the contents of a routing
table
The routing table holds only the address of the next
hop instead of information about the complete route
Route method
Information about the complete route are maintained
Forwarding Techniques
Forwarding Techniques
Network-specific versus host-specific
Host-specific has an entry for every destination
host connected to the same physical network
The destination host address is given in routing table
Host-specific routing is used for purposes such as
checking the route or providing security measures.
Forwarding Techniques
Network-specific versus host-specific
Network-specific: A technique to reduce the routing table
and simplify the searching process
It needs only one entry that defines the address of the
destination network itself
In other words, we treat all hosts connected to the same
network as one single entity
For example, if 1000 hosts are attached to the same
network,
only one entry exists in the routing table instead of
1000.
Forwarding Techniques
Network-specific versus host-specific
Forwarding Process
Assume that hosts and routers use classless addressing because
classful addressing can be treated as a special case of classless
addressing.
In classless addressing, the routing table needs to have one row
of information for each block involved.
Problem: The table needs to be searched based on the network
address (first address in the block)
Unfortunately, the destination address in the packet gives no
clue about the network address.
Forwarding Process
To solve the problem, we need to include the mask (/n) in the
table; we need to have an extra column that includes the mask for
the corresponding block.
A simple forwarding module for classless addressing is shown
Forwarding Process: Example
Make a routing table for router Rl, using the configuration in the
following figure
Forwarding Process: Example
Q: Show the forwarding process if a packet arrives at Rl (Previous
Figure) with the destination address 180.70.65.140.
Answer:
1: Applying the first mask (/26) does not match the corresponding
network address.
2: The second mask (/25) is applied to the destination address.
The result is 180.70.65.128, which matches the corresponding
network address.
The next-hop address (the destination address of the packet in this
case) and the interface number m0 are passed to ARP for further
processing.
Forwarding Process: Example
Q: Show the forwarding process if a packet arrives at Rl (Previous
Figure) with the destination address 201.4.22.35.
Answer:
The router performs the following steps:
1. The first mask (/26) is applied to the destination address. The
result is 201.4.22.0, which does not match the corresponding
network address (row 1).
2. The second mask (/25) is applied to the destination address. The
result is 201.4.22.0, which does not match the corresponding
network address (row 2).
3. The third mask (/24) is applied to the destination address.
The result is 201.4.22.0, which matches the corresponding
network address.
The destination address of the packet and the interface
number m3 are passed to ARP.
Forwarding Process: Example
Q: Show the forwarding process if a packet arrives at Rl (Previous
Figure) with the destination address 18.24.32.78.
Answer:
All masks are applied, one by one, to the destination address,
but no matching network address is found.
When it reaches the end of the table, the module gives the nexthop address 180.70.65.200 and interface number m2 to ARP.
This is probably an outgoing package that needs to be sent, via the
default router, to someplace else in the Internet
Internet as a Graph
To find the best route, an internet can be modeled as a graph.
A graph is a set of nodes and edges (lines) that connect the nodes.
Think of each router as a node and each network between a pair of
routers as an edge.
An internet is, in fact, modeled as a weighted graph, in which each
edge is associated with a cost.
Least Cost Routing
In a weighted graph, one of the ways to interpret the best
route from the source router to the destination router is to find the
least cost between the two.
In other words, the source router chooses a route to the destination
router in such a way that the total cost for the route is the least
cost among all possible routes.
In previous Figure, the best route between A and E is A-B-E, with
the cost of 6.
This means that each router needs to find the least-cost route
between itself and all the other routers to be able to route a
packet using this criteria.
Least Cost Trees
If there are N routers in an internet, there are (N − 1) least-cost
paths from each router to any other router.
This means we need N × (N − 1) least-cost paths for the whole
internet.
If we have only 10 routers in an internet, we need 90 least-cost
paths.
A better way to see all of these paths is to combine them in a leastcost tree.
A least-cost tree is a tree with the source router as the root that
spans the whole graph (visits all other nodes) and in which the path
between the root and any other node is the shortest.
In this way, we can have only one shortest-path tree for each node;
we have N least-cost trees for the whole internet.
Least Cost Trees
Her seven least-cost trees for the internet in Previous Figure
An internet is a combination of networks connected
by routers.
When a datagram goes from a source to a destination,
it will probably pass through many routers
until it reaches the router attached to the
destination network.
Today, an internet can be so large that one routing
protocol cannot handle the task of updating the routing
tables of all routers.
For this reason, an internet is divided into
autonomous systems
Autonomous Systems
Group of networks and routers under the authority of a single
administration is called an Autonomous System
Routing inside an autonomous system is called intra-domain or
Interior routing.
Routing between autonomous systems is called inter-domain
Exterior routing
Unicast Routing Protocols
A routing table can be either static or dynamic.
A static table is one with manual entries.
A dynamic table is one that is updated automatically
when there is a change somewhere in the Internet.
A routing protocol is a combination of rules and
procedures that lets routers in the Internet inform each
other of changes
Routing protocols are needed to create the routing
tables dynamically
Unicast Routing Protocols
In unicast routing, the message is sent from one source to
one destination (routed hop-by-hop).
When a router receives a packet it forwards the packet
through only one of its ports (the one belonging to the
optimum path) as defined in routing table
The packet may be discarded if the route couldn’t be
constructed
Popular Routing protocols
30
Interior Routing Protocols (IGP)
Routing inside an autonomous system
Categories
Distance vector protocols: router knows physically-connected
neighbors, link costs to neighbors, iterative process of computation,
exchange of partial information with neighbors
Routing Information Protocol (RIP)
Link State Protocols: all routers have complete topology, link cost
information
Open Shortest Path First (OSPF)
Exterior routing Protocols (EGP)
Routing between autonomous systems
To get from place to place outside ones network(s), i.e. on the
Internet, one must use an Exterior Gateway Protocol.
EGPs handle routing outside an Autonomous System and get
one from ones network, through ones Internet provider's
network and onto any other network.
Examples of EGP
Border Gateway Protocol (BGP) [A Path vector protocol]
Application of Exterior and Interior
Routing Protocols
Chapter 11 Interior Routing Protocols
33
Metric of different Routing Protocols
Metric is the cost assigned for passing through a
network
The total metric of a particular route is equal to the sum
of the metrics of networks that comprise the route.
A router chooses the route with smallest metric.
RIP (Routing Information Protocol): the cost of
passing each network is one hop count
If a packet passes through 10 networks to reach the
destination, the total cost is 10 hop counts.
34
Metric of different Routing Protocols
OSPF (Open Shortest Path First)
Administrator can assign cost for passing a network
based on type of service required.
OSPF allows each router to have more than one
routing table based on required type of service, such as
Maximum throughput or minimum delay.
BGP (Border Gateway Protocol)
Criterion is the policy, which is set by the administrator.
35
Distance Vector Routing
Each node maintains a set of triples (Destination, Cost,
NextHop)
Node knows the cost to each neighbor
Directly connected neighbors exchange updates
periodically (on the order of several seconds -30s-)
whenever table changes (called triggered update)
Each update is a list of pairs:
(Destination, Cost)
Update local table if a better route is received
smaller cost
came from next-hop
Refresh existing routes; delete if timed out
36
Bellman-Ford Equation
Heart of distance vector routing
Used t find the least cost (shortest distance) between a source
node, x, and a destination node, y, through some intermediary
nodes (a, b, c, . . .)
when the costs between the source and the intermediary nodes
and the least costs between the intermediary nodes and the
destination are given.
Dxy = min{(cxa + Day), (cxb + Dby), (cxc + Dcy), …}
In distance-vector routing, normally update an existing least cost
with a least cost through an intermediary node, such as z,
if the latter is shorter.
So the equation becomes simpler as Dxy = min{Dxy, (cxz + Dzy)}
Bellman-Ford Equation
Distance Vector Corresponding to a Tree
Do these distance vectors represent least-cost paths?
They do, considering the limited information a node has.
When we know only one distance between two nodes, it is the least
cost.
Initial Distance Vector for an internet in
the Figure
Updating Distance Vectors
Distance Vector Routing:
Table Initialization
42
Distance Vector Routing: Sharing
43
Distance Vector Routing: Updating
In distance vector routing, each node shares its routing table
with its immediate neighbors periodically and when there is a
change
44
Updating Routing Table
If the next-node entry is different
The receiving node chooses the row with the smaller cost
If there is a tie, the old one is kept
If the next-node entry is the same
i.e. the sender of the new row is the provider of the old entry
The receiving node chooses the new row, even though the
new value is infinity.
When to Share
Periodic Update
A node sends its routing table, normally 30 seconds, in
a periodic update
Triggered Update
A node sends its routing table to its neighbors any time
when there is a change in its routing table
1. After updating its routing table, or
2. Detects some failure in the neighboring links
Count to Infinity
A problem with distance-vector routing is that
any decrease in cost (good news) propagates quickly,
but any increase in cost (bad news) will propagate slowly.
For a routing protocol to work properly, if a link is broken
(cost becomes infinity),
every other router should be aware of it immediately,
but in distance-vector routing, this takes some time.
The problem is referred to as count to infinity
It sometimes takes several updates before the cost for a
broken link is recorded as infinity by all routers.
Count to Infinity: Two node loop
Most implementations define 16 as infinity
Solutions for Two-Node Instability
Split Horizon
Split horizon is a method of preventing a routing loop in a
network.
Simple principle: Information about the routing for a
particular packet is never sent back in the direction from
which it was received.
So, instead of flooding the table through each interface,
each node sends only part of its table through each
interface
E.g. node B thinks that the optimum route to reach X is
via A, it does not need to advertise this piece of
information to A
Solutions for Two-Node Instability
One drawback of Split Horizon
Normally, the DV protocol uses a timer and if there is
no news about a route, the node deletes the route from
its table
In the previous e.g., node A cannot guess that this is
due to split horizon or because B has not received any
news about X recently
Solutions for Two-Node Instability
Poison Reverse
Node B can still advertise the value for X,
but if the source of information is A, it can replace the
distance with infinity as a warning “Do not use this
value; what I know about this route comes from
you.”
informing all routers that the path back to the
originating node for a particular packet has an infinite
metric
Split horizon with poison reverse is more effective
than simple split horizon in networks with multiple
routing paths,
although it affords no improvement over simple split
horizon in networks with only one routing path
Routing Information Protocol (RIP)
Routing Information Protocol
The Routing Information Protocol (RIP) is an intra-domain
(interior) routing protocol used inside an autonomous
system.
It is a very simple protocol based on distance vector
routing.
RIP implements distance vector routing directly with some
considerations.
Routing Information Protocol
The destination in a routing table is a network, which
means the first column defines a network address
The metric used is distance (hop count) which is defined
as the number of links (networks) to reach the destination.
Infinity is defined as 16, which means that any route
in an autonomous system using RIP cannot have more
than 15 hops.
The next-node column defines the address of the router to
which the packet is to be sent to reach its destination
RIP Operation
Router sends update message to neighbors every
30 sec
A router expects to receive an update message
from each of its neighbors within 180 seconds in
the worst case
If router does not receive update message from
neighbor X within this limit, it assumes the link to
X has failed and sets the corresponding minimum
cost to 16 (infinity)
Based on convergence speeded up by triggered
updates
neighbors notified immediately of changes in
distance vector table
55
Example of a domain using RIP
Autonomous system with seven networks and four routers with
table of each router.
Routing table for Rl has seven entries to show how to reach each
network in the autonomous system.
Router is directly connected to networks 130.10.0.0 and
130.11.0.0 which means that there are no next-hop entries for
these two networks.
RIP Updating Algorithm
Receive a response RIP message
1. Add one hop to the hop count for each advertised destination.
2. Repeat the following steps for each advertised destination:
If (destination is not in the routing table)
Add the advertised information to the table.
Else
If (next-hop field is the same)
Replace entry in the table with the new one.
Else
If (new hop count < the one in the table)
Replace entry in the routing table.
57
Example of updating a routing table
Initial routing tables in a small
autonomous system
Final routing tables (previous figure)
RIP is implemented as a process that uses the services of
UDP on the well known port 520
It runs in the background (a daemon process)
RIP routing protocol helps IP in routing datagrams
through AS
So RIP messages are encapsulated inside UDP user
datagrams; which in turn are encapsulated inside IP
datagrams
Two versions are RIP-1 and RIP-2
RIP-2 is backward compatible with RIP-1
© Copyright 2026 Paperzz