Datagram Forwarding: Asst. Prof. Chaiporn Jaikaeo, PH.D
Datagram Forwarding: Asst. Prof. Chaiporn Jaikaeo, PH.D
Adapted from the notes by Lami Kaya and lecture slides from Anan Phonphoem
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.
© The McGraw-Hill Companies, Inc.
Outline
Datagram forwarding/routing
IP Datagram
Fragmentation
2
Node-to-node delivery
4
Forwarding IP Datagram
BKK
123.10.0.0/16 Internet
A SKL
B
C
203.45.98.0/24
X
Y
6
Next-Hop Forwarding
Alaska
Germany
New York
Bangkok
Bangkok Germany
Bangkok
New
Alaska
York Alaska
Next hop keep changing
7
Source Independence Routing
Next hop depends on
destination network of the packet
Not the source!
Source Independence
8
Example: IP Routing Table
Router# show ip route
9
Packet forwarding (Routing)
Router reads destination IP address
Router finds out the network address
destination IP & Mask network address
192.4.10.15 & 255.255.255.0 192.4.10.0
192 4 10 15
1100 0000 0000 0100 0000 1010 0000 1111 &
255 1111 1111 1111 1111 1111 1111 0000 0000
1100 0000 0000 0100 0000 1010 0000 0000
10
Longest Prefix Match
Internet forwarding tables can contain a default
entry
that provides a path for all destinations that are not
explicitly listed
A network manager can specify a host-specific
route
it directs traffic destined to a specific host along a
different path than traffic for other hosts on the same
network
An important feature of an Internet forwarding
table is that address masks can overlap
11
Example: Longest Prefix Match
Router A's routing table contains two entries
128.10.0.0/16 to Router B
128.10.2.0/24 to Router C
Router A receives a packet destined to 128.10.2.3
Both entries match the destination address
Which entry should be used?
The one with the longest prefix
Router A will choose the entry that corresponds to
128.10.2.0/24
The packet is sent out to Router C
12
Dynamic Routing
How is the routing table constructed anyway?
Network admin inputs manually too much work!
Routers contain special software running a routing
protocol for automatic route computation
Route computation works on a graph that models
the network
Each node corresponds to a packet switch
(individual computers are not part of the graph)
An edge (link) denotes a direct connection between
a pair of packet switches
13
Modeling Network
node
Edge
A Graph representation
Network
14
Routing Table
node
Edge = (u,v)
15
Default Routes
• One default
• Lowest priority
> 1 destination with same next-hop
16
Routing Table Construction
Static Routing
Manual configure
Simple and low overhead
Inflexible
Dynamic Routing
Automatic changing
Change according to network problems
Mostly use
17
Distributed Route Computation
In practice, networks need to perform
distributed route computation
All packet switches must participate in distributed
route computation
No central entity to do computation
There are two general forms:
Link-State Routing (LSR)
Distance-Vector Routing (DVR)
18
Link-State Routing (LSR)
Also known as Shortest Path First (SPF) routing
Dijkstra algorithm used it to characterize the way it works
To use LSR, packet switches periodically send messages
across the network that carry the status of a link
Every switch collects
incoming status messages
and uses them to build
a graph of the network
19
Dijkstra's Algorithm
Uses a greedy
approach to select
the next node into
the shortest path
tree
Assumes non-
negative weight
edges
20
Dijkstra’s Algorithm Animation
http://www-b2.is.tokushima-u.ac.jp/~ikeda/suuri/dijkstra/Dijkstra.shtml
21
Distance Vector Routing (DVR)
Uses Distributed Bellman-Ford Algorithm
Like LSR, DVR arranges for packet switches to
exchange messages periodically
In DVR, a switch sends a complete list of
destinations and the current cost of reaching each
When it sends a DVR message
a switch is sending a series of individual statements, of
the form:
“I can reach destination X, and its current distance
from me is Y”
22
DVR Concept
23
Hop Count
2 hops
1 hop
24
Routing table distribution
25
Updating routing table
For router A
26
Final routing tables
27
Updating the routing table
Example
28
Routing Problems
In theory, either LSR or DVR will compute shortest paths
Furthermore, each approach will eventually converge
meaning that the forwarding tables in all packet switches agree
However, problems do occur
For example, if LSR messages are lost, two packet switches can
disagree about the shortest path
DVR problems can be more severe
because a link failure can cause two or more packet switches to
create a routing loop
in which each packet switch thinks the next packet switch in the set is
the shortest path to a particular destination
As a result, a packet can circulate among the switches indefinitely
29
IPv4 Datagram
30
IP Datagram (IPv4)
Payload
Overhead
31
IP Datagram
Version
Header Length
unit: 4-byte word
Normally: 5
Type of Services
prioritize, routing
Datagram Length (data + header)
Size limitation
32
IP Datagram
Fragmentation ID Fragmentation
Break/Group
Flag and Offset
Control
MTU
Maximum Transmission Unit
33
Fragmentation
Application Data
IP
Payload
Header
IP
Payload
Header
Smaller MTU
IP Pay
Header load
IP
Payload
Header
IP
Payload
Header
IP Pay
Header load
35
IP Datagram
TTL
avoid looping
hop count (not
time count)
TCP (60)
36
IP Datagram
Protocol
identify the protocol in payload
38
IP Address
32 bits
32 bits
39