Computer Networks

Download Report

Transcript Computer Networks

Computer Networks
Data link layer
Data link layer -- June 2004
1
Overview
 Design issues
 Services
 Point-to-point links
 Protocols
 Local area Networks
 Data Link layer Switching
Data link layer -- June 2004
2
Design issues
 Algorithms
protocols
services
for achieving reliable, efficient
communication between systems connected
by a “wire-like” communication channel
 Trivial?
o
o
o
o
Errors on communication circuits
Finite data rate
Nonzero propagation delay
Finite processing speed
Data link layer -- June 2004
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
o Independent frames
o Error rate should be low
o Recovery left to higher layers
o Used on LANs
 Acknowledged
o No connection
o Acknowledgement for each
packet
o Resending
o Ack is optimisation; also
transport layer can handle
errors
 Acknowledged
o Each frame received exactly
once
o All frames received in the
right order
o 3 distinct phases:
• Establishment of
connection
• Data transfer
• Release of connection
Data link layer -- June 2004
5
Design issues: protocols
 Position of data link protocol
Data link layer -- June 2004
6
Design issues: protocols
 Position of data link protocol
Data link layer -- June 2004
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 -- June 2004
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 -- June 2004
9
Design issues: protocols
 Framing: Character count
o Frame contains length (or #characters)
o Out of synchronisation if error
Data link layer -- June 2004
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 STX
DLE C
A
DLE DLE
C
DLE ETX
o Char set
• DLE: Data link escape
• STX: Start Text
Too closely linked to ASCII
• ETX: End Text
Data link layer -- June 2004
11
Design issues: protocols
 Framing: Character stuffing – newer protocols
o Frame starts / ends with same char: FLAG
Data link layer -- June 2004
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 -- June 2004
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 -- June 2004
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 -- June 2004
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 -- June 2004
16
Overview
 Design issues
 Window protocols
 Point-to-point links
 Performance
 Local area Networks
 Protocol verification
 Data Link layer Switching
 Examples
Data link layer -- June 2004
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 -- June 2004
18
1-bit sliding window protocol
Data link layer -- June 2004
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 -- June 2004
21
Go back n protocol
Data link layer -- June 2004
22
Go back n protocol
Data link layer -- June 2004
23
Go back n protocol
Data link layer -- June 2004
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 -- June 2004
26
PtP: window protocols
 Go back n protocol: Maximum size = MAXSEQ + 1?
o Sender sends
F0 … F7 or F00 … F77
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 -- June 2004
27
PtP: window protocols
 Go back n protocol: Maximum size = MAXSEQ?
o Sender sends
F0 … F6 or F00 … F66
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 F7 F0
or
F 0 F1
Distinction between 2 cases !!
Data link layer -- June 2004
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 -- June 2004
29
Selective repeat protocol
Data link layer -- June 2004
30
Selective repeat protocol
Data link layer -- June 2004
31
Selective repeat protocol
Data link layer -- June 2004
32
Selective repeat protocol
Data link layer -- June 2004
33
PtP: window protocols
 Selective repeat protocol
o Maximum size of sender window?
• Sequence numbers
– 0 .. MAXSEQ
• Size? MAXSEQ ?
Data link layer -- June 2004
34
PtP: window protocols
 Selective repeat protocol: Maximum size = MAXSEQ?
o Sender sends
F0 … F6 or F00 … F66
o Receiver sends Ack6
receive window: 7, 0, 1,…5
and expects F7 … or F77 ….
o Ack6 lost
o Sender retransmits F00 … F66
or
Retransmissions accepted
in new window
F 0 … F 5 F6
Data link layer -- June 2004
35
PtP: window protocols
 Selective repeat protocol: Max. size = (MAXSEQ+1)/2?
o Sender sends
F0 … F3 or F00 … F33
o Receiver sends Ack3
receive window: 4, 5, 6, 7
and expects F4 … or F44 ….
o Ack3 lost
o Sender retransmits F00 … F33
or
No overlap with new
window
F0 …F2 F3
Data link layer -- June 2004
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 -- June 2004
37
Overview
 Design issues
 Window protocols
 Point-to-point links
 Performance
 Local area Networks
 Protocol verification
 Data Link layer Switching
 Examples
Data link layer -- June 2004
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 -- June 2004
39
PtP: performance
 Stop-and-Wait protocol
o Simplifications:
• No piggybacking
• No errors
o During this time
Time
Action
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 sender
• F + A + 2 I C bits can be sent
• D
useful bits are sent
o Efficiency:
D
H+D+A+2xIxC
Data link layer -- June 2004
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 -- June 2004
41
PtP: performance
 Sliding window protocol
o Critical window size:
2xIxC
Wc = 1 +
F
o Efficiency:
• Large window
U=
D
H+D
• Small window
WxD
U=
F+2xIxC
U=
D
H+D
x
W
Wc
Data link layer -- June 2004
42
PtP: performance
 Sliding window protocol
o Critical window size:
2xIxC
Wc = 1 +
F
o Interpretation:
• CxI
• CxI/F
number of bits that can be sent in time I
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 -- June 2004
43
PtP: performance
 Sliding window protocol
o Critical window size:
o
2xIxC
Wc = 1 +
F
Figure overhead projector!
Data link layer -- June 2004
44
Overview
 Design issues
 Window protocols
 Point-to-point links
 Performance
 Local area Networks
 Protocol verification
 Data Link layer Switching
 Examples
o HDLC
o SLIP
o PPP
Data link layer -- June 2004
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 -- June 2004
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 -- June 2004
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:
• 0: receiver expects packet with seqnr 0
• 1: receiver expects packet with seqnr 1
o Channel:
SRC
000
01A
• 0 (1): packet with seqnr 0 (1) on channel
• A: Ack packet on channel
• - : channel empty
Data link layer -- June 2004
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 -- June 2004
51
Verification: finite state machine
Ack?
A 0 -- A 1
Data link layer -- June 2004
52
Verification: finite state machine
Data link layer -- June 2004
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 -- June 2004
54
Verification: finite state machine
 States:
o Sender
o Receiver
o Channel: s  r
o Channel: r  s
Transitions
1 layer7 -- June
2+5 20040
Data link
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 -- June 2004
56
Verification: petri net models
Data link layer -- June 2004
57
Verification: petri net models
 Model protocol 3:
fig 3.12
 Algebraic
representation
 Analysis:
o Reachability
o Deadlock
o …
Data link layer -- June 2004
58
Overview
 Design issues
 Window protocols
 Point-to-point links
 Performance
 Local area Networks
 Protocol verification
 Data Link layer Switching
 Examples
o HDLC
o SLIP
o PPP
Data link layer -- June 2004
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 -- June 2004
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 -- June 2004
62
PtP: examples
 Data Link layer in the Internet
o Context:
• Dial-up
• Leased lines between routers
Data link layer -- June 2004
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 -- June 2004
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 -- June 2004
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 -- June 2004
66
PtP: examples
 PPP – bring line up or down – simplified diagram
LCP
Data link layer -- June 2004
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 -- June 2004
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 -- June 2004
69
Overview
 Design issues
 Point-to-point links
 Local area Networks
 Data Link layer Switching
Data link layer -- June 2004
70
Computer Networks
Data link layer
Data link layer -- June 2004
71