You are on page 1of 70

Computer Networks

Data link layer

Data link layer -- 2024 1


Overview
 Design issues
 Services
 Point-to-point links
 Protocols
 Local area Networks

 Data Link layer Switching

Data link layer -- 2024 2


Design issues
 Algorithms
protocols
services
for achieving reliable, efficient
communication between systems connected
by a “wire-like” communication channel
 Trivial?
o Errors on communication circuits
o Finite data rate
o Nonzero propagation delay
o Finite processing speed
Data link layer -- 2024 3
Design issues
 Services to network layer
o Unacknowledged connectionless service
o Acknowledged connectionless service
o Acknowledged connection-oriented service

 Services from physical layer


o Unreliable bit transport

Data link layer -- June 2004 4


Design issues: Services
Connectionless service Connection-oriented service
 Unacknowledged  Acknowledged
o Independent frames o Each frame received
o Error rate should be low exactly once
o Recovery left to higher layers o All frames received in the
o Used on LANs right order
 Acknowledged o 3 distinct phases:
o No connection • Establishment of
o Acknowledgement for each connection
packet • Data transfer
o Resending • Release of connection
o Ack is optimisation; also
transport layer can handle
errors

Data link layer -- 2024 5


Design issues: protocols
 Position of data link protocol

Data link layer -- 2024 6


Design issues: protocols
 Position of data link protocol

Data link layer -- 2024 7


Design issues: protocols
 Framing
o Break stream of bits up into discrete frames

 Error control
o How does a sender know that all packets are correctly received

 Flow control
o How to prevent a sender to overload the receiver with packets

Data link layer -- 2024 8


Design issues: protocols
 Framing: break stream of bits up into discrete frames

 Methods:
o Use of time gap: unacceptable, too risky
o Character count
o Starting and ending characters with character stuffing
o Starting and ending flags with bit stuffing
o Physical layer coding violations

Data link layer -- 2024 9


Design issues: protocols
 Framing: Character count
