Lecture 2 - Lyle School of Engineering

Download Report

Transcript Lecture 2 - Lyle School of Engineering

Spring 2006
EE 5304/EETS 7304 Internet Protocols
1-24-2006
Tom Oh
Dept of Electrical Engineering
[email protected]
TO 1-17-06 p. 1
Administrative Issues
 Course Website: www.engr.smu.edu/eets/7304

Obtain lectures, video clip, syllabus, homework and
homework solutions
 Please fill out the Student Information Sheet and
email it to me as soon as possible.
 If you have any question regarding DVD delivery
and other adminstrative issues, please contact Gary
McClesky ([email protected], 214-768-3108).
 TA: Mr. Poonawala will be my TA for this semester.
TO 1-17-06 p. 2
Grade
 Because of huge enrollment in this class, I will not
include final report as a part of your semester grade.
So final grade will consists of three test grades only.
 Grade distribution:

Test 1: 30%

Test 2: 30%

Test 3: 40%

Homework will not be part of your grade.
 All tests will be close notes and books.
TO 1-17-06 p. 3
Grade (cont)
 Test Dates

Test 1 : Feb. 28 (Materials from week 1, 2, 3, 4, 5)

Test 2 : Apr. 4 (Materials from week 6, 7, 8, 10 and 11)
•

TO 1-17-06 p. 4
Week 9 is Spring Break
Test 3: Final week (May 5- 11) (Materials from week 12,
13, 14, 15 and 16)
DVD and Distance Learning Students
 DVD and DLS students will have additional week to
finish the test. For example, DVD students must
take Test 1 by Mar. 7.
 For DVD and DLS students: If you don’t have
proctor at your site, please ask Gary McClesky
about test proctor in your area.
TO 1-17-06 p. 5
Outline
 Types of networks
 History
 Standards
 Terminology
 OSI protocol reference model

Text Book (Comer): Ch. 16 Protocols and Layering: pg. 251-pg. 269
 Protocol layering principles

TO 1-17-06 p. 6
Text Book (Comer): Ch. 16 Protocols and Layering: pg. 251-pg. 269
Outline (cont)
 TCP/IP protocol architecture

Text Book (Comer): Ch. 17 Internetworking: Concepts, Architecture, and
Protocols: pg. 273-283)
 B-ISDN protocol reference model
TO 1-17-06 p. 7
OSI Protocol Reference Model (cont)
 7 layers:
7. Application layer

User program that generates or uses data

What the user sees
6. Presentation layer

Changes syntax (data format) of information, as
necessary
5. Session layer

TO 1-17-06 p. 8
Establishes and synchronizes sessions (dialogues)
between applications
OSI Protocol Reference Model (cont)
4. Transport layer
TO 1-17-06 p. 9

Reliable end-to-end transfer of information between users

Establishes and manages connections between users

Segments and reassembles information to/from subnet

End-to-end error recovery and flow control
OSI Protocol Reference Model (cont)
3. Network layer



TO 1-17-06 p. 10
Establishes and manages connections through network
Carries packets from source to destination by routing
between nodes
Congestion control
OSI Protocol Reference Model (cont)
2. Data link layer



Reliable error-free transmission on link, with flow control
and synchronization
Organizes bits into frames, adds acknowledgements and
retransmissions
MAC sublayer: controls access to shared medium (ie, in
LANs)
1. Physical layer
TO 1-17-06 p. 11

Point-to-point transmission of unstructured bitstream

Depends on physical medium
OSI Layering Principles
 Layers are independent and strictly vertical
 Each layer provides services to next higher layer
and use services from next lower layer
 “Protocol entities" are active in each layer
 “Peer entities" in same layer communicate with each
other
 To send, data is passed down the layers, each layer
adds protocol information (eg, header)
TO 1-17-06 p. 12
OSI Layering Principles (cont)
 To receive, data is passed up the layers, each layer
removes protocol information
 Protocol defines how the information is used
between peer entities in same layer
TO 1-17-06 p. 13
TO 1-17-06 p. 14
Difficulties with OSI Model
 Not best or only way to divide layers

Session and presentation layers are often minor, network
layer is complex
 Not followed exactly in practice, more useful as
reference
 Error control and flow control are repeated in
different layers
 Not obvious which layer is responsible for
encryption, network management, internetworking
 OSI model is strictly vertical: all networks conform
to single standard protocol in each layer
TO 1-17-06 p. 15
TCP/IP Protocol Architecture
 1974 DoD standardized protocol suite for
connecting other networks to ARPAnet

