Download Link Layer

Document related concepts

Computer network wikipedia , lookup

Piggybacking (Internet access) wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

Peering wikipedia , lookup

CAN bus wikipedia , lookup

IEEE 1355 wikipedia , lookup

UniPro protocol stack wikipedia , lookup

Transcript
Introduction to Communication
Networks
Lectures 3-4
Data Link Layer
1
Introduction to Communication Networks 2/2006
Data Link Layer
Session
Transport
Network
Link
Physical
The 7-layer OSI Model
2
Introduction to Communication Networks 2/2006
TCP
TFTP
HTTP
NNTP
Presentation
Telnet
FTP
SMTP
Application
UDP
IP
LAN-LINK
The 4-layer Internet Model
The Data Link Layer
Our goals:

understand principles
behind data link layer
services:
–
–
–

3
error detection, correction
sharing a broadcast
channel: multiple access
link layer addressing
Overview:





instantiation and
implementation of various
link layer technologies
Introduction to Communication Networks 2/2006
link layer services
error detection, correction
multiple access protocols and
LANs
link layer addressing
specific link layer technologies:
–
Ethernet
Link Layer: setting the context
4
Introduction to Communication Networks 2/2006
Link Layer: setting the context

two physically connected devices:
–

host-router, router-router, host-host
unit of data: frame
application
Ht M transport
network
Hn Ht M
link
Hl Hn Ht M
physical
M
5
data link
protocol
phys. link
adapter card
Introduction to Communication Networks 2/2006
network
link
physical
Hl Hn Ht M
frame
Link Layer Services

Framing, link access:
–
–
–

Reliable delivery between two physically connected
devices:
–
–
6
encapsulate datagram into frame, adding header, trailer
implement channel access if shared medium,
‘physical addresses’ used in frame headers to identify
source, destination
 different from IP address!
seldom used on low bit error link (fiber, some twisted pair)
wireless links: high error rates
Introduction to Communication Networks 2/2006
Link Layer Services (more)

Flow Control:
– pacing between sender and receivers

Error Detection:
– errors caused by signal attenuation, noise.
– receiver detects presence of errors:


7
signals sender for retransmission or drops frame
Error Correction:
– receiver identifies and corrects bit error(s) without
resorting to retransmission
– Called also FEC (forward error correction)
Introduction to Communication Networks 2/2006
Link Layer: Implementation

implemented in “adapter”
–
–
e.g., PCMCIA card, Ethernet card
typically includes: RAM, DSP chips, host bus
interface, and link interface
application
Ht M transport
network
Hn Ht M
link
Hl Hn Ht M
physical
M
8
data link
protocol
phys. link
adapter card
Introduction to Communication Networks 2/2006
network
link
physical
Hl Hn Ht M
frame
Packet Motivation

Rather than send the data in a single block, it is broken up in a
sequence of frames
–
–
–
9
the buffer size of the receiver may be limited
the longer the transmission, the more likely there will be an error
(the entire frame should be retransmitted)
improves resource sharing (i.e. multiplexing)
Introduction to Communication Networks 2/2006
Methods to Identify Frames




10
Byte counts
Starting/ending bytes [byte stuffing]
Starting/ending flags [bit stuffing]
Using physical layer coding violations (i.e.,
invalid physical codes)
Introduction to Communication Networks 2/2006
Framing


11
Starting and ending special characters
(byte/character stuffing)
Starting and ending binary flags
(bit stuffing)
Introduction to Communication Networks 2/2006
Byte Stuffing


Also referred to as Character Stuffing
ASCII characters are used as framing delimiters (e.g.
DLE STX and DLE ETX)
–
–
–

Problem:
–

12
when these characters patterns occur within the
“transparent” text
Solution:
–

DLE – data link escape
STX – start of text
ETX – end of text
Sender stuffs an extra DLE into the data stream just before
each occurrence of an “accidental” DLE in the data stream
The receiver un-stuffs the extra DLE before
forwarding the data to the network layer.
Introduction to Communication Networks 2/2006
Byte Staffing
13
Introduction to Communication Networks 2/2006
Bit Stuffing


Each frame begins and ends with a special bit pattern
called a flag byte [01111110]
Problem:
–

