0% found this document useful (0 votes)
84 views

Network Layer

By Kithsiri M. Liyanage Department of Electrical and Electronic Engineeirng University of Peradeniya

Uploaded by

Chamara Prasanna
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views

Network Layer

By Kithsiri M. Liyanage Department of Electrical and Electronic Engineeirng University of Peradeniya

Uploaded by

Chamara Prasanna
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Network Layer

Introduction
Datagrams and Virtual Circuits
Routing
Traffic Control

Kithsiri M. Liyanage
Department of Electrical and Electronic Engineeirng
University of Peradeniya

Introduction

Issues at the Network Layer

Main Task of the network layer is to move packets from the


source host to the destination host

Switching Technique:
Datagrams
Virtual circuits

Lowest layer to deal with end-to-end issues!

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?

Services and Implementation

Connectionless and Connection-oriented

2 packet switching techniques are used:

Connectionless service and connection-oriented service can be


reliable or unreliable

Datagrams

Reliable = Delivery of all data is ensured. The


receiver acknowledges data and sender retransmits data
that was not received

- 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

Unreliable = No acknowledgments or retransmission


of data
Note: unreliable connectionless service is often called datagram
service

Sender and receiver see data as traveling on a logical


Connection

Receiver receives data in the same order in which


they are transmitted

Datagram Packet-Switching
Virtual-Circuit Packet Switching
Each packet is routed independently

All packets of a VC follow the same route

Connectionless Service

Connection-oriented Service

Each packet is transmitted independently

Logical connection is established

10

Summary
The following implementations are feasible:
Connectionless service

Packet Routing

Connection-oriented service

There are two parts to the routing problem:

1. How to pass a packet from an input interface to the


output interface of a router (packet forwarding)?

Reliable

Unreliable

Reliable

Unreliable

2. How to calculate routes ?


Packet forwarding is done differently in datagram and
virtual-circuit packet networks
Route calculation is done in a similar fashion

11

12

Packet Forwarding of Datagrams

Packet Forwarding of Datagrams

Recall: In datagram networks, each packet carries


the full destination address

When a packet with destination node arrives at an


incoming link, ...
1. The router looks up the routing table
2. The routing table lookup yields the address of the
next node (next hop)
3. The packet is transmitted onto the outgoing link
that goes to the next hop

Each router maintains a routing table which has one


row for each possible destination address

Good: The router does not need to know about end-to-end


flows
Bad: Size of the routing table can grow very large

13

14

Packet Forwarding with Virtual Circuits


Packet Forwarding of Virtual Circuits

Recall: In VC networks, the route is setup in the


connection establishment phase

When a packet with VCin in header arrives from router

nin, ...

During the setup, each router assigns a VC number