TO 1-17-06 p. 16
Internetworking is very important design consideration
TCP/IP Protocol Architecture (cont)
 4 layers:
4. Application layer

Telnet, ftp, SMTP, SNMP, HTTP

Corresponds to OSI layers 6-7, some 5
3. Transport (host-host) layer

Allows end-to-end communication

Connection establishment, error control, flow control


TO 1-17-06 p. 17
Transmission control protocol (TCP), user datagram
protocol (UDP)
Corresponds to OSI layers 4, some 5
TCP/IP Protocol Architecture (cont)
2. Internet layer


Route data between different networks
Includes addressing, segmentation/reassembly, error
control

Implemented in gateways and routers

Internet protocol (IP)
•

TO 1-17-06 p. 18
IP packet is basic data unit in Internet
Roughly corresponds to OSI layer 3
TCP/IP Protocol Architecture (cont)
1. Network access (host-to-network) layer



TO 1-17-06 p. 19
Lets host pass data to network with flow control, error
control, priority, security
Corresponds to OSI layers 1-2, some 3
Can be any protocol (eg, Ethernet, ATM, X.25) to carry IP
packets
OSI vs TCP/IP Models
 OSI model can be generally applied to most protocol
suites, TCP/IP model is specific to Internet
 Hierarchy versus layering
TO 1-17-06 p. 20

OSI does not allow different protocols in same layer

OSI allows interactions only between adjacent layers
OSI vs TCP/IP Models (cont)
 TCP/IP recognizes importance of internetworking
different networks

Internetworking was inserted into OSI model as sublayer
in layer 3
 TCP/IP recognizes importance of connectionless
service

TO 1-17-06 p. 21
OSI model recognizes only connection-oriented transport
layer
B-ISDN Protocol Reference Model
 3 planes:



TO 1-17-06 p. 22
User plane: protocols for
user data
Control plane: protocols for
control (signaling) data
Management plane:
protocols for management
data (e.g., OAM)
B-ISDN Protocol Reference Model (cont)
 4 layers in user plane:
4. Services

Originally Class A, B, C, D (obsolete)

Now CBR, real-time and nonreal-time VBR, ABR, UBR
3. ATM adaptation layer (AAL)

TO 1-17-06 p. 23
Originally AAL 1, 2, 3, 4 corresponding to services classes
A, B, C, D

Now AAL1, AAL2, AAL3/4, AAL5

Translate user data into ATM cells
B-ISDN Protocol Reference Model (cont)

2 sublayers:
•
Convergence sublayer (CS): service-specific
•
Segmentation and reassembly (SAR): divides user messages into 48byte cell payloads and recombines at receiver
2. ATM layer

TO 1-17-06 p. 24
Connection-oriented transfer of ATM cells (53-byte
packets) across network

Establish, maintain, and terminate virtual connections

Routing and congestion control
B-ISDN Protocol Reference Model (cont)
 1. physical (transmission) layer
TO 1-17-06 p. 25

Physical signal and framing, e.g., SONET

Assumed to be digital, highly reliable, low bit errors
Wrap Up
 Protocol layering is a central design principle in all
modern networks, although approaches may differ
in some aspects
 Examples: OSI reference model, TCP/IP protocol
suite

TO 1-17-06 p. 26
While TCP/IP is prevalent in practice, OSI reference
model provides a common conceptual understanding and
terminology
Spring 2006
EE 5304/EETS 7304 Internet Protocols
Data Link Layer, Error
Detection, ARQ
Tom Oh
Dept of Electrical Engineering
[email protected]
TO 1-17-06 p. 27
Outline
 Data link layer
 Error detection
 Stop-and-wait ARQ
 Go-back-N ARQ
 Selective repeat ARQ
TO 1-17-06 p. 28
Data Link Layer (OSI Layer 2)
Layer 3
Network
- Routing, congestion control
Layer 2
Data link
- Hides details of physical layer from network
- Adds reliability, synchronization, flow control
Layer 1
Physical
- Unguaranteed, unstructured bitstream
transmission on physical channel
- Electrical/optical/radio
TO 1-17-06 p. 29
Data Link Layer (cont)
 Adds synchronization (framing), reliability (error
control), and flow control


Depends on quality of physical layer
Eg, wireless links are unreliable needing strong error
control, optical fiber links are very reliable needing little
error control
 Framing
TO 1-17-06 p. 30

Break bitstream into identifiable frames

Frame = block of data + control info. (frame header/trailer)
Framing
 Break bitstream into identifiable frames = block of