Rar
o Frame contains length (or #characters) e ly u
se d

o Out of synchronisation if error

Data link layer -- 2024 10


Design issues: protocols
 Framing: Character stuffing
DLE STX A B C D DLE ETX
o Frame starts / ends with special sequence of chars
o Allow all chars as data in frame?
• Stuffing: additional DLE before each DLE

A DLE C

DLE STX A DLE DLE C DLE ETX


o Char set
• DLE: Data link escape Too closely linked to ASCII
• STX: Start Text
• ETX: End Text

Data link layer -- 2024 11


Design issues: protocols
 Framing: Character stuffing – newer protocols
o Frame starts / ends with same char: FLAG

Data link layer -- 2024 12


Design issues: protocols
 Framing: Bit stuffing
o Special bit pattern for start / end of frame
01111110
o In data: add ‘0’ after 5 consecutive ‘1’

Data link layer -- 2024 13


Design issues: protocols
 Framing: Coding violation
o Redundancy in the encoding on medium is required
o e.g. Manchester encoding: transition in the middle of a slot

violation

o Use no transition in a slot (= coding violation) as start of frame

Data link layer -- 2024 14


Design issues: protocols
 Error control
o How does a sender know that all packets are correctly received?
• ACK packet by receiver
o Packet lost or not recognized at receiver?
• Timer at sender: resend packet
o How to handle duplicates or out of order received packets?
• Sequence number in packet and ACK packet
o Optimisation: NACK packet
• Inform sender that something strange happened

Data link layer -- 2024 15


Design issues: protocols
 Flow control
o How to prevent a sender to overload the receiver with packets
• Receiver gives permission to send more packets
o Mechanisms:
• Implicit: ACK packet implies permission
• Explicit: communicate window size

Data link layer -- 2024 16


Overview
 Design issues
 Window protocols
 Point-to-point links
 Performance
 Local area Networks  Protocol verification
 Examples
 Data Link layer Switching

Data link layer -- 2024 17


PtP: window protocols
 One bit sliding window protocol
o Assumptions:
• Data in both directions: piggybacking of ACK
– No separate ACK packets
• Noisy channel
• Long stream of data in both directions
o Protocol: Tanenbaum: fig. 3.14

Data link layer -- 2024 18


1-bit sliding window protocol

Data link layer -- 2024 19


1-bit sliding window protocol

Data link layer -- June 2004 20


PtP: window protocols
 Go back n protocol
o Assumptions:
• Data in both directions: piggybacking of ACK
– No separate ACK packets
• Noisy channel
• Limited stream of data from network layer
o Protocol: Tanenbaum: fig. 3.17

Data link layer -- 2024 21


Go back n protocol

Data link layer -- June 2004 22


Go back n protocol

Data link layer -- 2024 23


Go back n protocol

Data link layer -- 2024 24


Go back n protocol

Data link layer -- June 2004 25


PtP: window protocols
 Go back n protocol
o Maximum size of sender window?
• Sequence numbers
– 0 .. MAXSEQ
• Size? MAXSEQ ? or MAXSEQ + 1?

Data link layer -- 2024 26


PtP: window protocols
 Go back n protocol: Maximum size = MAXSEQ + 1?
o Sender sends F0 … F7 or F 00 … F 77

o Receiver sends Ack7

and expects F0 or F08


Case 1: Ack7 received Case 2: Ack7 lost

o sender transmits F08 … F715 o sender transmits F00 … F77

or F0 … F7 or F0 … F7

No distinction between 2 cases

Data link layer -- 2024 27


PtP: window protocols
 Go back n protocol: Maximum size = MAXSEQ?
o Sender sends F0 … F6 or F 00 … F 66

o Receiver sends Ack6

and expects F7 or F77


Case 1: Ack6 received Case 2: Ack6 lost

o sender transmits F77 F08 o sender transmits F00 F11

or F 7 F0 or F 0 F1

Distinction between 2 cases !!

Data link layer -- 2024 28


PtP: window protocols
 Selective repeat protocol
o Assumptions:
• Data in both directions: piggybacking of ACK
– Separate ACK packets (requires ACK timer)
• Noisy channel
• Limited stream of data from network layer
• NACK packets: receiver detected problem
o Protocol: Tanenbaum: fig. 3.19

Data link layer -- 2024 29


Selective repeat protocol

Data link layer -- June 2004 30


Selective repeat protocol

Data link layer -- 2024 31


Selective repeat protocol

Data link layer -- June 2004 32


Selective repeat protocol

Data link layer -- 2024 33


PtP: window protocols
 Selective repeat protocol
o Maximum size of sender window?
• Sequence numbers
– 0 .. MAXSEQ
• Size? MAXSEQ ?

Data link layer -- 2024 34


PtP: window protocols
 Selective repeat protocol: Maximum size = MAXSEQ?
o Sender sends F0 … F6 or F 00 … F 66

o Receiver sends Ack6


receive window: 7, 0, 1,…5
and expects F7 … or F77 ….

o Ack6 lost Retransmissions accepted


in new window
o Sender retransmits F00 … F66

or F 0 … F 5 F6

Data link layer -- 2024 35


PtP: window protocols
 Selective repeat protocol: Max. size = (MAXSEQ+1)/2?
o Sender sends F0 … F3 or F 00 … F 33

o Receiver sends Ack3


receive window: 4, 5, 6, 7
and expects F4 … or F44 ….

o Ack3 lost No overlap with new


window
o Sender retransmits F00 … F 33

or F0 …F2 F3

Data link layer -- 2024 36


PtP: window protocols
 Maximum window size?
o Sender window: S
o Receiver window:
• Before receiving packets: R
• After receiver packets : NR
o Requirement?
S  NR  

Data link layer -- 2024 37


Overview
 Design issues
 Window protocols
 Point-to-point links
 Performance
 Local area Networks  Protocol verification
 Examples
 Data Link layer Switching

Data link layer -- 2024 38


PtP: performance
 Approach: compute usage of channel
 Notation:
C Channel capacity

D Number of data bits in frame

H Number of bits in header

F =D+H

I Propagation delay +
Interrupt & service time

Data link layer -- 2024 39


PtP: performance
 Stop-and-Wait protocol
o Simplifications:
• No piggybacking Time Action
• No errors 0 Start of sending frame
F/C Last bit sent
F/C + I Last bit arrived at receiver
F/C + I + A/C Last bit of ack sent
F/C + I + A/C + I Last ack bit arrived at
o During this time
sender
• F+A+2IC bits can be sent
• D useful bits are sent
o Efficiency: D
H+D+A+2xIxC

Data link layer -- 2024 40


PtP: performance
 Sliding window protocol
o Simplifications:
• No piggybacking
• No errors
o Conditions for continuous transmission
Time Action
0 Start of sending first frame
F/C Last bit sent of first frame
W x F/C Sender gets blocked

F/C + I + (A/C) + I Last ack bit arrived at sender


o Critical window size:
2xIxC
Wc = 1 +
F
Data link layer -- 2024 41
PtP: performance
 Sliding window protocol
o Critical window size: 2xIxC
Wc = 1 +
F
o Efficiency:
• Large window
D
U=
• Small window H+D
WxD
U=
F+2xIxC

D W
U= x
H+D Wc

Data link layer -- 2024 42


PtP: performance
 Sliding window protocol
o Critical window size: 2xIxC
Wc = 1 +
F
o Interpretation:
• CxI number of bits that can be sent in time I
• CxI/F number of frame that can be sent in time I
cable length in frames
o Cable length?
• 10 Mbps LAN, 1 km
– C x I = 50 bits  cable length << 1
• 64 Kbps transcontinental cable, 3000 km
– C x I = 960 bits  cable length  1
• 64 Kbps satellite channel, I  270 msec
– C x I = 17280 bits  cable length >> 1

Data link layer -- 2024 43


PtP: performance
 Sliding window protocol
o Critical window size: 2xIxC
Wc = 1 +
F

o Figure overhead projector!

Data link layer -- 2024 44


Overview
 Design issues
 Window protocols
 Point-to-point links
 Performance
 Local area Networks  Protocol verification
 Examples
 Data Link layer Switching
o HDLC
o SLIP
o PPP

Data link layer -- 2024 45


Protocol verification
 Protocols + implementations are complex!
 Research to find mathematical techniques for
o specification
o verification
of protocols
 Intro to 2 techniques:
o Finite state machine models
o Petri net models

Data link layer -- 2024 46


Verification: finite state machine
 Approach:
o Model (relevant) states of protocol entities & channels
o Define all transitions between states
 Result: graph with
o nodes: all states of global system ( = protocol entities +
channels)
o edges: all transitions
 Verification:
o Reachability analysis
o Deadlock detection
o ….

Data link layer -- 2024 47


Verification: finite state machine
 Example: simplex protocol for a noisy channel
(protocol 3 – fig 3.12)
 States:
o Sender:
• 0: packet with seqnr 0 is sent out
• 1: packet with seqnr 1 is sent out
o Receiver: SRC
• 0: receiver expects packet with seqnr 0 000
• 1: receiver expects packet with seqnr 1
01A
o Channel:
• 0 (1): packet with seqnr 0 (1) on channel
• A: Ack packet on channel
• - : channel empty

Data link layer -- 2024 48


Verification: finite state machine

Data link layer -- June 2004 49


Verification: finite state machine

Data link layer -- June 2004 50


Verification: finite state machine

Modelling correct? NO!!


Data link layer -- 2024 51
Verification: finite state machine

Ack?
A 0 -- A 1

Data link layer -- June 2004 52


Verification: finite state machine

Ack?
A 0 -- A
1

Data link layer -- 2024 53


Verification: finite state machine
 Protocol with unnumbered ACKs?
o wrong!
 Result from analysis
o protocol ok!!
 Error? wrong modelling
o half duplex <> full duplex channel
o 2 channels iso 1 channel
• Channel: s  r:
– Packet 0
– Packet 1
– - (empty)
• Channel: r  s
– Ack
– - (empty)

Data link layer -- 2024 54


Verification: finite state machine
 States:
o Sender
o Receiver
o Channel: s  r
o Channel: r  s

Data link
Transitions 1 layer7 -- June
2+5 20040 4 5 2 55
Verification: petri net models
 Basic elements:
o Places: represent system states
o Transitions: represent actions in system
o Arcs: relate states to actions
o Tokens: current state
 Transitions:
o Input places
o Output places
 Transition enabled
o At least one token in each input place
 Firing of transition
o If enabled
o 1 token removed from each input place
o 1 token added in each output place
Data link layer -- 2024 56
Verification: petri net models

Data link layer -- 2024 57


Verification: petri net models
 Model protocol 3:
fig 3.12
 Algebraic
representation
 Analysis:
o Reachability
o Deadlock
o …

Data link layer -- 2024 58


Overview
 Design issues
 Window protocols
 Point-to-point links
 Performance
 Local area Networks  Protocol verification
 Examples
 Data Link layer Switching
o HDLC
o SLIP
o PPP

Data link layer -- 2024 59


PtP: examples
 HDLC: High Level Data Link Control
o Origin
• SDLC: Synchronous Data Link Control
– from IBM’s SNA
• ADDCP: Advanced Data Communications Control Procedure
= SDLC as modified by ANSI
• HDLC:
= SDLC as modified by ISO
• LAP: Link Access Procedure
= HDLC as modified by CCITT for X25
• LAPB:
– More compatible with later version of HDLC
o Standards?

Data link layer -- 2024 60


PtP: examples
 HDLC: High Level Data Link Control
o Frame structure:

• Address
– for multi-point line
– distinguish responses from redirected frames
• Control field

Information frame
Supervisory frames
Unnumbered frames

Data link layer -- June 2004 61


PtP: examples
 HDLC
o Kind of frames:
• Information frame
• Supervisory frames:
– Reject = nack
– Receive ready = ack
– Receive not ready = ack + stop sending
– Selective reject = resend 1 frame
• Unnumbered frames
– Initialisation
– Polling
– Status reporting
– ….
Data link layer -- 2024 62
PtP: examples
 Data Link layer in the Internet
o Context:
• Dial-up
• Leased lines between routers

Data link layer -- 2024 63


PtP: examples
 SLIP – Serial Line IP
o RFC 1055 (1984)
o Frames:
• Raw IP packets + flag byte (0xC0) at end and/or start of packet
• Character stuffing
• Optimisation: compression of TCP & IP header
o Disadvantages:
• No error detection: left to higher layers
• No dynamic assignment of IP addresses
• No support for authentication
• Not an approved Internet standard

Data link layer -- 2024 64


PtP: examples
 PPP – Point-to-Point Protocol
o PPP provides
• Framing + error detection
• Link control protocol (LCP) for bringing up lines, test lines,
negotiate options, bringing down lines
• Network control Protocol (NCP) to negotiate options independent
of the network protocol used
o Scenario
• PC calls router of provider via modem
• Router’s modem answers phone  physical connection
• Series of LCP packets to select PPP parameters
• Series of NCP packets to e.g. get IP address
• PC = Internet host!

Data link layer -- 2024 65


PtP: examples
 PPP – Point-to-Point Protocol
o PPP frame format:  HDLC but character oriented
• Address: fixed value, can be omitted
• Control: default = unnumbered frame
• Protocol:
– Kind of packet in payload
– Code starts ‘0’: network protocols: IP, OSI CLNP,…
– Code starts ‘1’: negotiate other protocol: LCP, NCP

Data link layer -- 2024 66


PtP: examples
 PPP – bring line up or down – simplified diagram

LCP

Data link layer -- 2024 67


PtP: examples
 PPP: LCP packet types (Initiator, Responder)
Name Direction Description
Configure-request IR List of proposed options and values
Configure-ack IR All options are accepted
Configure-nack IR Some options are not accepted
Configure-reject IR Some options are not negotiable
Terminate-request IR Request to shut the line down
Terminate-ack IR OK, line shut down
Code-reject IR Unknown request received
Protocol-reject IR Unknown protocol requested
Echo-request IR Please send this frame back
Echo-reply IR Here is the frame back
Discard-request IR Just discard this frame (for testing)

Data link layer -- 2024 68


PtP: examples
 PPP
o LCP options
• Maximum payload size for data frames
• Enabling authentication
• Choosing protocol to use
• Selecting various header compression options
o NCP options
• For IP: dynamic address assignment

Data link layer -- 2024 69


Overview
 Design issues

 Point-to-point links

 Local area Networks

 Data Link layer Switching

Data link layer -- 2024 70

You might also like