Solution
–
–
14
The flag pattern may appear within the data
Whenever sender data link layer encounters five consecutive
ones in the data stream it automatically stuffs a 0 bit into the
outgoing stream.
Whenever receiver sees five consecutive ones it
automatically de-stuff the 0 bit before forwarding the data to
the network layer.
Introduction to Communication Networks 2/2006
Bit Stuffing
15
Introduction to Communication Networks 2/2006
Example – PPP protocol
16
Introduction to Communication Networks 2/2006
Errors

Data may be corrupted during transmission
Single bit error

Burst error

17
Introduction to Communication Networks 2/2006
Handling Errors

Frames include additional information
–
–
–
–
18
to detect or correct error
set by sender
checked by receiver
statistical guarantee (not absolute)
Introduction to Communication Networks 2/2006
Error Detection
EDC= Error Detection and Correction bits (redundancy)
D = Data protected by error checking, may include header fields
• Error detection not 100% reliable! Q: why?
• protocol may miss some errors, but rarely
• larger EDC field yields better detection and correction
19
Introduction to Communication Networks 2/2006
Error Detection

Parity Checking
–
–

Checksum
–
–
20
one additional bit per character
cannot handle error that changes two bits
treat data as a sequence of hexadecimal integers
handle multiple errors (but not all)
Introduction to Communication Networks 2/2006
Error Detection (cont.)

Cyclic Redundancy Check (CRC)
–
–
–
21
all odd number of errors are detected
all double errors
burst detecting capability of at least 16 bits (CRC16)
Introduction to Communication Networks 2/2006
Parity Check

22
A parity bit is added to every data unit so that the total
number of 1s is even (or odd for odd-parity).
Introduction to Communication Networks 2/2006
Parity Checking
Two Dimensional Bit Parity:
Detect and correct single bit errors
Single Bit Parity:
Detect single bit errors
0
23
Introduction to Communication Networks 2/2006
0
Checksum
The sender follows these steps:
 The unit is divided into k sections, each of n
bits.
 All sections are added using one’s
complement to get the sum.
 The sum is complemented and becomes the
checksum.
 The checksum is sent with the data.
24
Introduction to Communication Networks 2/2006
Checksum cont.
The receiver follows these steps:
 The unit is divided into k sections, each of n
bits.
 All sections are added using one’s
complement to get the sum.
 The sum is complemented.
 If the result is zero, the data are accepted:
otherwise, rejected.
25
Introduction to Communication Networks 2/2006
Checksum cont.
26
Introduction to Communication Networks 2/2006
Checksum Example
Suppose the following block of 16 bits is to be sent using a
checksum of 8 bits.
10101001 00111001
The numbers are added using one’s complement
10101001
00111001
-----------Sum
11100010
Checksum
00011101
The pattern sent is
10101001 00111001 00011101
27
Introduction to Communication Networks 2/2006
Checksum Example cont.
Now suppose the receiver receives the pattern sent and there
is no error.
10101001 00111001 00011101
When the receiver adds the three sections, it will get all 1s,
which, after complementing, is all 0s and shows that there is
no error.
10101001
00111001
00011101
Sum
11111111
Complement
00000000 means that the pattern is OK.
28
Introduction to Communication Networks 2/2006
Checksum Example cont.
Now suppose there is a burst error of length 5 that affects 4
bits.
10101111 11111001 00011101
When the receiver adds the three sections, it gets
10101111
11111001
00011101
Partial Sum
1 11000101
Carry
1
Sum
11000110
Complement
00111001 the pattern is corrupted.
29
Introduction to Communication Networks 2/2006
Checksum (cont.)

Advantages
–
–

Easy to compute
Size
Disadvantage
–
does not detect all common errors

30
example: second bit reverse in each data item
Introduction to Communication Networks 2/2006
Cyclic Redundancy Check (CRC)



Most popular error detection technique
Binary Data String of length K => Polynomial of
degree K, s(x)
Generating polynomial:
–
–
–
31
g(x) = x16 + x15 + x2 + 1
CRC-16
g(x) = x16 + x12 + x5 + 1
CRC-16 ITU
g(x) = x32 +x26 +x23 +x22 +x16 +x12 +x11 +x10 +x8 +x7 +x5 +x4
+x2 +x+1
CRC-32
Introduction to Communication Networks 2/2006
Cyclic Redundancy Check