data + control info. (frame header/trailer)
 Commonly use special byte pattern (eg, 01111110)
to mark beginning and end of frame

Same byte can mark end of one frame and start of next
Frame
B
Node
TO 1-17-06 p. 31
Frame
EB
E
Node
Framing (cont)
 What if this byte pattern appears in data?


Bit stuffing: insert 0 bit after every 5 consecutive 1's
Receiver recognizes this pattern and deletes the stuffed 0
bit
 Pattern of 6 consecutive 1's can only mean frame
beginning/end

TO 1-17-06 p. 32
More than 6 consecutive 1's is illegal condition
Error Control
 To detect random bit errors and possibly correct
them
 Bit errors can cause lost frame (unrecognizable
frame) or errored frame (certain bits are wrong)
 Commonly handled by ARQ (automatic repeat
request) schemes involving error detection +
acknowledgements + retransmissions per frame
TO 1-17-06 p. 33

Stop-and-wait ARQ

Go-back-N ARQ

Selective-reject (selective repeat) ARQ
Error Control (cont)
 Error control = error detection or error correction




TO 1-17-06 p. 34
Typically only detection -- more efficient to retransmit
(ARQ- automatic repeat request) than correct (FECforward error correction) if bit error rate is low
ARQ involves overhead cost per packet + costs for ACKs
+ costs for retransmissions, but retransmissions will be
rare if bit error rate is low
FEC requires more code bits per frame → more overhead
cost for every packet even if no errors
Error correction must be used when retransmissions
cannot be requested, e.g., simplex links, deep space,
audio CDs
Error Control (cont)
 In ARQ schemes, acknowledgements can be
positive or negative
 Positive acknowledgement: ACK only frames
received error-free

No ACK means need to retransmit

Sender will retransmit frame after time-out
•

TO 1-17-06 p. 35
Could be slow to respond to lost frame
Lost ACKS → unnecessary retransmissions
Error Control (cont)
 Negative acknowledgement (NACK): NACK only
errored frames

NACK means need to retransmit

Saves bandwidth if errors are rare

What if NACK is lost?
•
Possible complications
 Or both positive + negative acks

TO 1-17-06 p. 36
Sender will retransmit for NACK or lost ACK/NACK
Error Detection
 For data of m bits, add an error check of r bits

Error check includes some redundancy of data enough to
detect errors but not which error
 n-bit codeword = m data bits
+ r error check bits
m data bits
r check bits
m
2 “legal” codewords
TO 1-17-06 p. 37
Hamming Distance
 Hamming distance = minimum number of bit errors
to change legal codeword into another legal
codeword
 To detect d errors, need distance (d+1) code

Takes d+1 or more bit errors to receive legal codeword
that was another codeword originally
 To correct d errors, need distance (2d+1) code

TO 1-17-06 p. 38
With d or fewer errors, can always look for closest legal
codeword
Hamming Distance (cont)
 Eg, codewords: 0000000000, 0000011111,
1111100000, 1111111111

Distance = 5 → detect up to 4 bit errors
C1
Up to 4 bit errors are
detectable as illegal
codewords
C2
5
4
distance = 5
Codewords
C3
C4
5
TO 1-17-06 p. 39
Hamming Distance (cont)
 Codewords: 0000000000, 0000011111, 1111100000,
1111111111

Distance = 5 → correct up to 2 bit errors
C1
C2
2
distance = 5
Codewords
5
C3
C4
5
TO 1-17-06 p. 40
2
Up to 2 bit errors are
correctable to nearest
legal codeword
Single (even) Parity Bit
 Parity=0 if number of 1 bits in data is even, parity=1
if number is odd (ie, parity bit = binary addition of
data bits modulo 2)

Valid codewords should always have even number of 1’s
 Distance = 2 code → can detect single bit errors (or
odd number of bit errors), no error correction
 For long frames or bursty errors, even or odd
number of bit errors are equally likely → about
equally likely to detect errors as not
TO 1-17-06 p. 41
Received codewords:
Example:
legal illegal
transmission
3 bits
parity bit
→ 23 legal codewords
out of
24 possible codewords
TO 1-17-06 p. 42
0000
0011
0101
0110
1001
1010
1100
1111
0001
0010
0100
0111
1000
1011
1101
1110
Single bit error will change valid word
into an invalid word (detectable);
double bit error will change valid word
into another valid word (undetectable)
Bit-Interleaved Parity (BIP-N)
 1st error check bit = parity bit over 1st bits of all Nbit sequences
 2nd error check bit = parity bit over 2nd bits of all
N-bit sequences, etc.

