You are on page 1of 71

Computer Networks

Network layer

1
Network Layer
Design issues

Routing

Congestion

Internetworking

Internet Protocols

Multimedia or QoS

2
Design issues
Goal of layer: get packets from source host to
destination host
o Routing: should know about topology of subnet
o Congestion: should avoid overloading some
communication lines and routers
o Quality of service: offer the appropriate service
o Internetworking: deal with network differences, if
source and destination are connected to different
networks

3
Design issues
Store-and-forward packet switching
o Equipment of: carrier <> customer
o Algorithm at router
Receive packet
Check packet (e.g. checksum)
Forward packet

4
Design issues: services
Interface
o Important: = interface between carrier and customer
o Designed with following goals in mind:
Services should be independent of the subnet technology
Transport layer should be shielded from the number, type,
topology of the subnets
Network addresses should use a uniform numbering plan, even
across LANs and WANs
Connections?
o Connection-oriented <> Connectionless!

5
Design issues: services
Connection-oriented <> Connectionless
o PTTs: connection-oriented
100 years of experience with the world-wide telephone
system
Connection time billing!
o Internet
Subnets are inherently unreliable
o Real issue: where to put the complexity as some/many
applications require reliable transfer (~ connection-
oriented service)
Network layer
Transport layer

6
Design issues: services

Network
Layer

7
Network Layer
Design issues

Routing

Congestion

Internetworking

Internet Protocols

Multimedia or Qos

8
Routing Algorithms
Properties
Shortest Path Routing
Flooding
Distance Vector Routing Most important
Link State routing algorithms!
Hierarchical routing
Broadcast routing
Multicast routing
Routing for mobile hosts
Routing in Ad Hoc Networks
Node Lookup in Peer-to-Peer Networks

9
Routing algorithms
Desirable properties
o Correctness
o Simplicity
} all algorithms

o Robustness: able to cope with


changes in topology, load hard to achieve
hardware and software failures

o Stability
Converge to equilibrium

o Fairness
o Optimality } conflicting

10
Routing algorithms
Desirable properties (cont.)
Conflict!
o Fairness
o Optimality

11
Routing algorithms
Taxonomy
o Non adaptive
Routing decisions computed in advance, off-line and
downloaded
o Adaptive
To changes in
Topology
Load
Get information
Locally
From adjacent routers
From all routers

Network layer -- May 2004 12


Routing algorithms
Optimality principle
Optimal path from I to K over J

I d1 distance
K
d2
d1 + d2 is minimal
J d3
Other path from J to K
d3 > d2
Set of all optimal routes as
from all sources d1 + d3 > d1 + d2
to a given destination
is a tree: sink tree
13
Routing: shortest path
Algorithm of Dijkstra: shortest path in graph
o Graph
Node = router
Arc = communication line
o Metric
Number of hops
Geographic distance
Mean queueing and transmission delay

14
Routing Algorithms
Properties
Shortest Path Routing
Flooding
Distance Vector Routing Most important
Link State routing algorithms!
Hierarchical routing
Broadcast routing
Multicast routing
Routing for mobile hosts
Routing in Ad Hoc Networks
Node Lookup in Peer-to-Peer Networks

15
Routing: distance vector
Adaptive algorithm
o Exchange of info only with neighbours
Data to be available in each router
o Routing table: per destination
Distance
Outgoing line
o Distance to all neighbours

16
Routing: distance vector
Routing table for A
To cost via
A 0 -
B 12 B
C 25 B
D 40 B
E 14 E
F 23 E
G 18 B
H 17 J
I 21 E
J 9 J
K 24 J
L 29 J
17
Routing: distance vector
Algorithm
o At each step within a router:
Get routing tables from neighbours
Compute distance to neighbours
Compute new routing table
o Characteristics:
Iterative
Asynchronous
Distributed

Network layer -- May 2004 18


Routing: distance vector
Routing tables from

Network layer -- May 2004 19


Routing: distance vector

Better?
Keep 4 tables (one for each neighbour)
Use shortest path

Network layer -- May 2004 20


Routing: distance vector
Distributed algorithm
o Triggers:
Change in delay to neighbour
Receive new table from neighbour
o Update local tables
o If changed: forward routing tables to neighbours
Asynchronous
o Execution in lock step not required
Iterative How fast are changes propagated?
o Stops? Good news?
Bad news?
Network layer -- May 2004 21
Routing: distance vector

Good news:
A comes up again

Only distances to A

Faster not possible!!!

Network layer -- May 2004 22