view data bits, D, as a binary number
choose r+1 bit pattern (generator), G
goal: choose r CRC bits, R, such that
–
–
–

32
<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
widely used in practice (ATM, HDCL)
Introduction to Communication Networks 2/2006
Cyclic Redundancy Check
33
Introduction to Communication Networks 2/2006
CRC Example
Want:
D.2r XOR R = nG
equivalently:
D.2r = nG XOR R
equivalently:
if we divide D.2r by G,
want reminder R
R = remainder[
34
D.2r
G
]
Introduction to Communication Networks 2/2006
Hardware for CRC
35
Introduction to Communication Networks 2/2006
CRC-16 ITU Hardware Implementation



36
Registers initialized to zero
Bits of message shifted in
CRC found in registers
Introduction to Communication Networks 2/2006
Example of CRC-16 ITU computation


37
Input data is all 1 bits
Feedback introduces zeroes in CRC
Introduction to Communication Networks 2/2006
HDLC
(High-Level Data Link Control)


38
Serves as basis of
many popular data
link protocols
Defines the basic
frame structure and
basic procedures at
the data link level
Introduction to Communication Networks 2/2006
Multiple Access Links and Protocols
Three types of “links”:

point-to-point (single wire, e.g. PPP, SLIP)
broadcast (shared wire or medium; e.g, Ethernet,
Wavelan, etc.)

switched (e.g., switched Ethernet, ATM etc)

39
Introduction to Communication Networks 2/2006
Multiple Access protocols


single shared communication channel
two or more simultaneous transmissions by nodes:
interference
–

multiple access protocol:
–
–
–
40
only one node can send successfully at a time
distributed algorithm that determines how stations share channel,
i.e., determine when station can transmit
communication about channel sharing must use channel itself!
what to look for in multiple access protocols:
 synchronous or asynchronous
 information needed about other stations
 robustness (e.g., to channel errors)
 performance
Introduction to Communication Networks 2/2006
MAC Protocols: a taxonomy
Three broad classes:
 Channel Partitioning
–
–


divide channel into smaller “pieces” (time slots, frequency)
allocate piece to node for exclusive use
Random Access
– allow collisions
– “recover” from collisions
“Taking turns”
–
tightly coordinate shared access to avoid collisions
Goal: efficient, fair, simple, decentralized
41
Introduction to Communication Networks 2/2006
MAC Protocols: Goal




Channel Rate = R bps
Efficient:
– Single user: Throughput R
Fairness
– N users
– Min. user throughput R/N
Decentralized
–

42
Fault tolerance
Simple
Introduction to Communication Networks 2/2006
Channel Partitioning MAC protocols:
TDMA
TDMA: time division multiple access




43
access to channel in "rounds"
each station gets fixed length slot (length = pkt trans
time) in each round
unused slots go idle
example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6
idle
Introduction to Communication Networks 2/2006
Channel Partitioning MAC protocols:
FDMA
FDMA: frequency division multiple access



frequency bands

channel spectrum divided into frequency bands
each station assigned fixed frequency band
unused transmission time in frequency bands go idle
example: 6-station LAN, 1,3,4 have pkt, frequency bands
2,5,6 idle
44
Introduction to Communication Networks 2/2006
TDMA & FDMA: Performance




Channel Rate = R bps
Single user
– Throughput R/N
Fairness
– Each user gets the same allocation
– Depends on maximum number of users
Decentralized
–

45
Requires division
Simple
Introduction to Communication Networks 2/2006
Channel Partitioning (CDMA)
CDMA (Code Division Multiple Access)






46
unique “code” assigned to each user; ie, code set partitioning
used mostly in wireless broadcast channels (cellular, satellite,
etc)
all users share same frequency, but each user has own
“chipping” sequence (i.e., code) to encode data
encoded signal = (original data) X (chipping sequence)
decoding: inner-product of encoded signal and chipping
sequence
allows multiple users to “coexist” and transmit simultaneously
with minimal interference (if codes are “orthogonal”)
Introduction to Communication Networks 2/2006
CDMA - Basics