TO 1-17-06 p. 43
Better for detecting bursts, eg, an error burst of length up
to N is easily detected
Horizontal/Vertical Parity Checks
 Arrange data in M x N array, calculate parity bits for
M rows and N columns

TO 1-17-06 p. 44
Lower right corner can be parity check over column or row
parity bits
Horizontal/Vertical Parity Checks (cont)
 Distance = 4 code



TO 1-17-06 p. 45
Can detect odd number of bit errors in any row or column
Can detect up to 3 bit errors and correct any single bit
error
But any rectangular pattern of 4 bit errors is undetectable
IP Example
 Internet protocol (IP) checksum



Checksum field is included in IP packet header for error
detection
View packet as sequence of 16-bit words, add up all words
using ones complement arithmetic
Errors are detected if checksum in header does not match
with calculated checksum
•
•
TO 1-17-06 p. 46
Relatively weak error detection but simple implementation
eg, misordering of 16-bit words is not detectable
Cyclic Redundancy Check (CRC) or
Polynomial Codes
 k-bit string is viewed as coefficients of (k-1)-degree
polynomial, eg, 1011 represents 3rd-degree 1x3 +
0x2 + 1x + 1
 All arithmetic is modulo 2, ie, XOR (binary
addition/subtraction without carries/borrows)

Modulo 2 long division is like binary except subtraction is
modulo 2
 Sender and receiver agree on r-degree generator
polynomial G(x)

TO 1-17-06 p. 47
Both highest order bit and last bit are 1
CRC (cont)
 Compute r-bit checksum and append to m-bit data
string such that resulting n-bit codeword is exactly
divisible by G(x)

(1) append r zeros to end of m-bit data string M(x) to get
(m+r) bits representing xrM(x)

(2) divide (modulo 2) xrM(x) by G(x)

(3) r-bit remainder is checksum
 Resulting n-bit codeword C(x) is exactly divisible
by G(x) with no remainder
TO 1-17-06 p. 48
Example: M(x)=10011010, G(x)=1101
1. Append temp. 000 to M(x)
2. Divide by G(x)
3. Append remainder to M(x)
TO 1-17-06 p. 49
x3M(x) = 10011010000
11111001
1101 10011010000
1101
1001
1101
1000
1101
1011
1101
1100
1101
1000
1101
101
C(x) = 10011010101
CRC (cont)
 Receiver divides codeword by G(x), assumes no
error only if remainder is 0
 Consider error pattern as polynomial E(x)



TO 1-17-06 p. 50
Received frame = transmitted codeword C(x) + E(x)
C(x)/G(x) has no remainder -> any remainder is due to
E(x)/G(x)
Errors undetectable only if E(x) is exactly divisible by G(x)
CRC (cont)
 Best choices of G(x) are not evenly divisible by
common error polynomials E(x), and




TO 1-17-06 p. 51
if G(x) has 2 or more terms, then all single-bit errors can
be detected
if G(x) has a factor with at least 3 terms, then all double-bit
errors can be detected
if x+1 is a factor of G(x), then any odd number of errors
can be detected
r-bit checksum will detect all burst errors of length up to r
CRC (cont)
 Commonly used G(x):

CRC-12: x12 + x11 + x3 + x2 + x + 1

CRC-16: x16 + x 15 + x2 + 1

CRC-CCITT: x16 + x 12 + x5 + 1

TO 1-17-06 p. 52
CRC-32: x32 + x 26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 +
x7 + x5 + x4 + x2 + x + 1
ARQ Schemes
 Automatic repeat request (ARQ) is possible when a
feedback channel can be used for
acknowledgements
 Receiver detects errors but does not attempt to
correct
 Overhead (retransmissions) is incurred only when
necessary, unlike constant overhead in FEC
(redundant bits)
 More efficient than FEC for low BER
TO 1-17-06 p. 53
Stop-and-Wait ARQ
 Source sends a frame and waits for ACK or NACK
 Receiver returns ACK for correct frame, NACK for
errored frame, nothing for destroyed frame
 Source retransmits after NACK or time-out
 Sends next frame only after valid ACK
TO 1-17-06 p. 54
Stop-and-Wait ARQ (cont)
time
TO 1-17-06 p. 55
Stop-and-Wait ARQ (cont)
 If ACK is lost, source will retransmit
TO 1-17-06 p. 56

Receiver will get copy of previous frame

Frames must be numbered to avoid ambiguities
Stop-and-Wait ARQ (cont)
 If ACK is late, sender will retransmit

Sender may get duplicate ACKs after retransmission