Routing: distance vector
Bad news:
A goes down

B receives:
Distance from A
Distance 2 from C
New distance from B to A: 3 via C

Network layer -- May 2004 23


Routing: distance vector
Bad news:
A goes down

C still
believes its distance to A is 2
LOOP!!! routes via B
B routes its packets for A via C

Network layer -- May 2004 24


Routing: distance vector
Bad news:
A goes down

Loops!!
Slow!!

= 5?

Network layer -- May 2004 25


Routing: distance vector
Split horizon hack:
o Lie to neighbour A B C D E
about distance
if routing via 1 2 3 4 initially

neighbour lie

2 3 4 1 iteration

3 4 2 iterations
Faster not possible!!

4 3 iterations

Network layer -- May 2004 26


Routing: distance vector
Split horizon hack:
o Hack does not always work
Example:
o D goes down
o A and B lie to C
o A offers to B route to D
o B offers to A route to D
o Loops again!!!

Network layer -- May 2004 27


Routing Algorithms
Properties
Shortest Path Routing
Flooding
Distance Vector Routing Most important
Link State routing algorithms!
Hierarchical routing
Broadcast routing
Multicast routing
Routing for mobile hosts
Routing in Ad Hoc Networks
Node Lookup in Peer-to-Peer Networks

Network layer -- May 2004 28


Routing: link state
Each router must Overview of algorithm:
o Discover its neighbours and learn their network
addresses
o Measure the delay or cost to each of its neighbours
o Construct a packet with these distances
o Send this packet to all other routers
o Compute the shortest path to every other router

Network layer -- May 2004 29


Routing: link state
Algorithm:
Learning about neighbours:
o Upon boot of router
Send HELLO packet on each point-to-point line
Routers are supposed to send reply with a globally unique
name
o LAN
model

Network layer -- May 2004 30


Routing: link state
Algorithm:
Measuring line cost
o Measure round-trip delay of HELLO Packet and its
reply
o Take load into account? Arguments both ways:

Yes! preference for unloaded line


No! oscillations are possible

Network layer -- May 2004 31


Routing: link state
Algorithm:
Building link state packets
o When to build?
o Packet containing:
periodically
Identity of sender
Sequence number + age when significant events occur

For each neighbour: name + distance

Network layer -- May 2004 32


Routing: link state
Distributing link state packets
Algorithm:
o Trickiest part of algorithm
Arrival time for packets different
How to keep consistent routing tables
o Basic algorithm
Flooding +
Sequence number (in each packet) to limit duplicates
o Manageable problems
Wrap around of sequence numbers: 32 bits + 1 packet/sec 137 years
Wrong sequence number used: Age in each packet:
lost in case of crash
Decremented during flooding,
Corruption while used in router
Age 0 info discarded
Network layer -- May 2004 33
Routing: link state
Algorithm:
Distributing link state packets
o Basic algorithm
o Manageable problems
o Refinements
Link state packets are not forwarded immediately
During holding time:
duplicates are discarded
Old packets are thrown out

Network layer -- May 2004 34


Network Layer
Packet buffer for router B
o ACK flag: ACK to send
o Send flag: packet to forward

Network layer -- May 2004 35


Routing: link state
Algorithm:
Computing new routes:
o With a full set of link state packets, a router can:
Construct the entire subnet graph
Run Dijkstras algorithm to compute the shortest path to each
destination
o Problems for large subnets
Memory to store data
Compute time

Network layer -- May 2004 36


Routing: link state
Usage:
o IS-IS protocol
Designed for DECnet, adopted by ISO
In use also in Internet
Supports multiple network layer protocols
o OSPF protocol used in Internet
o Common features:
Self-stabilizing method of flooding link state updates
Concept of a designated router on a LAN
Method of computing and supporting path splitting and multiple
metrics

Network layer -- May 2004 37


Routing Algorithms
Properties
Shortest Path Routing
Flooding
Distance Vector Routing
Link State routing
Hierarchical routing
Broadcast routing
Multicast routing
Routing for mobile hosts
Routing in Ad Hoc Networks
Node Lookup in Peer-to-Peer Networks

Network layer -- May 2004 38


Hierarchical routing
When network size increases
o Larger stables
o More CPU time needed to
compute
o More bandwidth needed

Network layer -- May 2004 39


Hierarchical routing
Solution?

Network layer -- May 2004 40


Hierarchical routing

Routers grouped in regions