Orthonormal codes:
–
–

Encoding at user i:
–
–

Bit 1 send +ci
Bit 0 send -ci
Decoding (at user i):
–
–
–
–

<ci,cj> =0 i≠j
<ci,ci> =1
Receive a vector ri
Compute t=<ri,ci>
If t=1 THEN bit=1
If t=-1 THEN bit=0
Correctness of decoding
–
–
Single user
Multiple users



47
Assume additive channel.
R = c 1 – c2
Output <R,c1> = <c1,c1> + <-c2,c1> = 1 + 0 = 1
Introduction to Communication Networks 2/2006
CDMA Encode/Decode
48
Introduction to Communication Networks 2/2006
CDMA: two-sender interference
49
Introduction to Communication Networks 2/2006
Random Access protocols

When node has packet to send
–
–


two or more transmitting nodes -> “collision”,
random access MAC protocol specifies:
–
–

how to detect collisions
how to recover from collisions (e.g., via delayed
retransmissions)
Examples of random access MAC protocols:
–
–
–
50
transmit at full channel data rate R.
no a priori coordination among nodes
slotted ALOHA
ALOHA
CSMA and CSMA/CD
Introduction to Communication Networks 2/2006
Pure (unslotted) ALOHA


unslotted Aloha: simpler, no synchronization
pkt needs transmission:
–

collision probability increases:
–
51
send without awaiting for beginning of slot
pkt sent at t0 collide with other pkts sent in [t0-1, t0+1]
Introduction to Communication Networks 2/2006
Slotted Aloha



