MẠNG MÁY TÍNH
(COMPUTER NETWORKING)
J.F Kurose and K.W. Ross. Computer
Networking A Top Down Approach.
6th edition, Addision Wesley, 2013
Chapter 5: DATA LINK
LAYER
1. Introduction and Services
2. Error detection and correction
3. Elementary Data Link Protocols
4. Sliding Window Protocols
5. Multiple access protocols
6. Link-layer Addressing
7. PPP
1.3
Link layer: Introduction
Some terminology:
Host and router are nodes
Communication channels that
connect adjacent nodes along
communication path are links
Wired links
Wireless links
LANs
Packet is a frame, ancapsulates
datagram
Data-link layer has responsibility of
transferring datagram from one node
to adjacent node over a link
1.4
Datagram transferred by
Transportation analogy
different link protocols over
different links
Trip from Princeton to
Lausanne
ex: Ethernet on first link,
fram relay on intermediate
links, 802.11 on last link
Each link protocol provides
Limo: Princeton to JFK
Plane: JFK to Geneva
Train: Geneve to Lausanne
Tourist = datagram
different services
ex: may or may not provide
rdt over link
Transport segment =
communication link
Transportation mode = link
layer protocol
Travel agent = routing
algorithm
1.5
Link layer services (1/2)
Framing, link access:
Encapsulate datagram into frame, adding header, trailer
Channel access if share medium
“MAC” addresses used in frame headers to identify source,
destination
Different
from IP address!
Reliable delivery between adjacent nodes:
Seldom used on low bit-error link (fiber, some twisted pair)
Wireless links: high error rates
Q:
why both link-level and end-end reliability?
1.6
Framing (1/3)
A character stream. (a) Without errors. (b) With one error.
1.7
Framing (2/3)
(a) A frame delimited by flag bytes.
(b) Four examples of byte sequences before and after stuffing.
1.8
Framing (3/3)
Bit stuffing
(a) The original data.
(b) The data as they appear on the line.
(c) The data as they are stored in receiver’s memory after destuffing.
1.9
Link layer services (2/2)
Flow control
Pacing between adjacent sending and receiving nodes
Error detection
Errors caused by signal attenuation, noise
Receiver detects presence of errors:
Signals sender for retransmission or drops frame
Error correction
Receiver identifies and corrects bit error(s) without resorting to
retransmision
Half-duplex and full-duplex
With half-duplex, nodes at both ends of link can transmit, but not at the
same time
1.10
Where is the link layer implemented?
In each and every host
Link layer implemented in “adaptor”
Ethernet card, PCMCI card,
802.11 card
Implements link, physical layer
Attaches into host’s system buses
Combination of hardware, software,
firmware
1.11
1. Introduction and Services
2. Error detection and correction
3. Elementary Data Link Protocols
4. Sliding Window Protocols
5. Multiple access protocols
6. Link-layer Addressing
7. PPP
1.12
Error-Detecting Codes
3 different error-detecting codes
Parity
Checksums
Cyclic Redundancy Checks (CRCs)
1.13
Error-Detecting Codes
1.14
Error-Correcting Codes
4 difference error-correcting codes:
1.
Hamming codes
2.
Binary convolutional codes
3.
Reer-Solomom codes
4.
Low-Density Parity Check codes
1.15
Error-Correcting Codes
1.16
1. Introduction and Services
2. Error detection and correction
3. Elementary Data Link Protocols
4. Sliding Window Protocols
5. Multiple access protocols
6. Link-layer Addressing
7. PPP
1.17
Elementary Data Link Protocols
An Unrestricted Simplex Protocol (A Utopian Simplex Protoco)
A Simplex Stop-and-Wait Protocol for an Error-Free Channel
A Simplex Stop-and-Wait Protocol for a Noisy Channel
1.18
An Unrestricted Simplex Protocol
Consists of two distinct procedures, a sender and a receiver
Sender: runs in the data link layer of the source node
Is
in an while loop just pumping data out onto the line as fast as
it can. The body of loop consists of 3 actions:
–
Fetch a pkt from network layer
–
Construct an outbound frame
–
Send the frame
Receiver: runs in the data link layer of the destination node
Wait
for something to happen
No sequence number or ACK
Only the info field of the frame is used by this protocol
There are no errors or flow control restrictions here.
The data portion is passed on to the network layer, and the data link
layer settles back to wait for the next frame
1.19
Unrealistic protocol!!!!
-does not handle
either flow control or
error correction
1.20
A Simplex Stop-and-Wait Protocol for an ErrorFree Channel
Prevent the sender from flooding the receiver
Communication channel is still assumed to be error free, and the data
traffic is still simplex
Solutions:
1.
Receiver must have sufficient buffering and processing abilities to run
at the line rate and must be able to pass the frames that are received to
the network layer quickly enough worst-case solution
2.
Receiver provides feedback to the sender after having passed a pkt to
its network layer stop-and-wait protocol
Half-duplex would suffice
1.21
1.22
A Simplex Stop-and-Wait Protocol for a
Noisy Channel
Consider the normal situation of a communication channel that makes
errors.
Frames may be either damaged or lost completely.
Assume: if a frame is damaged in transit, the receiver hardware will detect
this when it computes the checksum
Adding timer
Sender: send a frame
Receiver: only send an ACK if data were correctly received
1.23
Continued
A positive acknowledgement with retransmission protocol.
1.24
1.25