3 NetworkLayer Part1.ppt - 0

You might also like

Download as odp, pdf, or txt
Download as odp, pdf, or txt
You are on page 1of 63

Chapter 5

The Network Layer


Network Layer Design Isues

• Store-and-Forward Packet Switching


• Services Provided to the Transport Layer
• Implementation of Connectionless Service
• Implementation of Connection-Oriented Service
• Comparison of Virtual-Circuit and Datagram Subnets
Protocol Data Units (PDUs)

a) Data
b) Segment
c) Packet
d) Frame
e) Bits
Store-and-Forward Packet Switching

fig 5-1

The environment of the network layer protocols.


Circuit Switching
• Dedicated communication path between two stations
• Three phases
– Establish
– Transfer
– Disconnect
• Must have switching capacity and channel capacity to
establish connection
• Must have intelligence to work out routing
Circuit Switching - Applications
• Inefficient
– Channel capacity dedicated for duration of
connection
– If no data, capacity wasted
• Set up (connection) takes time
• Once connected, transfer is transparent
• Developed for voice traffic (phone)
Public Circuit Switched Network
Telecomms Components
• Subscriber
– Devices attached to network
• Subscriber line
– Local Loop
– Subscriber loop
– Connection to network
– Few km up to few tens of km
• Exchange
– Switching centers
– End office - supports subscribers
• Trunks
– Branches between exchanges
– Multiplexed
Circuit Establishment
Circuit Switching Concepts
a) Digital Switch
– Provide transparent signal path between devices
b) Network Interface
c) Control Unit
– Establish connections
• Generally on demand
• Handle and acknowledge requests
• Determine if destination is free
• construct path
– Maintain connection
– Disconnect
Packet Switching Principles
a) Circuit switching designed for voice
– Resources dedicated to a particular call
– Much of the time a data connection is idle
– Data rate is fixed
• Both ends must operate at the same rate
Packet Switching: Basic Operation
• Data transmitted in small packets
– Typically 1000 octets
– Longer messages split into series of packets
– Each packet contains a portion of user data plus
some control info
• Control info
– Routing (addressing) info
• Packets are received, stored briefly (buffered) and past on
to the next node
– Store and forward
Use of Packets
Advantages
• Line efficiency
– Single node to node link can be shared by many packets over time
– Packets queued and transmitted as fast as possible
• Data rate conversion
– Each station connects to the local node at its own speed
– Nodes buffer data if required to equalize rates
• Packets are accepted even when network is busy
– Delivery may slow down
• Priorities can be used
Switching Technique
a) Station breaks long message into packets
b) Packets sent one at a time to the network
c) Packets handled in two ways
– Datagram
– Virtual circuit
Datagram
a) Each packet treated independently
b) Packets can take any practical route
c) Packets may arrive out of order
d) Packets may go missing
e) Up to receiver to re-order packets and recover from missing
packets
Datagram Example
Virtual Circuit
• Preplanned route established before any packets sent
• Call request and call accept packets establish connection
(handshake)
• Each packet contains a virtual circuit identifier instead of
destination address
• No routing decisions required for each packet
• Clear request to drop circuit
• Not a dedicated path
Virtual Circuit
Virtual Circuits v Datagram
• Virtual circuits
– Network can provide sequencing and error control
– Packets are forwarded more quickly
• No routing decisions to make
– Less reliable
• Loss of a node looses all circuits through that node
• Datagram
– No call setup phase
• Better if few packets
– More flexible
• Routing can be used to avoid congested parts of the network
Routing in Datagram Subnet
Routing in Virtual Circuit
Comparison of Virtual-Circuit and
Datagram Subnets

5-4
Main Tasks of Network Layer
The network layer, or OSI Layer 3, provides services to allow end devices to
exchange data across the network. To accomplish this end-to-end transport, the
network layer uses four basic processes:
•Addressing end devices --- Already covered
•Encapsulation
•Routing => Will be covered next
•De-encapsulating
Encapsulating IP
IPv4 Packet Header

Contents of the IPv4 packet header


Encapsulating IPv6
Routing Algorithms
• The Optimality Principle
• 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
Routing Algorithms (2)

Conflict between fairness and optimality.


The Optimality Principle

(a) A subnet. (b) A sink tree for router B.


Shortest Path Routing

The first 5 steps used in computing the shortest path from A to D.


The arrows indicate the working node.
Flooding

5-8 top

Dijkstra's algorithm to compute the shortest path through a graph.


Flooding (2)

5-8
bottom

Dijkstra's algorithm to compute the shortest path through a graph.


Distance Vector Routing

(a) A subnet. (b) Input from A, I, H, K, and the new


routing table for J.
Problem of DV Routing

• Count-to-Infinity problem (Example in next few slides)


• Counting to infinity is just another name for a routing loop.
• In distance vector routing, routing loops usually occur when an
interface goes down.
• It can also occur when two routers send updates to each other at the
same time.
Distance Vector Routing (2)

The count-to-infinity problem.