time is divided into equal size slots (= pkt trans. time)
node with new arriving pkt: transmit at beginning of next
slot
if collision: retransmit pkt in future slots with probability
p, until successful.
Success (S), Collision (C), Empty (E) slots
52
Introduction to Communication Networks 2/2006
Slotted Aloha efficiency
Q: what is max fraction slots successful?
A: Suppose N stations have packets to send
– each transmits in slot with probability p
– prob. successful transmission S is:
by single node:
S= p (1-p)(N-1)
by any of N nodes
S = Prob (only one transmits)
= N p (1-p)(N-1)
… choosing optimum p as N -> infty ...
= 1/e = .37 as N -> 
53
Introduction to Communication Networks 2/2006
At best: channel
use for useful
transmissions 37%
of time!
Pure Aloha (cont.)
P(success by given node) = P(node transmits) .
P(no other node transmits in [t0-1,t0] .
P(no other node transmits in [t0,t0+1]
= p . (1-p)N-1 . (1-p)N-1
P(success by any of N nodes) = N p . (1-p)N-1 . (1-p)N-1
… choosing optimum p as N -> infty ...
= 1/(2e) = .18
0.4
0.3
Slotted Aloha
0.2
0.1
Pure Aloha
0.5
54
1.0
1.5
2.0
G = offered load = Np
Introduction to Communication Networks 2/2006
protocol constrains
effective channel
throughput!
Aloha: Performance




Channel Rate = R bps
Single user
– Throughput R !
Fairness
– Multiple users
– Combined throughput only 0.37*R
Decentralized
–

55
Slotted needs slot synchronization
Simple
Introduction to Communication Networks 2/2006
CSMA: Carrier Sense Multiple Access)
CSMA: listen before transmit:
 If channel sensed idle: transmit entire pkt
 If channel sensed busy, defer transmission
– Persistent CSMA: retry immediately with probability p
when channel becomes idle (may cause instability)
– Non-persistent CSMA: retry after random interval
 human analogy: don’t interrupt others!
56
Introduction to Communication Networks 2/2006
CSMA collisions
spatial layout of nodes along ethernet
collisions can occur:
propagation delay means
two nodes may not yet
hear each other’s
transmission
collision:
entire packet transmission
time wasted
note:
role of distance and
propagation delay in
determining collision prob.
57
Introduction to Communication Networks 2/2006
CSMA/CD (Collision Detection)
CSMA/CD: carrier sensing, deferral as in CSMA
–
–
–

collision detection:
–
–
–

58
collisions detected within short time
colliding transmissions aborted, reducing channel
wastage
persistent or non-persistent retransmission
easy in wired LANs: measure signal strengths, compare
transmitted, received signals
difficult in wireless LANs: receiver shut off while transmitting
In practical networks there is a “jamming” period to ensure that
everybody received the collision.
human analogy: the polite conversationalist
Introduction to Communication Networks 2/2006
CSMA/CD collision detection
59
Introduction to Communication Networks 2/2006
CDMA/CD




Channel Rate = R bps
Single user
– Throughput R
Fairness
– Multiple users
– Depends on Detection Time
Decentralized
–

Simple
–
60
Completely
Needs collision detection hardware
Introduction to Communication Networks 2/2006
“Taking Turns” MAC protocols
channel partitioning MAC protocols:
– share channel efficiently at high load
– inefficient at low load: delay in channel access, 1/N
bandwidth allocated even if only 1 active node!
Random access MAC protocols
– efficient at low load: single node can fully utilize
channel
– high load: collision overhead
“taking turns” protocols
look for best of both worlds!
61
Introduction to Communication Networks 2/2006
“Taking Turns” MAC protocols
Token passing:
Polling:
 master node “invites”  control token passed from
one node to next sequentially.
slave nodes to
 token message
transmit in turn
 concerns:
 Request to Send,
– token overhead
Clear to Send msgs
– latency
 concerns:
–
–
–
62
polling overhead
latency
single point of failure
(master)
–
Introduction to Communication Networks 2/2006
single point of failure (token)
Reservation-based protocols
Distributed Polling:



time divided into slots
begins with N short reservation slots
– reservation slot time equal to channel end-end propagation
delay
– station with message to send posts reservation
– reservation seen by all stations
after reservation slots, message transmissions ordered by known
priority
63
Introduction to Communication Networks 2/2006
Summary of MAC protocols

What do you do with a shared media?
–
Channel Partitioning, by time, frequency or code

–
Random partitioning (dynamic),



–
ALOHA, S-ALOHA, CSMA, CSMA/CD
carrier sensing: easy in some technologies (wire), hard in
others (wireless)
CSMA/CD used in Ethernet
Taking Turns

64
Time Division,Code Division, Frequency Division
polling from a central cite, token passing
Introduction to Communication Networks 2/2006
Reliable Data Link Protocols

Sender:
–
–
–

Receiver
–
–

gets frames
sends acknowledgments
Assumptions
–
–
65
sends frames (messages)
gets acknowledgments
waits to acknowledge before deleting a frame
Physical, Data Link & Network Layer independent
Connection Oriented Service
Introduction to Communication Networks 2/2006
Reliable Data Link Protocols

Channel
–
–
–

noise
produce errors in the transmission
loss of messages, both: frames and ack
Typical cases
–
–
–
loss of frames: no ack
loss of ack
need of TIMER (induces frame duplication)
 Use ARQ (Automatic Repeat reQuest) protocols
66
Introduction to Communication Networks 2/2006
Stop & Wait performance
(clean channel)
t I - Time to transmit information frame
tout - Time out
tT - Cycle Time
tout should be twice then propogation + processing time
We assume that transmitter always has somthing to transmit
Transmitter will transmit after tout (every tT )
Efficiency: S 
tI 1

tT a
tI
tI
tout
tT
67
Introduction to Communication Networks 2/2006
t
Stop & Wait performance
(noisy channel)
p - Probability of an error in message or acknowledge
p[message sent once]  1  p
p[message sent twice]  p(1  p )
p[message sent k times]  p k 1 (1  p )
k 
kp
k 
k 1
(1  p ) 
1
: average number of tranmsissions
1 p
tT
: average time of succesfull transmission
1 p
t
t
(1  p )
Efficiency: S  I  I (1  p ) 
tv tT
a
tv  k  tT 
tI
tI
tout
tT
68
Introduction to Communication Networks 2/2006
t
Sliding Window Protocols

Need to improve the inefficient time usage of S&W
protocols

In each iteration several frames are sent
Frames from sender are numbered sequentially.
Limited by number of bits allocated in the header for
sequence numbers
A sliding window mechanism is used to track
acknowledgements
Go Back N



–

Selective Repeat
–
69
Receiver window is of size 1
Receiver window is of size > 1
Introduction to Communication Networks 2/2006
Go-Back-N
Sender Sliding Window




70
Frames to the left have been acknowledged and can be
purged
Outstanding frames are in the window
Frames to the right cannot be sent until the window slides
over them
Acknowledge of N means that all frames up to N have been
received
Introduction to Communication Networks 2/2006
Go-Back-N
Receiver Sliding Window
71
Introduction to Communication Networks 2/2006
Control Variables





72
SF – sequence number of first frame in the window
SL – sequence number of last frame in the window
S – sequence number of recently sent frame
R – sequence number of expected frame
Sender sets a timer for each frame set, receiver has no timers
Introduction to Communication Networks 2/2006
Go-Back-N Normal Operation
73
Introduction to Communication Networks 2/2006
Go-Back-N Lost Frame
74
Introduction to Communication Networks 2/2006
Go-Back-N - Summary

When retransmitting a frame, the protocol assumes
that all following frames were lost
–
–



Receiver receives frames in sequence
Acknowledging of a frame acknowledge all previous
frames: AckN = ACK1,…,ACKN-1
The protocol must work correctly even if frames
and/or ACKs are lost
–
–
75
Reduce the buffer requirements at the receiver
Easier “account keeping” at the transmitter.
Need to avoid scenarios of a system “freeze”
Receiver can send ACK of last received frame
Introduction to Communication Networks 2/2006
Go-Back-N - Summary



76
The sender will release frames only after
reception of an ACK on the frame.
The value of N defines the maximum number
of frames the sender can sent before
receiving an acknowledgement.
The time-out mechanism can be improved by
using also NACK in addition to ACK
Introduction to Communication Networks 2/2006
GBN performance
tI - Time to transmit information frame
tout - Time out
tT - Cycle Time
tout should be twice then propogation + processing time
We assume that transmitter always has something to transmit
Transmitter will transmit after tout (every tT )
Frame transmitted once require: t I
Frame transmitted twice (one failure) require: tT  t I
Frame transmitted k times require: ( k -1)tT  t I
Average time to transmit a frame: tv  E[( k -1)tT  t I ]  (k -1)tT  t I
77
Introduction to Communication Networks 2/2006
GBN performance – cont’
Average time to transmit a frame: tv  E[( k -1) tT  t I ]  (k -1)tT  t I
k is defined as in the S&W: k 
tv  (
1
1 p

1
a p 
-1)tT  t I  t I  1 

1 p
 1 p 
where a 
tT
tI
Efficiency : S 
tI
1 p

tv 1  p  a  p
Example: a  4, p  0.01
0.99
 0.25
4
0.99
Efficiency for GBN: S=
 0.96
0.99+4  0.01
Efficiency for S&W: S=
78
Introduction to Communication Networks 2/2006
Selective Repeat

receiver individually acknowledges all correctly
received frames
–

sender only resends frames for which ACK not
received
–

sender timer for each NACKed frame
sender window
–
–
79
buffers frames, as needed, for eventual in-order delivery to
upper layer
N consecutive seq #’s
again limits seq #s of sent, unACKed frames
Introduction to Communication Networks 2/2006
Selective Repeat
80
Introduction to Communication Networks 2/2006
Selective repeat: sender, receiver
windows
81
Introduction to Communication Networks 2/2006
Selective repeat
sender
data from above :

if next available seq # in
window, send pkt
timeout(n):

receiver
frame n in [rcvbase, rcvbase+N-1]



resend frame n, restart timer
ACK(n) in [sendbase,sendbase+N]:


mark frame n as received
if n smallest unACKed frame,
advance window base to
next unACKed seq #
frame n in [rcvbase-N,rcvbase-1]

Introduction to Communication Networks 2/2006
ACK(n)
otherwise:

82
send ACK(n)
out-of-order: buffer
in-order: deliver (also deliver
buffered, in-order pkts),
advance window to next notyet-received pkt
ignore
Selective Repeat Lost Frame
83
Introduction to Communication Networks 2/2006
Selective repeat in action
84
Introduction to Communication Networks 2/2006
Selective repeat: dilemma
Example:




seq #’s: 0, 1, 2, 3
window size=3
receiver sees no difference
in two scenarios!
Incorrectly
–
–
Passes duplicate data as
new in (a) or
Discards in (b)
Q: what relationship between
seq # size and window
size?
A: sequence # space >=
2*window
85
Introduction to Communication Networks 2/2006
Choosing the window size

Small window size:
–

Large window size:
–
–

Buffer space
Delay after loss
Ideal window size (assuming very low loss)
–
–
–
86
idle link (under-utilization).
RTT =Round trip time
C = link capacity
window size = RTT * C
Introduction to Communication Networks 2/2006
Case Study - LAN technologies
Data link layer so far:
–
services, error detection/correction, multiple
access
Next: LAN technologies
–
–
–
–
–
–
87
addressing
Ethernet
hubs, bridges, switches
802.11
PPP
ATM
Introduction to Communication Networks 2/2006
LAN Addresses
32-bit IP address:


network-layer address
used to get datagram to destination network
LAN (or MAC or physical) address:


88
used to get datagram from one interface to another
physically-connected interface (same network)
48 bit MAC address (for most LANs)
burned in the adapter ROM
Introduction to Communication Networks 2/2006
LAN Addresses
Each adapter on LAN has unique LAN address
89
Introduction to Communication Networks 2/2006
LAN Address (more)




MAC address allocation administered by IEEE
manufacturer buys portion of MAC address space (to
assure uniqueness)
Analogy:
(a) MAC address: like Social Security Number
(b) IP address: like postal address
MAC flat address => portability
–

IP hierarchical address NOT portable
–

90
can move LAN card from one LAN to another
depends on network to which one attaches
ARP protocol translates IP address to MAC address
Introduction to Communication Networks 2/2006
Ethernet
“dominant” LAN technology:
 cheap $20 for 100Mbs!
 first widely used LAN technology
 Simpler, cheaper than token LANs and ATM
 Kept up with speed race: 10, 100, 1000 Mbps
Metcalfe’s Etheret
sketch
91
Introduction to Communication Networks 2/2006
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble:
 7 bytes with pattern 10101010 followed by one byte
with pattern 10101011
 used to synchronize receiver, sender clock rates
92
Introduction to Communication Networks 2/2006
Ethernet Frame Structure



93
Addresses: 6 bytes, frame is received by all adapters
on a LAN and dropped if address does not match
Type: indicates the higher layer protocol, mostly IP but
others may be supported such as Novell IPX and
AppleTalk)
CRC: checked at receiver, if error is detected, the
frame is simply dropped
Introduction to Communication Networks 2/2006
Ethernet: uses CSMA/CD
A: sense channel, if idle
then {
transmit and monitor the channel;
If detect another transmission
then {
abort and send jam signal;
update # collisions;
delay as required by exponential backoff algorithm;
goto A
}
else {done with the frame; set collisions to zero}
}
else {wait until ongoing transmission is over and goto A}
94
Introduction to Communication Networks 2/2006
Ethernet’s CSMA/CD (more)
Jam Signal: make sure all other transmitters are aware
of collision; 48 bits;
Exponential Backoff:
 Goal: adapt retransmission attempts to estimated