(VC#) to the virtual circuit

1. The router looks up the routing table for an entry with


(VCin,

The VC# can be different for each hop

nin)

2. The routing table lookup yields (VCout, nout)


3.The router updates the VC# of the header to VCout

VC# is written into the packet headers

and transmits the packet to

nout

Good: Routing table is small (how small?)

Bad: Changing the route is complicated Routing table changes


for each virtual circuit

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

Fairness vs. maximum throughput

Stability vs. optimal delay

Example: Assume that stations A, B, C wants to send


to A, B, and C, at 10, 5 and 5 Mbps respectively

Example: Optimize delay by sending all packets over


link with the least traffic.

Assume the capacity of the network links is 10 Mb/s.

Update the routing decision every 10 sec

150 kbps

D
C

200 kbps

19

20

Elements of Routing Algorithms

Shortest-Path Routing

Optimization Criteria:
- Number of Hops - Cost
- Delay - Throughput

Adaptive routing algorithms use a shortest path


algorithm to calculate the route with the least cost
Three components:
1. Measurement Component
- Nodes (routers) measure the current characteristics such
as delay, throughput, and cost

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

Goal of Shortest Path Routing

Approaches to Shortest Path Routing

Goal: Given a network were each link between two


nodes i and j is assigned a cost. Find the path with
the least cost between nodes i and j.

There are two basic approaches to least-cost routing


in a communication network
There are two basic approaches to shortest-path
routing:
1. Link State Routing

Parameters:
dij cost of link between node i and node j;
dij = , if nodes i and j are not connected;
dii = 0

2. Distance Vector Routing

N set of nodes

23

24

Approaches to Shortest Path Routing

Link State Routing

1. Link State Routing


Each node knows the distance to its neighbors
The distance information (=link state) is broadcast to
all nodes in the network
Each node calculates the routing tables independently
2. Distance Vector Routing
Each node knows the distance (=cost) to its directly
connected neighbors
A node sends a list to its neighbors with the current
distances to all nodes

Each node must


discover its neighbors
measure the delay (=cost) to its neighbors
broadcast a packet with this information to all
other nodes
compute the shortest paths to every other router
The broadcast can be accomplished by flooding
The shortest paths can be computer with Dijkstras
algorithm

If all nodes update their distances, the routing tables


eventually converge
25

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

Example: Calculate the shortest paths for node 1.

1, 4

find shortest paths from given node


subject to constraint that paths contain at
most one link

1, 4, 2

{ 1, 4, 2, 5}

5
5

{ 1, 4, 2, 5. 3} { 1, 4, 2, 5. 3, 6} -

Result is a routing tree:


... which results in a routing table (of node 1):

Bellman-Ford Algorithm

find the shortest paths with a constraint of


paths of at most two links
and so on

29

Bellman-Ford Algorithm

30

Example of Bellman-Ford Algorithm

step 1 [Initialization]
L0(n) = , for all n s
Lh(s) = 0, for all h

step 2 [Update]

for each successive h 0


for each n s, compute: Lh+1(n)=minj[Lh(j)+w(j,n)]

connect n with predecessor node j that gives


min
eliminate any connection of n with different
predecessor node formed during an earlier
iteration
path from s to n terminates with link from j to
n
31

32

Results of Bellman-Ford Example

Discussion of Link State Routing


Recall: Link State Routing methods use Dijkstra's
algorithm

h Lh(2) Path Lh(3) Path

Lh(4) Path Lh(5) Path

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

Each node requires complete topology information


Each node has two tasks:
Test status of all neighbor nodes
Propagate link state information of neighbors to
all other nodes by sending a broadcast message
Whenever a link state message arrives.
- the node updates its topology information
- and recalculates the shortest paths

33

Discussion of Link State Routing

34

Distance Vector Routing

Advantages of Link State Routing:


Each nodes computes routes from the same data
Guaranteed to converge
Update messages (state information) does not
depend on total number of nodes; only depends on
number of neighbors
Disadvantages of Link State Routing:
Each node must maintain global database

Each node maintains two tables:


Distance Table: Cost to each node via each
outgoing link
Routing Table: Minimum cost to each node and
next hop node
Nodes exchange messages that contain
information on the cost of a route
Reception of messages triggers recalculation of
routing table

35

36

Distance Vector Algorithm: Tables

Messages
Nodes exchange messages to their neighbors.
If node v sends a messages to node x of the form, [m
, Dm (v)], this means

>

I can go to node m with minimum cost Dm (v)

This message is only of interest to neighbors of v


37

38

New link with cost l(m,v) comes up

New link with cost l(m,v) comes up

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

Cost of link changes by m

Cost of link changes by m

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

Node v receives a message [d, Dd(w)]

42

Node v receives a message [d, Dd(w)]


Operations at node v
1. If d = v then ignore the message
2. If d v then
Cd(v, w) = Dd(w) + l (w,v)
Compute minx Cd(v,x) :
If no changes, then do nothing
If Cd(v,w)=minx Cd(v,x), then
change entry in dth row of routing table to (d,
Cd(v, w)) and
send message [d, Cd(v,w)] to all neighbors.
43

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

Discussion of Distance Vector Routing

46

Routing Algorithms in the Internet

Entries of routing tables can change while a packet


is being transmitted. This can lead to a single
datagram visiting the same node more than once
(Looping)
If the period for updating the routing tables is too
short, routing table entries are changed before
convergence (from the previous updates) is
achieved
Example: The ARPANET used a Distance Vector
algorithm with an update period of <1 sec. Due to
the instability of routing, the ARPANET switched in
1979 to a link state routing algorithm
47

48

Traffic Control

Flow Control vs. Congestion Control

Traffic control at the network layers attempts to


control the number of packets that are in the
network at a time

Flow Control - regulates the rate of the data flow


between two points

Goal of traffic control:


Prevent the network from becoming a bottleneck

Congestion Control - regulates the number of


packets that can be in the network
-Congestion control may consider more than two
points,

Different types of traffic control:


Flow Control
Congestion Control
Routing

i.e., it may deal with the entire network.

49

What is Congestion ?

50

When does Congestion Occur ?

Congestion occurs if the number of queued


packets at the output buffers of a router grows
large

Define the Offered Load of a network to be the


average rate of packets that enter the output
queue

Effect of long queues in output buffers:


increased delays, buffer overflows, timeouts at
sender, etc

The following are pretty good rules of thumb:

51

52

Problems without Traffic Control

Effects of Congestion
Congestion occurs if Load 1

The following problems may occur in a


network with insufficient traffic control at
the network layer.
Loss of Efficiency
Unfairness
Lockup (Deadlock)

53

Loss of Efficiency

54

Unfairness

Throughput may decrease if offered load is increased

55

Packet streams with low load are penalized by


high traffic load from other packet streams

56

Problems without Traffic Control

Scope and Level of Traffic Control

Deadlock (Lockup): If there is a cycle of nodes,


each having run out of buffer space and each
having to transmit a packet to the next node in
the cycle to free buffer space

Traffic Control can be done at several levels:

57

CONGESTION CONTROL

58

Congestion control categories

Congestion control refers to techniques and mechanisms


that can either prevent congestion, before it happens, or
remove congestion, after it has happened. In general,
we can divide congestion control mechanisms into two
broad categories: open-loop congestion control
(prevention) and closed-loop congestion control
(removal).

Open-Loop Congestion Control


Closed-Loop Congestion Control
59

60

Back Pressure

Techniques for Traffic Shaping

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

Implicit Congestion Signaling


Transmission delay may increase with
congestion
Packet may be discarded
Source can detect these as implicit indications
of congestion
Useful on connectionless (datagram) networks
e.g. IP based

If the source node receives a choke packet it reduces


the traffic by a certain amount.
For example, the window size could be reduced.
If a (throttled) source node does not receive a
choke packet within a given time interval, it is
allowed to increase the traffic.
Example: IP (Internet Protocol) uses choke packets

TCP includes congestion and flow control based on


delay - see chapter 17

Used in frame relay LAPF

63

64

Congestion Signaling

Preallocation of Buffers

Explicit Congestion Signaling


Network alerts end systems of increasing
congestion
End systems take steps to reduce offered load
Backwards
Congestion avoidance in opposite direction to packet
is required

Forwards
Congestion avoidance in the same direction as packet
is required

Approach: Reserve sufficient buffer space at each


node for each virtual circuit during the virtual
circuit setup phase
Requires admission control:
If sufficient buffers are not available, reject the
virtual circuit
Caveat: Overallocation of buffer space will limit the
utilization of the network.

Used in Frame Relay and ATM


65

Packet Discarding

66

Sliding Window Flow Control

Drop packets if they arrive at a node with


almost full buffers

Can be used at the hop-by-hop and the


entry-to-exit level

Heuristics should be used to decide when


to drop a packet
For example, ACK packets should not be
dropped

67

68

Leaky Bucket

Operation of a Leaky Bucket

A Leaky Bucket is used to control the maximum


rate at which a sender can transmit traffic

Tokens are added to the token bucket at rate of r

Leaky buckets operate at the station/node interface


Two parameters: token rate r and bucket size B

No tokens are added to the token bucket if the


bucket contains already B tokens
For each transmitted packet tokens must be
removed from the bucket (one token per each byte)
If the token bucket does not have enough tokens,
the packet is either dropped
(In some versions of the leaky buckets the packets
can be queued until a token arrives)

69

70

You might also like