Example: DV routing A
B
C
A 0
D0
B
C D E
A 1 A
D 2 B
E C
2
10 E D
2 E 0
A B C A
B 0 B
C Initialization
C 0
D
D
E E
A1
A 0 B
B 10 C 2
C D0
D 1 E 2
A 1 D A
E 2 B
C 2
2
10 E D 2
2 E 0
A 10 B C A
B 0 B
C
C 0 Direct
D
D 2 Neighbours
E E2
A1
A 0 B 11
B 10 C 2
C 3 D0
D 1 E 2
A 1 D A3
E 3 2 B
C 2
2
10 E D 2
2 E 0
A 10 B C A 3
B 0 Neighbours
B
C of neighbours
C 0
D 11
D 2
E E2
A1
A 0 B 11
B 10 C 2
C 3 D0
D 1 E 2
A 1 D A3
E 3 2 B 13
C 2
2
10 E D 2
2 E 0
A 10 B C A 3 Neighbours
B 0 B 13
C 13 of neighbours
C 0
D 11 of neighbours
D 2
E 13 E2
A1
A 0 B 11
B 10 C 2
C 3 D0
D 1 E 2
A 1 D A3
E 3 2 B 13
C 2
2
10 E D 2
2 E 0
A 10 B C A 3
B 0 B 13 Stable
C 13 convergence
C 0
D 11
D 2
E 13 E2
A1
A 0 B 11
B 10 C 2
C 3 D0
D 1 E 2
A 1 D A3
E 3 2 B 13
C 2
2
10 E D 2
2 E 0
B 1
A 10 C A 3
B 0 Good news:
B 13
C 13
C 0
A new link!
D 11
D 2
E 13 E2
A1
A 0 B 11
B 10 C 2
C 3 D0
D 1 E 2
A 1 D A3
E 3 2 B 13
C 2
2
10 E D 2
2 E 0
A 10 B 1 C A 3
B 0 B1 Direct
C 1 endpoints
C 0
D 11 know
D 2
E 13 E2
A1
A 0 B3
B 10 C 2
C 3 D0
D 1 E 2
A 1 D A3
E 3 2 B3
C 2
2
10 E D 2
2 E 0
A4 B 1 C A 3
B 0 Neighbours
B1
C 1 know
C 0
D3
D 2
E3 E2
A1
A 0 B3
B4 C 2
C 3 D0
D 1 E 2
A 1 D A3
E 3 2 B3
C 2
2
10 E D 2
2 E 0
A4 B 1 C A 3
B 0 Neighbours
B1
C 1
C 0
of neighbours
D3
D 2
know
E3 E2
A1
A 0 B3
B4 C 2
C 3 D0
D 1 E 2
A 1 D A3
E 3 2 B3
C 2
2
10 E D 2
2 E 0
A4 B 1 C A 3
B 0 B1 A happy and
C 1 stable network
C 0
D3
D 2
E3 E2
A1
A 0 B3
B4 C 2
C 3 D0
D 1 E 2
A 1 D A3
E 3 2 B3
C 2
2
10 E D 2
2 E 0
A4 B C A 3 Bad news:
B 0 B1
C 1 Link crash!!
C 0
D3
D 2
E3 E2
A1
A 0 B3
B4 C 2
C 3 D0
D 1 E 2
A 1 D A3
E 3 2 B3
C 2
2
10 E D 2
2 E 0
A B C A 3
B 0 Direct
B
C
C 0
endpoints
D
D 2
know
E E2
A1
A 0 B3
B4 C 2
C 3 D0
D 1 E 2
A 1 D A3
E 3 2 B3
C 2
2
10 E D 2
2 E 0
A 10 B C A 3
B 0 B
C
C 0
D
D 2
E E2
A1
A 0 B3
B4 C 2
C 3 D0
D 1 E 2
A 1 D A3
E 3 2 B3
C 2
2
10 E D 2
2 E 0
A 10 B C A 3 Get help
B 0 B5
C 13 from
C 0
D 11 neighbours
D 2
E 13 E2
A1
A 0 B7
B4 C 2
C 3 D0
D 1 E 2
A 1 D A3
E 3 2 B7
C 2
2
10 E D 2
2 E 0
A 10 B C A 3 Routing loop
B 0 B5
C 13 (due to
C 0
D 11 inconsistent
D 2
E 13 state info)
E2
A1
A 0 B7
B8 C 2
C 3 D0
D 1 E 2
A 1 D A3
E 3 2 B7
C 2
2
10 E D 2
2 E 0
A 10 B C A 3
B 0 B9
C 13
C 0
D 11
D 2
E 13 E2
A1
A 0 B 11
B8 C 2
C 3 D0
D 1 E 2
A 1 D A3
E 3 2 B 11
C 2
2
10 E D 2
2 E 0
A 10 B C A 3
B 0 Counting
B9
C 13 to infinity…
C 0
D 11
D 2
E 13 E2
A1
A 0 B 11
B 10 C 2
C 3 D0
D 1 E 2
A 1 D A3
E 3 2 B 11
C 2
2
10 E D 2
2 E 0
A 10 B C A 3
B 0 B 13
C 13
C 0
D 11
D 2
E 13 E2
A1
A 0 B 11
B 10 C 2
C 3 D0
D 1 E 2
A 1 D A3
E 3 2 B 13
C 2
2
10 E D 2
2 E 0
A 10 B C A 3
B 0 B 13
C 13
C 0
D 11
D 2
E 13 E2
A1
A 0 B 11
B 10 C 2
C 3 D0
D 1 E 2
A 1 D A3
E 3 2 B 13
C 2
2
10 E D 2
2 E 0
A 10 B C A 3
B 0 Stability
B 13
C 13 again
C 0
D 11
D 2
E 13 E2
Loop Breaking Heuristics

a) Set infinity to a limited number, e.g. 16.


b) Split horizon
c) Split horizon with poison reverse
Link State Routing Protocol
Link State Routing
Each router must do the following:
1. Discover its neighbors, learn their network address.
2. Measure the delay or cost to each of its neighbors.
3. Construct a packet telling all it has just learned.
4. Send this packet to all other routers.
5. Compute the shortest path to every other router.
Learning about the Neighbors

(a) Nine routers and a LAN. (b) A graph model of (a).


Measuring Line Cost

A subnet in which the East and West parts are connected by two lines.
Building Link State Packets

(a) A subnet. (b) The link state packets for this subnet.
Distributing the Link State Packets

The packet buffer for router B in the previous slide (Fig. 5-13).

You might also like