current load
–



95
heavy load: random wait will be longer
first collision: choose K from {0,1}; delay is K x 512 bit
transmission times
after n-th collision: choose K from {0,1,…, 2n-1}
after ten or more collisions, choose K from
{0,1,2,3,4,…,1023}
Introduction to Communication Networks 2/2006
Ethernet Technologies: 10Base2




96
10: 10Mbps; 2: under 200 meters max cable length
thin coaxial cable in a bus topology
repeaters used to connect up to multiple segments
repeater repeats bits it hears on one interface to its
other interfaces: physical layer device only!
Introduction to Communication Networks 2/2006
10BaseT and 100BaseT




97
10/100 Mbps rate; latter called “fast ethernet”
T stands for Twisted Pair
Hub to which nodes are connected by twisted pair,
thus “star topology”
CSMA/CD implemented at hub
Introduction to Communication Networks 2/2006
10BaseT and 100BaseT



98
Max distance from node to Hub is 100 meters
Hub can disconnect “jabbering” adapter
Hub can gather monitoring information, statistics for
display to LAN administrators
Introduction to Communication Networks 2/2006
Gbit Ethernet





99
use standard Ethernet frame format
allows for point-to-point links and shared broadcast
channels
in shared mode, CSMA/CD is used; short distances
between nodes to be efficient
uses hubs, called here “Buffered Distributors”
Full-Duplex at 1 Gbps for point-to-point links
Introduction to Communication Networks 2/2006
IEEE 802.11 Wireless LAN




