csc4220/6220 computer networks
DESCRIPTION
CSC4220/6220 Computer Networks. Dr. WenZhan Song Associate Professor, Computer Science. Course roadmap. Introduction Application Layer: WWW, FTP, email, DNS, multimedia Transport Layer: reliable end-end data transfer principles, UDP, TCP - PowerPoint PPT PresentationTRANSCRIPT
-1- Georgia State UniversitySensorweb Research Laboratory
CSC4220/6220 Computer Networks
Dr. WenZhan Song
Professor, Computer Science
-2- Georgia State UniversitySensorweb Research Laboratory
Course roadmap Introduction Application Layer: WWW, FTP, email, DNS, multimedia Transport Layer: reliable end-end data transfer principles, UDP,
TCP Network Layer: IP addressing, routing and other issues Data Link Layer: framing, error control, flow control
Medium Access Control (MAC) Layer: multiple-access, channel allocation
Physical Layer: wired, wireless, satellite Other Topics: network security, social issues, hot topics, research
directions
-3- Georgia State UniversitySensorweb Research Laboratory
Data Link Layer
Our goals: understand principles behind data link layer
services: error detection, correction sharing a broadcast channel: multiple access link layer addressing reliable data transfer, flow control: done!
instantiation and implementation of various link layer technologies
-4- Georgia State UniversitySensorweb Research Laboratory
Link Layer: Introduction
Some terminology: hosts and routers are nodes communication channels that
connect adjacent nodes along communication path are links
wired links wireless links LANs
layer-2 packet is a frame, encapsulates datagram
“link”
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
-5- Georgia State UniversitySensorweb Research Laboratory
Data Link Layer Road Map
Data link layer design issues Framing Error Control
Example data link protocols HDLC and PPP
Multiple Access Protocols Static channel allocation Dynamic channel allocation
LAN technologies and their MAC protocols Ethernet WiFi and WiMax
-6- Georgia State UniversitySensorweb Research Laboratory
Functions of the Data Link Layer Provide service interface to the network layer Dealing with transmission errors Regulating data flow
Slow receivers not swamped by fast senders Sharing broadcast channels: multiple access
channels Determine who gets to use the channel when there is
competition for it
-7- Georgia State UniversitySensorweb Research Laboratory
Functions of the Data Link Layer
Relationship between packets and frames.
-8- Georgia State UniversitySensorweb Research Laboratory
Services Provided to Network Layer
Various services Unacknowledged connectionless service
Without ack, no logical connection Appropriate when error rate is low, real-time traffic (voice,
late data worse than bad data) Most LANs
Acknowledged connectionless service No logical connection, but individually acked Useful over unreliable channels (wireless)
Acknowledged connection-oriented service Guarantee frame received only once and in right order Three phases: connection established, frames transmitted,
connection released
-9- Georgia State UniversitySensorweb Research Laboratory
Adaptors Communicating
link layer implemented in “adaptor” (called NIC)
Ethernet card, PCMCI card, 802.11 card
sending side: encapsulates datagram in
a frame adds error checking bits,
rdt, flow control, etc.
receiving side looks for errors, rdt, flow
control, etc extracts datagram, passes
to rcving node adapter is semi-
autonomous link & physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
-10- Georgia State UniversitySensorweb Research Laboratory
Framing
Encapsulate datagram into frame, adding header and trailer
Break the bit stream up into discrete frames and compute the checksum of each frame
Relationship between packets and frames
-11- Georgia State UniversitySensorweb Research Laboratory
Framing – Character CountA character stream.
(a) Without errors. (b) With one error.
-12- Georgia State UniversitySensorweb Research Laboratory
Framing (2) – Flag Bytes
(a) A frame delimited by flag bytes.(b) Four examples of byte sequences before and after
stuffing.
Actually, after insert ESC control byte, it also inverts the fifth bit of (or XOR 0x20 with) the following data byte. See wiki or textbook p491. For simplicity, many textbooks do not mention it.
-13- Georgia State UniversitySensorweb Research Laboratory
Framing (3) – Bit Flags Delimit frame at both ends using 01111110 May close one frame and open another Receiver hunts for flag sequence to synchronize Bit stuffing used to avoid confusion with data
containing 01111110 0 inserted after every sequence of five 1s If receiver detects five 1s it checks next bit If 0, it is deleted If 1 and seventh bit is 0, accept as flag If sixth and seventh bits 1, sender is indicating abort
-14- Georgia State UniversitySensorweb Research Laboratory
Framing (4) – Bit Flags
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.
-15- Georgia State UniversitySensorweb Research Laboratory
Error Control Error Detection:
errors caused by signal attenuation, noise. receiver detects presence of errors:
error-detection codes signals sender for retransmission or drops frame
Error Correction: receiver identifies and corrects bit error(s) without
resorting to retransmission error-correction codes
-16- Georgia State UniversitySensorweb Research Laboratory
Error Detection and Correction
EDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking, may include header fields
• Error detection not 100% reliable!• protocol may miss some errors, but rarely• larger EDC field yields better detection and correction
-17- Georgia State UniversitySensorweb Research Laboratory
Error-Detection & Correction Code
Single Bit Parity:Detect single bit errors
Only odd bit errors detection
Examine: Number of 1s in the code is even
Consider a code with only 4 valid codewords:
00000 0000000000 1111111111 0000011111 11111
They have Hamming diatance 5 with each other, hence can correct double errors.
Example: 00000 00111 must be 00000 11111
Rules To correct d errors, you need a distance 2d+1 code To detect d errors, you need a distance d+1 code
Hamming distance of x and y is XOR(x,y)
-18- Georgia State UniversitySensorweb Research Laboratory
Error-Correction Code
Theoretical lower limit A code with m message bits and r check bits which will allow all
single errors to be corrected 2m legal messages – legal codewords For each legal message, there is n illegal codewords Total number of bit pattern is 2n
Therefore, (n+1)2m2n
n=m+r, (m+r+1) 2r => the limit can be achieved by Hamming code
Hamming Code It can correct any single bit error bits in power of 2 positions (1,2,4,8,) are check bits, the rest are
m data bits Check bit forces the parity of some collection of bit “1” to be
even To see which check bits the data bit in position k contributes to,
rewrite k as a sum of powers of 2. 11=1+2+8, 29=1+4+8+16
Hamming codeHamming code
-19- Georgia State UniversitySensorweb Research Laboratory
Hamming Code Example
If a 12-bit hamming code 0x9B8 = 100110111000 arrives at receiver, is there any bit error? If so, which bit is wrong?
Check bit
Checked Data bits Bits Sequence
1 3 5 7 9 11 1 0 1 1 1 0 (Yes)
2 3 6 7 10 11 0 0 0 1 0 0 (No)
4 5 6 7 12 1 1 0 1 0 (No)
8 9 10 11 12 1 1 0 0 0 (Yes)
1 2 3=2+1 4 5=4+1 6=4+2 7=4+2+1 8 9=8+1 10=8+2 11=8+2+1
12=8+4
1 0 0 1 1 0 1 1 1 0 0 0
Hence bit 6 = 2+4 is wrong, so correct hamming code should be 0x9F8 = 100111111000
-20- Georgia State UniversitySensorweb Research Laboratory
Correct burst errors
Use of Hamming code to correct k burst errors by send k ASCII character together, column by column. (Read Tanenbaum textbook page 195)
-21- Georgia State UniversitySensorweb Research Laboratory
Error-Detection Codes
Note When adding numbers, a carryout from the most
significant bit needs to be added to the result
Example: add two 16-bit integers
1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 01 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 01 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
wraparound
sumchecksum
Internet checksumInternet checksum
-22- Georgia State UniversitySensorweb Research Laboratory
Error-Detection Codes
view data bits, D, as a binary number choose r+1 bit pattern (generator), G goal: choose r CRC bits, R, such that
<D,R> exactly divisible by G (modulo 2) receiver knows G, divides <D,R> by G. If non-zero
remainder: error detected! can detect all burst errors less than r+1 bits, and odd
number of bit errors widely used in practice (ATM, HDCL)
Cyclic Redundancy Check
-23- Georgia State UniversitySensorweb Research Laboratory
CRC Example
Want:D.2r XOR R = nG
equivalently:D.2r = nG XOR R
equivalently: if we divide D.2r by G,
want remainder R
R = remainder[ ]
If G has r+1 bit, R has r bit
D.2r
GOperation is XOR, not +, or -!!!
Notice: x^3+1 is a generator!
Left shift r bit
0000
0000
-24- Georgia State UniversitySensorweb Research Laboratory
Another ExampleCalculation of the polynomial code checksum.
GCRC-32=100000100110000010001110110110111
-25- Georgia State UniversitySensorweb Research Laboratory
CRC generator preferenceGenerator G(x) with degree k can detect: All single-bit errors, as long as the xk and x0 terms have
nonzero coefficients. All double-bit errors, as long as G(x) has a factor with at
least three terms. Any odd number of errors, as long as G(x) contains the
factor (x+1). Any “burst” error(i.e., sequence of consecutive errored bits)
with the length less than (including equal) k bits. Burst errors of larger than k bits can also be detected with
high probability 1-1/2k)
* Refer textbook page 196-200
-26- Georgia State UniversitySensorweb Research Laboratory
Flow Control Ensuring the sending entity does not overwhelm
the receiving entity Preventing buffer overflow
Transmission time Time taken to emit all bits into medium
Propagation time Time for a bit to traverse the link
-27- Georgia State UniversitySensorweb Research Laboratory
Model of Frame Transmission
X
-28- Georgia State UniversitySensorweb Research Laboratory
Data Link Layer Road Map
Data link layer design issues Framing Error Control
Example data link protocols HDLC and PPP
Multiple Access Protocols Static channel allocation Dynamic channel allocation
LAN technologies and their MAC protocols Ethernet WiFi and WiMax
-29- Georgia State UniversitySensorweb Research Laboratory
Point to Point Data Link Control
one sender, one receiver, one link: easier than broadcast link:
no Media Access Control no need for explicit MAC addressing e.g., dialup link, ISDN line
popular point-to-point DLC protocols: PPP (point-to-point protocol) HDLC: High level data link control (Data link used to
be considered “high layer” in protocol stack!
-30- Georgia State UniversitySensorweb Research Laboratory
HDLC (High-Level Data Link Control)
Frame format for bit-oriented protocols.
Data link layer protocol used in IBM mainframe world, X.25 network, etc
Using slide window protocol (GBN, SR, or variations) for flow control and reliable data transfer
-31- Georgia State UniversitySensorweb Research Laboratory
HDLC (High-Level Data Link Control)
Control field of (a) An information frame. (b) A supervisory frame
ACK or RECEIVE READY NAK or REJECT: follow GBN protocol RECEIVE NOT READY: ask sender to stop SELECTIVE REJECT: follow SR protocol
(c) An unnumbered frame used for control purpose or carry data when unreliable connectionless service
needed
ACKed/NAKed frame#
-32- Georgia State UniversitySensorweb Research Laboratory
The Data Link Layer in the Internet
A home personal computer acting as an internet host.
-33- Georgia State UniversitySensorweb Research Laboratory
PPP Design Requirements [RFC 1557]
packet framing: encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same time
ability to demultiplex upwards bit transparency: must carry any bit pattern in
the data field error detection (no correction) connection liveness: detect, signal link failure to
network layer network layer address negotiation: endpoint can
learn/configure each other’s network address
-34- Georgia State UniversitySensorweb Research Laboratory
PPP non-requirements
no error correction/recovery no flow control out of order delivery OK no need to support multipoint links (e.g.,
polling)
Error recovery, flow control, data re-ordering all relegated to higher layers!
-35- Georgia State UniversitySensorweb Research Laboratory
PPP Data Frame Flag: delimiter (framing) Address: does nothing (only one option) Control: does nothing; in the future possible
multiple control fields Protocol: upper layer protocol to which frame
delivered (eg, PPP-LCP, IP, IPCP, etc)
-36- Georgia State UniversitySensorweb Research Laboratory
PPP Data Frame info: upper layer data being carried check: cyclic redundancy check for error
detection
Not bit-oriented, e.g., bit-stuffing, it uses byte-stuffing!
-37- Georgia State UniversitySensorweb Research Laboratory
Byte Stuffing
“data transparency” requirement: data field must be allowed to include flag pattern <01111110>
Q: is received <01111110> data or flag?
Sender: adds (“stuffs”) extra < 01111110> byte after each < 01111110> data byte
Receiver: two 01111110 bytes in a row: discard first byte,
continue data reception single 01111110: flag byte
-38- Georgia State UniversitySensorweb Research Laboratory
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
-39- Georgia State UniversitySensorweb Research Laboratory
PPP Data Control Protocol
Before exchanging network-layer data, data link peers must
LCP: configure PPP link (max. frame length, authentication)
NCP: learn/configure network
layer information for IP: carry IP Control
Protocol (IPCP) msgs (protocol field: 8021) to configure/learn IP address
LCP LCP configuratioconfiguratio
nn
-40- Georgia State UniversitySensorweb Research Laboratory
Reading Assignment Chapter 5
5.2 – 5.6