Data Link Layer - Mississippi State Universityweb.cse.msstate.edu/~ramkumar/DLLayer.pdf · Data...
Transcript of Data Link Layer - Mississippi State Universityweb.cse.msstate.edu/~ramkumar/DLLayer.pdf · Data...
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Data Link Layer
Mahalingam RamkumarMississippi State University, MS
September 18, 2006
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Outline
1 Services Provides By DL LayerData Link Layer Issues
2 Framing
3 Error ControlError CorrectionError Detection
4 Data Link ProtocolsIssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
5 Internet DL ProtocolsPPP
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Data Link Layer Issues
Data Link Layer
Provide services to network layer
Types of services
Unacknowledged connectionless serviceAcknowledged connectionless serviceAcknowledged connection-oriented service
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Data Link Layer Issues
Packet vs Frame
TrailerHeader Payload field
Frame
Sending machine
PacketPacket
Receiving machine
TrailerHeader Payload field
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Data Link Layer Issues
Virtual / Actual Communication Path
4
3
2
1
4
3
2
1
4
3
2
1
4
3
2
1
Host 1 Host 2 Host 1 Host 2
Virtual data path
Actual data path
(a) (b)
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Data Link Layer Issues
Purpose
Well defined service to network layer
Deal with transmission errors
Flow control
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Data Link Layer Issues
Issues
All we need to do is send a sequence of bits from one end of awire to the other end.
How complicated can that be?
Synchronization
Logical organization of frames
Did the data actually reach the other end?
Integrity of the data received (remember noise?)
Type of service provided to higher layers.
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Framing
Organization of frames
Methods
Character countByte stuffingBit stuffingUsing physical layer “redundancy”
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Character Count
Errors may result in loss of synchronization
(b)
(a) 5 1 2 3 4 5 6 7 8 9 8 0 1 2 3 4 5 6 8 7 8 9 0 1 2 3
5 1 2 3 4 7 6 7 8 9 8 0 1 2 3 4 5 6 8 7 8 9 0 1 2 3
Character count One character
Error
Frame 1 5 characters
Frame 1
Frame 2 5 characters
Frame 2 (Wrong)
Frame 3 8 characters
Frame 4 8 characters
Now a character count
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Byte Stuffing
Used in PPP. Only for byte oriented communications
A BESC FLAG
A BESC ESC
A ESC BESC ESC FLAG
A ESC BESC ESC ESC
BA FLAG
BA ESC
FLAGA ESC B
ESCA ESC B
FLAGTrailerFLAG Header Payload field
Original characters After stuffing
(a)
(b)
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Bit Stuffing
Simple algorithm - 01111110 used as flagAt transmitter - after 5 consecutive ones insert a zeroAt receiver - In a pattern of 111110 anywhere in the data, removethe trailing zero!
0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0
0 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 0 0 1 0
Stuffed bits
(a)
(b)
(c) 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Error CorrectionError Detection
Errors Happen!
Need to detect errors
If possible it will also be nice if we could correct errors
The key - redundancy
Some extra bits need to be transmitted for detecting /correcting errors
Example - parity bits
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Error CorrectionError Detection
Hamming Distance
A metric for measuring “distances” between two sequences ofbits
A = 1000110
B = 1010100
How many bits need to be flipped to get B or A (orvice-versa)?
Two bits - the Hamming distance between A and B is 2.
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Error CorrectionError Detection
Error Detection with Parity Bit
A = 1000110
With even parity A = 10001101
With odd parity A = 10001100
For all subsequent discussions we will only use even parity
If any of the eight (7+1) bits of A is flipped duringtransmission parity check will fail.
What happens if two bits get flipped?
Parity check fails to detect error...
With one redundant bit we can only detect one-bit errors.
Actually any odd number of bit-errors
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Error CorrectionError Detection
Redundancy
Need to transmit m bit symbols (2m possible symbols)
r redundant bits (for error detection / correction)
n = m + r bits actually transmitted.
Efficiency is mm+r = m
n
In general, more the redundancy, more the errors that can bedetected / corrected
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Error CorrectionError Detection
A Simple-Minded Approach
Just repeat every bit twice (efficiency 0.5) - any one bit errorcan be detected
Parity bit (just add one extra bit) - efficiency mm+1 - very high
for large m.
Why was the first method so inefficient?
Actually it is not - it can detect much more than “single biterrors”
How can we correct single bit errors automatically?
Repeat each bit three times (efficiency 0.33)
Are there better ways?
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Error CorrectionError Detection
Error Detection vs Correction
Obviously error correction needs more redundancy
Error detection is much more crucial than error correction -Why?
Typically error detection techniques address the problem ofdetecting multiple-bit errors.
Error correction is usually more often used only for correctionof single bit errors.
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Error CorrectionError Detection
Single Bit Errors are Statistically More Frequent!
Let us assume that the probability that any bit may beerroneously received is p = 10−9.
If N = 103 bits are transmitted, probabilty that there may bea bit error is roughly one in a million.
Probabilty that there may be two bit errors is roughly one in atrillion
We can just “ignore” two bit errors
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Error CorrectionError Detection
Our Focus
How do we correct one-bit errors?
If the receiver is able to correct errors, the sender does notneed to retransmit
How do we detect multiple-bit errors?
If error is detected, the receiver can request the sender toretransmit
Or simply not acknowledge reception
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Error CorrectionError Detection
One-bit Error Correction
m bit numbers need to be sent across a link
r redundant bits
We transmit n = m + r bits instead of m - efficiency mn
With n bits we can represent 2n unique sequences
We need to convey any of 2m unique sequences
Represent each of the 2m sequences with one n bit sequence
At the receiver there may be either one one-bit-error or noerrors
When a sender sends n bits, the receiver can receive upton + 1 different sequences
To detect error, the receiver should be able to get the correctn bit sequence from any of the n + 1 possible sequences.
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Error CorrectionError Detection
Partition!
Partition the 2n numbers into 2m non-overlapping partitionsEach partition should have n + 1 elementsEach partition has one sequence which is a representation ofone of the 2m symbols.Under no error or one bit error, the recieved sequence will stillbe in the same partitionHow much redundancy is needed?2n ≥ (n + 1)2m. Or 2m+r ≥ (m + r + 1)2m. Or2r ≥ m + r + 1.m ≤ 2r − r − 1.m = 1; r = 2; (1 = 4− 2− 1 = 1). This is a (1, 3) codem = 2; r = 3; (2 ≤ 8− 3− 1 = 4).m = 4; r = 3; (4 = 8− 3− 1 = 4). This is a (4, 7) code.r = 10, 2r − r − 1 = 1024− 10− 1 = 1013. (1013, 1024) code
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Error CorrectionError Detection
Hamming Codes
m = 2r − r − 1 - efficient codes. (4, 7), (11, 15)
Lets analyze the (4, 7) code: r = 3 parity bits, n = 7transmitted bits, m = 4 information bits.
Each bit position (1 to 7) can be represented in binary form
1 0 0 1 1 bits 1,2,4 are parity bits2 0 1 0 2 1 0 0 1 → 1 0 0 x 1 x x3 0 1 1 1 2 Even parity4 1 0 0 4 1 0 0 x 1 x x → 1 0 0 x 1 x 0
5 1 0 1 1 4 1 0 0 x 1 x 0 → 1 0 0 x 1 0 0
6 1 1 0 2 4 1 0 0 x 1 0 0 → 1 0 0 1 1 0 0
7 1 1 1 1 2 4 1001100 is the (4,7) code for 1001
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Error CorrectionError Detection
1001 → 1001100
Rx checks all parity bits and wites the result as xxx
If no error, all parities check out. So xxx = 000.
What happens if bit 6 is flipped? Rx gets 1101100
Parity bits 4 and 2 are wrong! So xxx = 110
If bit 5 is flipped parity bits 4 and 1 are wrong. xxx = 101
If bit 1 is flipped only parity bit 1 is affected. xxx = 001
If bit 2 is flipped only parity bit 2 is affected. xxx = 010
If bit 4 is flipped only parity bit 4 is affected. xxx = 100
xxx gives you the position of the error! Go ahead and correctit...
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Error CorrectionError Detection
Syndrome Decoding
A syndrome is a “collection of symptoms.”
Each result of parity check is a symptom.
The syndrome should unambiguously indicate the error.
With r redundant bits, we have 2r unique syndromes
We can detect 2r − 1 different “diseases” (one syndromecorresponds to “no illness”).
n ≤ 2r − 1
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Error CorrectionError Detection
Burst Errors
In practice, burst errors are more common (example uses (7,11)
Hamming code)
Char.
H a m m i n g c o d e
ASCII 1001000 1100001 1101101 1101101 1101001 1101110 1100111 0100000 1100011 1101111 1100100 1100101
Check bits 00110010000 10111001001 11101010101 11101010101 01101011001 01101010110 01111001111 10011000000 11111000011 10101011111 11111001100 00111000101 Order of bit transmissionRamkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Error CorrectionError Detection
Error Detection
Single error detection with parity bit
Burst error detection?
arrange M = w × h bits as a matrixParity bit for each row (h parity bits)Transmit column-wiseWe have w + 1 columns - total bits (w + 1)× h
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Error CorrectionError Detection
Multiple Error Detection
Double errors
arrange M = w × h bits as a matrix
Parity bit for each row (h parity bits) - we have (w + 1)× hmatrix
Parity bit for each columm - we end up with (w + 1)× (h + 1)matrix
Why does this work?
If 2 errors happen in the same row (column) they cannot be inthe same column (row)
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Error CorrectionError Detection
Cyclic Redundancy Checks
Need some background on polynomial arithmetic
Any bit string is considered as a polynomial in the field {0, 1}A polynomial - P(x) = x r + ar−1x
r−1 + · · ·+ a1x1 + a0
If P(x) is in the field of real numbers, x , a0 . . . ar−1 canassume any real value
P(x) in {0, 1} - x , a0 . . . ar−1 can only assume two values - 0or 1
Example - 110101 is represented as P(x) = x5 + x4 + x2 + 1.
Addition - 1 + 1 = 0 = 0 + 0, 1 + 0 = 0 + 1 = 1
Subtraction is the same as addition!
Multiplication - 1× 1 = 1, 0× x = 0.
P(0) = 1. P(1) = 1 + 1 + 1 + 1 = 0.
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Error CorrectionError Detection
Polynomial Arithmetic
P(x) = x5 + x4 + x2 + 1. Q(x) = x2 + x1
P(x) + Q(x) = x5 + x4 + x1 + 1
P(x)× Q(x) = (x5 + x4 + x2 + 1)(x2 + x1) =x7+x6+x4+x2+x6+x5+x3+x1 = x7+x5+x4+x3+x2+x1.
Polynomial division - what is P(x)/Q(x)
110 |110101 | 1001 (quotient)110---000101
110---011 (remainder)
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Error CorrectionError Detection
CRC
Choose a generator polynomial G (x) of degree r (r + 1 bitnumber)
Message to be sent M(x) (degree of M(x) not less than r)
Append r zeros to M(x). The result is x rM(x).
Evaluate the remainder of x rM(x)/G (x) (remainder will be apolynomial of degree less than r) - say R(x)
Transmit T (x) = x rM(x)− R(x) = x rM(x) + R(x)
Receiver receives T (x)
In case of error receiver gets T ′(x) = T (x) + E (x)
Receiver checks if remainder of T ′(x)/G (x) is zero
If remainder is not zero receiver decides that there is an error
As T (x)/G (x) = 0, T ′(x)/G (x) = E (x)/G (x)
Errors where E (x)/G (x) is zero goes undetected
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
Error CorrectionError Detection
Good choice for G (x)
Both highest and lowest order bits should be 1 (1xx · · · xx1)
If G (x) has degree more than 1 all single bit errros will bedetected - E (x) = x i .
Two isolated single bit errors E (x) = x i + x j = x j(x i−j + 1)
Any G (x) that does not have xk + 1 as a factor (for allk ≤ m) is sufficient
If x + 1 is not a factor, then all odd nuber of errors can bedetected.
Any burst error of length ≤ r can be detected
32 bit polynomial specified in IEEE 802
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
Basic Functions
Need to transmit sequence of packets from source todestination
Reliably (reception should be acknowledged)
Need to provide packets in the correct order to the higher layer
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
Fundamental Limitations
Packet size (limited usually by channel error-rate)
Bits - number of bits - say P bitsDuration - depends on channel data rate. If rate is R bps thenpacket duration is τp = P
R seconds
Finite propagation time - depends on distance between sourceand destination, and velocity of propagation (electromagneticwaves) in the medium
If c is the velocity, and d is the distance, propagation time isτc = d
c .
Typically c ≈ 2.5× 108 m/s in copper wires.
Processing time τr - a finite amount of time needed forprocessing packets
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
Example
100 Mbps channel, packet size 2000 bits
τp = 2000100000000 = 20 µs
d = 1000m. c = 2.5× 108 m/s. τc = 10002.5×108 = 4µs
Processing time - say 5µs
At t = 0 A starts transmission
At t = 4µs B senses the leading edge of the packet
At t = 24µs B senses trailing edge of the packet
At t = 29µs B starts sending the reply packet (say 2000 bits)
At t = 33µs A senses leading edge of reply
At t = 53µs A senses trailing edge of reply
Round trip time (RTT) - τp + τc + τr + τc + τp
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
Reliable Data Transfer
Need to transmit a sequence of packets
Packets need to be acknowledged
Packets can get “lost”
Timeout for retransmission
But acknowledgements can get “lost” too!
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
Lost Acknowledgements
Can both sender and receiver agree that P1′ is a retransmission ofP1 and not P2?
Timeout Interval
X(B)
ACK ACK
P1 P1’
(A)
Timeout Interval
ACK
P1 P2
ACK
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
Packet Numbers!
Packets need to be numbered
Obviously numbers will be “recycled”
How many unique sequence numbers do we need?
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
Ambiguous Acknowledgements
How does the sender know that the second acknowledgement is forP1 or P2?
Timeout Interval
X(C)
P1
ACK
P1’ P2
ACK
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
Numbering
Acknowledgements need to be numbered too!
ABP protocol
One bit packets numbers - 0 or 1
One bit ACK numbers
Is this unambiguous?
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
Alternating Bit Protocol (ABP)
Timeout Interval
0
1 2
1
1 2
Packet NoSeq No
Ack NoPacket No
0 1
(D)
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
ABP is Unambiguous!
Timeout Interval
X(E)
1 1 2
0
0
0
Timeout Interval2
1 10
1 1 2
Timeout Interval
X(F)
10
10
0 0
2
2
1
Packet NoSeq No
Ack NoPacket No
Packet NoSeq No
Ack NoPacket No
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
Effective Data Rate
100 Mbps link A ↔ B
d(A,B) = 2000m
packet size 100 bits
τp = 100100000000 = 1µs
τc = 20002.5×108 = 8µs
Assume τr = 1µs
What is the effective data rate between A and B when ABP isused?
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
Sequence of Events
t = 0 - A starts transmission
t = τp + τc + τr = 10µ,
B starts acknowledgement packet to A
t = 10 + τp + τc + τr = 20µs
A starts sending packet 2 to B
t = 29µs - B completes reception of packet 2 from A
t = 30µs - B starts ACK for P2 to A.
t = 40µs - A is ready to send P3 to B.
Takes 40µs to send 2 packets from A to B
5 Mbps bit-rate achieved in a 100 Mbps line!
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
Improving Throughput
What if A sends 8 packets without waiting foracknowledgement?
Window size 8.
Receiver could
Send ACK after 8 packetsSend ACK after every packet
Lets assume Rx sends ACK for every packet
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
Improving Throughput
At t = 0, 1, 2, . . . , 8µs A starts sending packets 1 · · · 8 to B
At t = 10µs B starts ACK to A
At t = 11, 12, . . . 18µs B starts ACK to A for packets 2,3,...8
At t = 20µs - A starts sending packet 9
If everything goes well, at t = 40µs, A starts sending packet17.
Throughput - 20µs for 800 bits - or 40 Mbps
What if we used window size of 20?
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
Pipelining
The secret to higher throughput
Assumes nodes can do “multiple” things at the same time.
ABP needs only half-duplex channels, for larger window sizeswe implicitly assumed full duplex channels
Nodes may need to buffer packets when things do not go well
What is the buffer size needed?
How do we number packets and acknowledgements
What if we do not acknowledge every packet (and sendcollective ACKs once in a while)?
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
Selective Repeat Protocol
Similar to ABP, with window size W
Or ABP is SRP with window size 1
Pipelining
Buffer size of W packets
Numbering packets?
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
SRP Rules
2W distinct numbers. If W = 4, numbers 0,1,...7.
P1 to P8 numbered 0 to 7 respectively
P9 / P17 are numbered 0. P10 / P18 are numbered 1...andso on.
If the lowest unacknowledged packet is i , sender is allowed tosend packets i through i +W −1 (sliding window of width W )
If sender has received ACKs for P1, P3 and P4 (or sender hasreceived ACKs with numbers 0, 2 and 3), sender can sendpackets P2 · · ·P5. Sender cannot send P6.
There can be no more than W outstanding unacknowledgedpackets.
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
SRP: Receiver Logic
If the last acknowledged packet in an unbroken sequence is j ,the next received packet could be between j −W + 1 andj + W .
Receiver who has (received and) acknowledged packetsP1 · · ·P4 could receive (as the next packet) P1 · · ·P8 (or apacket numbered between 0 and 8). The next packet cannotbe P9.
If receiver has acknowledged P1 · · ·P5 and P7 (or packetswith numbers 0, 1, 2, 3, 4, and 6) the next packet could be inthe range P2 · · ·P9.
Cannot be P1. Cannot be P10.
If a packet with number 0 is received, is it P1 or P9?
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
SRP, W = 4, Numbering 0,1,2,3
Timeout Interval
1 2 3 4 5 6 71 2
01 2
132
4 50
61
72
0 1 2 3 0
3
X
43
3
8 or 4 ?
Data Packet
Seq NoData Packet
Seq No
1)
2)
Data Packet Ack No
Data Packet Ack No
Timeout Interval
1 2 3 4 5 6 71 2
83
01 2
132
4 50
61
72
83
0 1 2 3 0
3
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
SRP, W = 4, Numbering 0,1,2,3,4,5,6
Timeout Interval
1 2 3 4 5 6 75 6
80
01 2
132
4 54
65
76
80
0 1 2 3 4
3
Timeout Interval
1 2 3 4 5 6 75 6
80
01 2
132
40
0 1 2 3 4
3X X X
1 or 8?
Data Packet
Data Packet
Seq No
Seq No
3)
4)
Data Packet Ack No
Data Packet Ack No
Timeout Interval
1 2 3 4 10
01 2
132
4
0 1 2 3
3
X
1 or 8?
Data Packet Seq No
5)
Data Packet Ack No
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
Negative Acknowledgements (NACK)
Say W = 100, and receiver did not receive packet 2 (butreceived packet 1 and 3).
Normally sender would wait for timeout for ACK for 2 beforehe knows that packet 2 was not received.
But an acknowledgement for 3 could indicate “negativeacknowledgement” for 2
In case sender has not sent all packets, he could stop sendingfurther packets and retransmit 2.
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
IssuesPrinciples of Reliable Data TransferEffective Data RateProtocols With Pipelining - Sliding Window Protocols
Go Back N - GBN Protocol
Window size W
Receiver does not buffer packets
Peridically sends acknowledgement for the last recieved packetnumber in sequence
Out of sequence packets are discarded
Example, if Rx gets packets 1,2,3,4,5,7,8,9,10 the ACK is tillpacket 5. Sender gets no info about subsequent packets.
Sender retransmits all packets 6 and above.
If the last acknowledged packet is i sender can send packetsi + 1 to i + W .
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
PPP
PPP in Dial-up Internet
PC
Routing process
Router
Modems
Internet provider's office
User's home
Client process using TCP/IP
Modem
Dial-up telephone line
TCP/IP connection using PPP
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
PPP
Point-to-Point Protocol
RFC 1662, 1663
Features
FramingLink Control Protocol (LCP)Network Control Protocol (NCP)
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
PPP
Overview of PPP
Byte oriented protocol
Byte stuffing for framing
Modem (client) makes a call to the modem of the serviceprovider
Connection established
LCP packets sent in PPP frames - negotiation for parameters(eg. data rate) to be used
Once a link is established, network layer parameters have tobe setup (NCP)
IP address - usually assigned by the service provider
Now the host has access to the Internet!
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
PPP
PPP Frame Format
Flag byte 01111110
Address (recall that it is not needed for DL layer) always setto 11111111
Control field - default value indicates no ACKs.
During LCP parties can negotiate a decide to drop addressand control bytes
Protocol - specifies LCP, NCP and network protocols like IP,IPX, AppleTalk etc.
Payload
Checksum - 2 or 4 bytes (negotiated during LCP)
Flag 01111110
Flag 01111110
Address 11111111
ProtocolControl 00000011
Payload Checksum
Bytes 1 1 1 or 21 Variable 2 or 4 1
Ramkumar PL
Services Provides By DL LayerFraming
Error ControlData Link Protocols
Internet DL Protocols
PPP
PPP Phases
NetworkDead
Terminate Open
Establish Authenticate
Carrier detected
Both sides agree on options
Authentication successful
NCP configuration
Carrier dropped
Failed
Failed
Done
Ramkumar PL