102
wireless LANs: untethered (often mobile) networking
IEEE 802.11 standard:
– MAC protocol
– unlicensed frequency spectrum: 900Mhz, 2.4Ghz
Basic Service Set (BSS)
(a.k.a. “cell”) contains:
– wireless hosts
– access point (AP):
base station
BSS’s combined to form
distribution system (DS)
Introduction to Communication Networks 2/2006
Ad Hoc Networks



103
Ad hoc network: IEEE 802.11 stations can
dynamically form network without AP
Applications:
– “laptop” meeting in conference room, car
– interconnection of “personal” devices
– battlefield
IETF MANET
(Mobile Ad hoc Networks)
working group
Introduction to Communication Networks 2/2006
IEEE 802.11 MAC Protocol: CSMA/CA
802.11 CSMA: sender
- if sense channel idle for
DISF sec.
then transmit entire frame
(no collision detection)
-if sense channel busy
then binary backoff
802.11 CSMA receiver:
if received OK
return ACK after SIFS
104
Introduction to Communication Networks 2/2006
IEEE 802.11 MAC Protocol
802.11 CSMA Protocol:
others
 NAV: Network
Allocation
Vector
 802.11 frame has
transmission time field
 others (hearing data)
defer access for NAV
time units
105
Introduction to Communication Networks 2/2006
Hidden Terminal effect



