Network Layer
Network Layer
Introduction
Datagrams and Virtual Circuits
Routing
Traffic Control
Kithsiri M. Liyanage
Department of Electrical and Electronic Engineeirng
University of Peradeniya
Introduction
Switching Technique:
Datagrams
Virtual circuits
Routing:
How to forward packets
How to calculate a path from source to destination?
Traffic Control:
Congestion control
Rate control
Naming and Addressing:
How to find the name of a network node?
Internetworking:
How to interconnect heterogeneous networks?
Datagrams
- Virtual Circuits
2 services are provided to the transport layer:
Connectionless Service
Sender and receiver treat each transmitted message
as an independent unit
Connection-oriented Service
Datagram Packet-Switching
Virtual-Circuit Packet Switching
Each packet is routed independently
Connectionless Service
Connection-oriented Service
10
Summary
The following implementations are feasible:
Connectionless service
Packet Routing
Connection-oriented service
Reliable
Unreliable
Reliable
Unreliable
11
12
13
14
nin, ...
nin)
nout
n
15
16
Comparison
Routing Algorithms
Objective of routing algorithms is to calculate `good
routes
Routing algorithms for both datagrams and virtual
circuits should satisfy:
- Correctness
- Simplicity
-Stability
-Robustness
- Fairness
- Optimality
Impossible to satisfy everything at the same time
17
18
150 kbps
D
C
200 kbps
19
20
Shortest-Path Routing
Optimization Criteria:
- Number of Hops - Cost
- Delay - Throughput
Decision Time:
Once per session (VCs)
Once per packet (datagram)
2. Protocol
- Nodes disseminate the measured information to other
nodes
Decision Place:
Each node (distributed routing)
Central node (centralized routing)
Sending node (source routing)
3. Calculation
- Nodes run a least-cost routing algorithm to recalculate
their routes
21
22
Parameters:
dij cost of link between node i and node j;
dij = , if nodes i and j are not connected;
dii = 0
N set of nodes
23
24
26
Example Network
Dijkstras Algorithm
Finds the shortest path from a source node to all other
nodes
s source node
Dn cost of the least-cost path from node s to node n
M = {s};
for each n M
Dn = dsn;
while (M all nodes) do
Find w M for which Dw = min{Dj ; j M};
Add w to M;
for each n M
Dn = min w [ Dn, Dw + dwn ];
Update route;
enddo
27
28
1, 4
1, 4, 2
{ 1, 4, 2, 5}
5
5
{ 1, 4, 2, 5. 3} { 1, 4, 2, 5. 3, 6} -
Bellman-Ford Algorithm
29
Bellman-Ford Algorithm
30
step 1 [Initialization]
L0(n) = , for all n s
Lh(s) = 0, for all h
step 2 [Update]
32
Lh(6) Path
1 2
1-2
1-3
1-4
2 2
1-2
1-4-3
1-4
1-4-5
10
1-3-6
3 2
1-2
1-4-5-3
1-4
1-4-5
1-4-5-6
4 2
1-2
1-4-5-3
1-4
1-4-5
1-4-5-6
33
34
35
36
Messages
Nodes exchange messages to their neighbors.
If node v sends a messages to node x of the form, [m
, Dm (v)], this means
>
38
39
Operations at node v
1. Add new row in distance and routing table, and
new column to distance table
2. Recalculate distance table under consideration of
l(m,v)
3. Compute minw Cm(v,w):
(a)If no changes to previous value of minw m(v,w):
Do nothing
(b) If Cm(v, m) = minw Cm(v,w)
Dm(v)=Cm(v,m) change entry in m-th row of
routing table to (m, , Dm(v)) and send message
[m, Dm(v)] to all neighbors
3. Also: Since v is a neighbor of m, v sends the
contents of its routing table to m: [a, Da(v)], [b,
Db(v)], ...., [z, Dz(v)]
40
Operations at node v
1. Entries in m-th column of distance table are
changed by D (if link goes down: D = ).
2. For all destinations d:
Compute minw Cm(v,w):
(a)If no changes to previous value of
minw Cm(v,w):
Do nothing
(b) If Cm(v, m) = minw Cm(v,w)
Change entry in d-th row of routing table to
(m,Cd(v, m)), and send messages
[d, Cd(v, m)] to all neighbors
41
42
44
Example
Example
Assume that Node 1 comes up at time t=0
Show how the entries for destination 1 are updated at
all other nodes
45
46
48
Traffic Control
49
What is Congestion ?
50
51
52
Effects of Congestion
Congestion occurs if Load 1
53
Loss of Efficiency
54
Unfairness
55
56
57
CONGESTION CONTROL
58
60
Back Pressure
Leaky Bucket
Token bucket
61
62
Congestion Signaling
Choke Packets
If a packet enters a node and the queue length of the
outgoing buffer exceeds a threshold, the node sends
a choke packet to the source node
63
64
Congestion Signaling
Preallocation of Buffers
Forwards
Congestion avoidance in the same direction as packet
is required
Packet Discarding
66
67
68
Leaky Bucket
69
70