Each routers knows how to
reach: Smaller tables
o Other routers in its own group Longer paths
o Other regions
Network layer -- May 2004 41
Routing Algorithms
Properties
Shortest Path Routing
Flooding
Distance Vector Routing
Link State routing
Hierarchical routing
Broadcast routing
Multicast routing
Routing for mobile hosts
Routing in Ad Hoc Networks
Node Lookup in Peer-to-Peer Networks

Network layer -- May 2004 42


Broadcast routing
Send message to all other hosts:
o Update distributed database
o Distribute weather reports
o Distribute live radio/TV programs
Poor methods:
o Send a distinct packet to each destination
List of addresses needed
High usage of bandwidth
o Flooding
Too many packets
o Multidestination routing
Each packet contains a list of destination
On each line a single packet

Network layer -- May 2004 43


Broadcast routing
Best method: use sink tree

o Broadcast source =
root of sink tree
o Forwarding on sink tree
lines
o Excellent use of bandwidth
o Source tree must be known
at each intermediate node

Which sink tree?


How many sink trees?

Network layer -- May 2004 44


Broadcast routing
Sink tree approximation: reverse path forwarding

if a packet arrives on line used for traffic to source of broadcast


then forward packet on all lines, except the one it arrived on
else discard packet

Network layer -- May 2004 45


Routing Algorithms
Properties
Shortest Path Routing
Flooding
Distance Vector Routing
Link State routing
Hierarchical routing
Broadcast routing
Multicast routing
Routing for mobile hosts
Routing in Ad Hoc Networks
Node Lookup in Peer-to-Peer Networks

Network layer -- May 2004 46


Multicast routing
Send a message to a well-
defined group
o Large in size
o Small compared to network
as a whole
Group management
o Create and destroy groups
o Process can leave and join a
group
How will routers know
about groups? algorithm

Network layer -- May 2004 47


Multicast routing

source

Algorithm Pruning:
o Source computes spanning o Link state routing
tree Each router knows full topology
o Distance vector routing
o Remove lines that do not
Reverse path forwarding +
lead to hosts of group
PRUNE messages to remove
( = pruning) arcs

Network layer -- May 2004 48


Multicast routing

source

Pruning:
o Link state routing
Each router knows full topology
o Distance vector routing
Reverse path forwarding +
PRUNE messages to remove
arcs

Network layer -- May 2004 49


Routing Algorithms
Properties
Shortest Path Routing
Flooding
Distance Vector Routing
Link State routing
Hierarchical routing
Broadcast routing
Multicast routing
Routing for mobile hosts
Routing in Ad Hoc Networks
Node Lookup in Peer-to-Peer Networks

Network layer -- May 2004 50


Routing for Mobile Hosts
Model of world: WAN + LANs, wireless cells
o Move from time to time
Migratory users
o Use network when connected
Roaming users

o Compute on the run


o Maintain connections as they
move around

Network layer -- May 2004 51


Routing for Mobile Hosts
Foreign agent: keeps track of Home agent: keeps track of
users: users
o who are currently visiting the o whose home is in the area
area o who are currently visiting
another area

Permanent home location


Permanent home address

Network layer -- May 2004 52


Routing for Mobile Hosts
How does it work?
o Registration procedure with foreign agents
o Sending packets
o Leaving an area
Registration procedure with foreign agent
o Announcing existence of foreign agent
Broadcast by foreign agent
Broadcast query by arriving mobile user
o Mobile user gives to foreign agent
Home address
Current data link address
Security information
o Foreign agent contacts home agent of user

Network layer -- May 2004 53


Routing for Mobile Hosts
Registration procedure with foreign agent (cont.)
o Announcing existence of foreign agent
o Mobile user gives to foreign agent
o Foreign agent contacts home agent of user
Identity of user
Security info
Network address of foreign agent
o Home agent
Checks security info
Sends ack to foreign agent
o Foreign agent
Stores state
Informs mobile user

Network layer -- May 2004 54


Routing for Mobile Hosts
Sending a packet to a mobile user
o Home address is used packet routed to home LAN
o Packet intercepted by home agent
address of user address of home agent!
o Packet forwarded to the foreign agent
Encapsulation tunneling
o Foreign agent forwards packet to mobile user
Which protocol, address used?
o Sender is given address of foreign agent
Encapsulation tunneling used, required?

Network layer -- May 2004 55


Routing for Mobile Hosts

Home agent

Foreign agent

Network layer -- May 2004 56


Routing for Mobile Hosts
Leaving an area
o Announced by user deregistration
o Automatic detection by foreign agent
Various different schemes:
o Protocol carried out by routers or hosts
o Routers along the way intercept and redirect traffic
o Visitor gets temporary address to off-load foreign agent
o Modify original packet instead of encapsulation
o Security aspects: authentication?