106
hidden terminals: A, C cannot hear each other
– obstacles, signal attenuation
– collisions at B
goal: avoid collisions at B
CSMA/CA: CSMA with Collision Avoidance
Introduction to Communication Networks 2/2006
Collision Avoidance: RTS-CTS
exchange



107
CSMA/CA: explicit
channel reservation
– sender: send short
RTS: request to send
– receiver: reply with
short CTS: clear to
send
CTS reserves channel for
sender, notifying
(possibly hidden) stations
avoid hidden station
collisions
Introduction to Communication Networks 2/2006
Collision Avoidance: RTS-CTS
exchange


108
RTS and CTS short:
– collisions less likely, of
shorter duration
– end result similar to
collision detection
IEEE 802.11 allows:
– CSMA
– CSMA/CA: reservations
– polling from AP
Introduction to Communication Networks 2/2006
Questions
109
Introduction to Communication Networks 2/2006
Question 1
In a Stop-and-Wait ARQ system, the
bandwidth of the line is 1 Mbps, and 1 bit
takes 20 ms to make a round trip. What is the
bandwidth-delay product? If the system data
frames are 1000 bits in length, what is the
utilization percentage of the link?
110
Introduction to Communication Networks 2/2006
Answer
The bandwidth-delay product is
1  106  20  10-3 = 20,000 bits
The system can send 20,000 bits during the time it takes for the
data to go from the sender to the receiver and then back again.
However, the system sends only 1000 bits. We can say that the link
utilization is only 1000/20,000, or 5%. For this reason, for a link with
high bandwidth or long delay, use of Stop-and-Wait ARQ wastes the
capacity of the link.
111
Introduction to Communication Networks 2/2006
Question 2
What is the utilization percentage of the link
in Question 1 if the link uses Go-Back-N ARQ
with a 15-frame sequence?
112
Introduction to Communication Networks 2/2006
Answer
The bandwidth-delay product is still 20,000. The
system can send up to 15 frames or 15,000 bits
during a round trip. This means the utilization is
15,000/20,000, or 75 percent. Of course, if there
are damaged frames, the utilization percentage
is much less because frames have to be resent.
113
Introduction to Communication Networks 2/2006