Duplicate ACKs must not cause confusion

TO 1-17-06 p. 57
ACKs must be numbered (convention is to give number of
next expected frame)
Stop-and-Wait ARQ (cont)
 One bit sequence number is sufficient

Only ambiguity is between consecutive frames
 Simple but inefficient

tframe = time to transmit frame

tprop = propagation time

TO 1-17-06 p. 58
If no errors, it takes tframe + 2 tprop time per frame
(ignoring time for ACKs)
Stop-and-Wait ARQ (cont)
 Utilization U = 1/(1 + 2a) where a = tprop/tframe
(normalized propagation time)
time
TO 1-17-06 p. 59
Go-Back-N ARQ
 Efficiency can be improved by allowing multiple
frames in transit before ACK
 Sliding window = up to N unacknowledged frames
allowed to be in transit at any one time
 Sender must wait for ACK before advancing
window to next frame

TO 1-17-06 p. 60
Example: if last ACKed frame is j, sender can send up to
frame j+N before stopping and waiting for ACK of frame
j+1
Go-Back-N ARQ (cont)
 ACKs may be accumulative, ie, ACK(j) will
acknowledge all frames up to j
 ACKs may be “piggybacked” - carried in the header
of a data frame in reverse direction
 If frame j is NACKed, sender will go back and
resend frame j


TO 1-17-06 p. 61
For simplicity, all subsequent frames are repeated
Destination can discard errored frame j and all subsequent
frames until frame j is received correctly
Go-Back-N ARQ (cont)
timeout
A
B
0
1
2
3
4
5
6
7
8
9 10
0
1
2 E D D D D 3
4
5
6
7
8
error
4
5
6
7
3
frames discarded
by receiver
time
TO 1-17-06 p. 62
9 10
Go-Back-N ARQ (cont)
 n-bit sequence numbers can support window sizes
up to 2n-1
 Why not window sizes up to 2n?

TO 1-17-06 p. 63
Example: assume 3-bit sequence numbers and window
size of 8
Go-Back-N (cont)
Window size = 8:
Ack(0) refers to
entire window of
frames or is it
duplicate of
previous Ack(0)?
timeout
A
0
1
2
3
4
5
6
7
0
B
0
1
2
time
TO 1-17-06 p. 64
3
4
5
6
7
0
No problem if
window size is
limited to 7
instead
Go-Back-N (cont)
timeout
A
0
1
2
3
4
Window size = 7:
5
6
7
No ambiguity
because Ack(0)
cannot re-occur
B
0
1
2
3
time
TO 1-17-06 p. 65
4
5
6
7
Go-Back-N (cont)
 Assume no errors and normalize:

Frame transmission time = 1

Propagation time = a
 Case 1: N > 2a + 1
1
2a
N
TO 1-17-06 p. 66
First Ack returns before the end of
window
→ sender can keep transmitting
→ utilization U = 1
Go-Back-N (cont)
 Assume no errors and normalize:

Frame transmission time = 1

Propagation time = a
 Case 2: N < 2a + 1
1
2a
First Ack returns after the end of
window
→ sender must stop and wait
→ utilization U = N/(1+2a)
N
TO 1-17-06 p. 67
Selective Repeat ARQ
 Go-back-N may be inefficient because several
frames are retransmitted for every errored frame,
even if some were received properly
 Efficiency may be improved if sender retransmits
only specific errored frames


TO 1-17-06 p. 68
If frame j is lost, receiver will continue to receive and buffer
frames j+1, j+2,...
When frame j is received without errors, frames must be
reordered in proper sequence
Selective Repeat (cont)
timeout
A
B
0
1
2
3
4
5
6
7
3
8
9 10 11 12 13 14
0
1
2 E 4
5
6
7
3
8
error
TO 1-17-06 p. 69
frames must be
buffered and
reordered after
frame 3 received
correctly
9 10 11 12 13 14
time
Selective Repeat (cont)
 Capable of higher efficiency than go-back-N


If no errors, efficiency is same as go-back-N
If errors, each error causes one frame retransmission (goback-N would retransmit multiple frames)
 Not as widely adopted as go-back-N because more
difficult implementation

TO 1-17-06 p. 70
Receiver must buffer frames received after an errored
frame and re-order them after that frame is retransmitted
Wrap Up
 Data link layer adds synchronization, reliability, and
flow control above physical layer if needed
 Error control for reliability


TO 1-17-06 p. 71
Usually error detection and retransmissions
Stop-and-wait ARQ, go-back-N ARQ, selective repeat
ARQ