Network layer -- May 2004 57


Routing Algorithms
Properties
Shortest Path Routing
Flooding
Distance Vector Routing
Link State routing
Hierarchical routing
Broadcast routing
Multicast routing
Routing for mobile hosts
Routing in Ad Hoc Networks
Node Lookup in Peer-to-Peer Networks

Network layer -- May 2004 58


Routing in Ad Hoc Networks
Ad Hoc Network = routers are mobile
o No fixed topologies
o No fixed or known neighbors
o Valid paths can disappear at any time
o Node = router + host
o Routing quite different from routing in wired networks
Examples
o Military vehicles on a battlefield
o Fleet of ships at see
o People with notebooks (lacking 802.11)
AODV = Ad hoc On-demand distance vector routing
o On-demand: route computed when needed
o Distance vector for mobile world
o Taking into account limited bandwidth + low battery life

Network layer -- May 2004 59


Routing in Ad Hoc Networks
Graph presentation
o Node
o Arc = nodes connected
can communicate directly by radio
Routing table:
o Line for known routes
o Can be valid or invalid
A wants to send a packet
o To H: forward to D Dest Next Distance Other
o To I: start route discovery broadcasting hop fields
a route request packet B B 1

C B 2

H D 3
Network layer -- May 2004 60
Routing in Ad Hoc Networks
Route request packet:

Source & destination address: e.g. IP address


Request ID:
local counter incremented for each new route request packet
broadcasted
allows to discard duplicate requests at other nodes
Source sequence #
counter to distinguish old routes to destination from new ones
Destination sequence #
most recent sequence counter of destination seen by source

Network layer -- May 2004 61


Routing in Ad Hoc Networks
Processing a route request packet
o duplicate request?
Yes: discard
o Fresh route to destination known?
Fresh = local destination sequence # >= destination sequence
# in request
Yes: send route reply packet
o No fresh route to destination is known!
Store info from route request in reverse route table; to enable
the forwarding of route reply packets
Increment hop count
Rebroadcast route request

Network layer -- May 2004 62


Routing in Ad Hoc Networks
Processing a route request packet
o Duplicate request?
o Fresh route to destination known?
o No fresh route to destination is known!

Network layer -- May 2004 63


Routing in Ad Hoc Networks
Processing a route request packet
o Duplicate request?
o Fresh route to destination known?
o No fresh route to destination is known!

o (a) Range of A's broadcast.


o (b) After B and D have received A's broadcast.
o (c) After C, F, and G have received A's broadcast.
o (d) After E, H, and I have received A's broadcast.
Shaded nodes are new recipients. Arrows show possible reverse routes.
Network layer -- May 2004 64
Routing in Ad Hoc Networks
Route reply packet
o Returned by
Intermediate node knowing a fresh route
Destination node

Destination sequence#
o Number known by sender of reply packet
Hop count
o Set to length of path known by sender of reply packet
o For destination = 0

Network layer -- May 2004 65


Routing in Ad Hoc Networks
Route maintenance
o Detect that neighbors are not reachable anymore
Broadcast Hello packet periodically
Failure to send packet
o Cleanup routing table

o Additional field in routing table: active neighbor


Nodes that have offered path to destination in recent past

Network layer -- May 2004 66


Routing in Ad Hoc Networks
Route maintenance

o Routing table of D
Node G goes down!

Network layer -- May 2004 67


Routing in Ad Hoc Networks
Route maintenance

o New routing table of D:


Delete routes with G as next hop
Delete G as active neigbor

Network layer -- May 2004 68


Routing Algorithms
Properties
Shortest Path Routing
Flooding
Distance Vector Routing
Link State routing
Hierarchical routing
Broadcast routing
Multicast routing
Routing for mobile hosts
Routing in Ad Hoc Networks
Node Lookup in Peer-to-Peer Networks

Network layer -- May 2004 69


Peer-to-Peer Networks
Peer-to-Peer network
How o can
Large a user
number find a node that
of users
contains
o Usuallythe info
permanent heconnections
wired is looking for,
in the absence
o In contact to shareof a centralized
resources
database orfeatures
Interesting even a centralized index?
o Totally distributed
o Symmetric
Distributed storage system!
o No central control or hierarchy
o Users will not know each other
Routing?
o Users will not know where to find what they are
looking for
Network layer -- May 2004 70
Computer Networks

Network layer

Network layer -- May 2004 71

You might also like