0% found this document useful (0 votes)
25 views94 pages

DLL Kent

Uploaded by

Ganapati Bisoyi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views94 pages

DLL Kent

Uploaded by

Ganapati Bisoyi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 94

Chapter 5: The 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

5: DataLink Layer 5-1


Link Layer: Introduction “link”
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

data-link layer has responsibility of


transferring datagram from one node
to adjacent node over a link
5: DataLink Layer 5-2
Link layer: context
 Datagram transferred transportation analogy
 trip from Princeton to
by different link Lausanne
protocols over different  limo: Princeton to JFK
links:  plane: JFK to Geneva
 e.g., Ethernet on first  train: Geneva to Lausanne
link, frame relay on  tourist = datagram
intermediate links,
802.11 on last link  transport segment =
 Each link protocol communication link
 transportation mode =
provides different
services link layer protocol
 travel agent = routing
 e.g., may or may not
provide rdt over link algorithm

5: DataLink Layer 5-3


Link Layer Services
 Framing, link access:
 encapsulate datagram into frame, adding header,
trailer
 channel access if shared medium
 “MAC” addresses used in frame headers to identify
source, dest
• different from IP address!
 Reliable delivery between adjacent nodes
 we learned how to do this already (chapter 3)!
 seldom used on low bit error link (fiber, some twisted
pair)
 wireless links: high error rates

• Q: why both link-level and end-end reliability?


5: DataLink Layer 5-4
Link Layer Services (more)
 Flow Control:
 pacing between adjacent sending and receiving nodes
 Error Detection:
 errors caused by signal attenuation, noise.
 receiver detects presence of errors:
• signals sender for retransmission or drops frame
 Error Correction:
 receiver identifies and corrects bit error(s) without
resorting to retransmission
 Half-duplex and full-duplex
 with half duplex, nodes at both ends of link can
transmit, but not at same time
5: DataLink Layer 5-5
Adapters Communicating
datagram
link layer protocol rcving
sending node
node
frame frame
adapter adapter

 link layer implemented  receiving side


in “adapter” (aka NIC)  looks for errors, rdt, flow

 Ethernet card, PCMCIA control, etc


card, 802.11 card  extracts datagram, passes

 sending side: to rcving node


 encapsulates datagram in
 adapter is semi-
a frame autonomous
 adds error checking bits,  implements link &
rdt, flow control, etc. physical layers
5: DataLink Layer 5-6
Error Detection
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

5: DataLink Layer 5-7


Parity Checking
Single Bit Parity: Two Dimensional Bit Parity:
Detect single bit Detect and correct single bit errors
errors

0 0

5: DataLink Layer 5-8


Internet checksum
Goal: detect “errors” (e.g., flipped bits) in transmitted
segment (note: used at transport layer only)

Sender: Receiver:
 compute checksum of
 treat segment contents
received segment
as sequence of 16-bit  check if computed checksum
integers equals checksum field value:
 checksum: addition (1’s  NO - error detected
complement sum) of  YES - no error detected.
segment contents But maybe errors
 sender puts checksum nonetheless? More later ….
value into the checksum
field

5: DataLink Layer 5-9


Checksumming: 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
 <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 (Ethernet, 802.11, ATM, HDLC)

5: DataLink Layer 5-10


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

D.2r
R = remainder[ ]
G

5: DataLink Layer 5-11


Multiple Access Links and Protocols
Two types of “links”:
 point-to-point
 PPP for dial-up access
 point-to-point link between Ethernet switch and host

 broadcast (shared wire or medium)


 traditional Ethernet
 upstream HFC (hybrid fiber-coax used in cable TV)
 802.11 wireless LAN

802.11)
5: DataLink Layer 5-12
Multiple Access protocols
 single shared broadcast channel
 two or more simultaneous transmissions by nodes:
interference
 collision if node receives two or more signals at the same
time
multiple access protocol
 distributed algorithm that determines how nodes
share channel, i.e., determine when node can
transmit
 communication about channel sharing must use
channel itself!
 no out-of-band channel for coordination

5: DataLink Layer 5-13


Ideal Mulitple Access Protocol
Broadcast channel of rate R bps
1. When one node wants to transmit, it can send
at rate R.
2. When M nodes want to transmit, each can
send at average rate R/M
3. Fully decentralized:
 no special node to coordinate transmissions
 no synchronization of clocks, slots
4. Simple

5: DataLink Layer 5-14


MAC Protocols: a taxonomy
Three broad classes:
 Channel Partitioning
 divide channel into smaller “pieces” (time slots,
frequency, code)
 allocate piece to node for exclusive use
 Random Access
 channel not divided, allow collisions
 “recover” from collisions

 “Taking turns”
 Nodes take turns, but nodes with more to send can
take longer turns

5: DataLink Layer 5-15


Channel Partitioning MAC protocols:
TDMA
TDMA: time division multiple access
 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 pkts, slots 2,5,6 idle

 TDM (Time Division Multiplexing): channel divided into N time slots,


one per user; inefficient with low duty cycle users and at light load.
 FDM (Frequency Division Multiplexing): frequency subdivided.

5: DataLink Layer 5-16


Channel Partitioning MAC protocols:
FDMA
FDMA: frequency division multiple access
 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 pkts, frequency bands 2,5,6 idle

time
frequency bands

 TDM (Time Division Multiplexing): channel divided into N time slots, one
per user; inefficient with low duty cycle users and at light load.
 FDM (Frequency Division Multiplexing): frequency subdivided.

5: DataLink Layer 5-17


Random Access Protocols
 When node has packet to send
 transmit at full channel data rate R.
 no a priori coordination among nodes

 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:
 slotted ALOHA
 ALOHA
 CSMA, CSMA/CD, CSMA/CA

5: DataLink Layer 5-18


Slotted ALOHA
Assumptions Operation
 all frames same size  when node obtains fresh
 time is divided into frame, it transmits in
equal size slots, time to next slot
transmit 1 frame  if no collision, node can
 nodes start to transmit send new frame in next
frames only at slot
beginning of slots  if collision, node
 nodes are synchronized
retransmits frame in
 if 2 or more nodes each subsequent slot
transmit in slot, all with prob. p until
nodes detect collision success
5: DataLink Layer 5-19
Slotted ALOHA

Pros Cons
 single active node can  collisions, wasting
continuously transmit slots
 idle slots
at full rate of channel
 highly decentralized:  nodes may be able to
detect collision in less
only slots in nodes
than time to transmit
need to be in sync packet
 simple  clock synchronization
5: DataLink Layer 5-20
Slotted Aloha efficiency
Efficiency is the long-run  For max efficiency
fraction of successful slots with N nodes, find p*
when there are many nodes, that maximizes
each with many frames to Np(1-p)N-1
send  For many nodes, take
 Suppose N nodes with many
limit of Np*(1-p*)N-1
frames to send, each
transmits in slot with as N goes to infinity,
probability p gives 1/e = .37
 prob that node 1 has success
in a slot = p(1-p)N-1
 prob that any node has a At best: channel
success = Np(1-p)N-1 used for useful
transmissions 37%
of time!

5: DataLink Layer 5-21


Pure (unslotted) ALOHA
 unslotted Aloha: simpler, no synchronization
 when frame first arrives
 transmit immediately
 collision probability increases:
 frame sent at t collides with other frames sent in [t -
0 0
1,t0+1]

5: DataLink Layer 5-22


Pure Aloha efficiency
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 . (1-p)2(N-1)

… choosing optimum p and then letting n  


Even worse !
= 1/(2e) = .18

5: DataLink Layer 5-23


CSMA (Carrier Sense Multiple
Access)
CSMA: listen before transmit:
If channel sensed idle: transmit entire frame
 If channel sensed busy, defer transmission

 Human analogy: don’t interrupt others!

5: DataLink Layer 5-24


CSMA collisions spatial layout of nodes

collisions can still


occur:
propagation delay means
two nodes may not hear
each other’s transmission
collision:
entire packet
transmission
time wasted
note:
role of distance & propagation
delay in determining collision
probability

5: DataLink Layer 5-25


CSMA/CD (Collision
Detection)
CSMA/CD: carrier sensing, deferral as in CSMA
 collisions detected within short time
 colliding transmissions aborted, reducing channel
wastage
 collision detection:
 easy in wired LANs: measure signal strengths,
compare transmitted, received signals
 difficult in wireless LANs: receiver shut off while
transmitting
 human analogy: the polite conversationalist

5: DataLink Layer 5-26


CSMA/CD collision detection

5: DataLink Layer 5-27


“Taking Turns” MAC
protocols
channel partitioning MAC protocols:
 share channel efficiently and fairly 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!
5: DataLink Layer 5-28
“Taking Turns” MAC
protocols
Polling: Token passing:
 master node  control token passed

“invites” slave from one node to next


nodes to transmit sequentially.
in turn  token message
 concerns:  concerns:
 polling overhead  token overhead
 latency  latency
 single point of  single point of failure
failure (master) (token)

5: DataLink Layer 5-29


Summary of MAC protocols
 What do you do with a shared media?
 Channel Partitioning, by time, frequency or
code
• Time Division, Frequency Division
 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
• CSMA/CA used in 802.11
 Taking Turns
• polling from a central site, token passing
5: DataLink Layer 5-30
MAC Addresses and ARP
 32-bit IP address:
 network-layer address
 used to get datagram to destination IP subnet

 MAC (or LAN or “physical” or


Ethernet) address:
 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
5: DataLink Layer 5-31
LAN Addresses and ARP
Each adapter on LAN has unique LAN address

1A-2F-BB-76-09-AD Broadcast address =


FF-FF-FF-FF-FF-FF

LAN
(wired or = adapter
wireless)
71-65-F7-2B-08-53
58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

5: DataLink Layer 5-32


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 allows easier portability
 can move LAN card from one LAN to another
 IP hierarchical address NOT portable
 depends on IP subnet to which node is attached

5: DataLink Layer 5-33


ARP: Address Resolution Protocol

Question: how to determine  Each IP node (Host,


MAC address of B Router) on LAN has
knowing B’s IP address? ARP table
 ARP Table: IP/MAC
237.196.7.78
address mappings for
1A-2F-BB-76-09-AD
some LAN nodes
237.196.7.23 < IP address; MAC address;
237.196.7.14
TTL>
LAN  TTL (Time To Live):
71-65-F7-2B-08-53 time after which
58-23-D7-FA-20-B0
address mapping will
be forgotten (typically
0C-C4-11-6F-E3-98 20 min)
237.196.7.88

5: DataLink Layer 5-34


ARP protocol: Same LAN
(network)
 A wants to send datagram
to B, and B’s MAC address  A caches (saves) IP-to-
not in A’s ARP table. MAC address pair in its
 A broadcasts ARP query ARP table until
packet, containing B's IP information becomes old
address (times out)
 Dest MAC address = FF-  soft state: information
FF-FF-FF-FF-FF that times out (goes
 all machines on LAN away) unless refreshed
receive ARP query  ARP is “plug-and-
 B receives ARP packet,
replies to A with its (B's)
play”:
MAC address  nodes create their ARP
 frame sent to A’s MAC tables without
address (unicast) intervention from net
administrator

5: DataLink Layer 5-35


Routing to another LAN
walkthrough: send datagram from A to B via R
assume A know’s B’s IP address

A
 Two ARP tables in router R, one for each IP network (LAN)

R
B
 In routing table at source Host, find router 111.111.111.110
 In ARP table at source, find MAC address E6-E9-00-17-BB-4B, etc

5: DataLink Layer 5-36


 A creates datagram with source A, destination B
 A uses ARP to get R’s MAC address for 111.111.111.110
 A creates link-layer frame with R's MAC address as dest,
frame contains A-to-B IP datagram
 A’s adapter sends frame
 R’s adapter receives frame
 R removes IP datagram from Ethernet frame, sees it’s
destined to B
 R uses ARP to get B’s MAC address
 R creates frame containing A-to-B IP datagram, sends to B

R
B

5: DataLink Layer 5-37


Ethernet
“dominant” wired LAN technology:
 cheap: $20 for 100Mbs!
 first widely used LAN technology
 Simpler, cheaper than token LANs and ATM
 Kept up with speed race: 10 Mbps – 10 Gbps

Metcalfe’s Ethernet
sketch

5: DataLink Layer 5-38


Star topology
 Bus topology popular through mid 90s
 Now star topology prevails
 Connection choices: hub or switch (more later)

hub or
switch

5: DataLink Layer 5-39


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

5: DataLink Layer 5-40


Ethernet Frame Structure
(more)
 Addresses: 6 bytes
 if adapter receives frame with matching destination
address, or with broadcast address (eg ARP packet),
it passes data in frame to net-layer protocol
 otherwise, adapter discards frame

 Type: 2 bytes, indicates the higher (network)


layer protocol (commonly IP, but may also be
ARP, Novell IPX and AppleTalk, etc.)
 CRC: 4 bytes, checked at receiver, if error is
detected, the frame is simply dropped

5: DataLink Layer 5-41


Unreliable, connectionless
service
 Connectionless: No handshaking between
sending and receiving adapter.
 Unreliable: receiving adapter doesn’t send
acks or nacks to sending adapter
 stream of datagrams passed to network layer can
have gaps
 gaps will be filled if app is using TCP
 otherwise, app will see the gaps

5: DataLink Layer 5-42


Ethernet uses CSMA/CD
 No slots  Before attempting a
 adapter doesn’t retransmission,
transmit if it senses adapter waits a
that some other random time, that is,
adapter is transmitting, random access
that is, carrier sense
 transmitting adapter
aborts when it senses
that another adapter is
transmitting, that is,
collision detection

5: DataLink Layer 5-43


Ethernet CSMA/CD algorithm
1. Adapter receives 4. If adapter detects another
datagram from net layer & transmission while
creates frame transmitting, aborts and
2. If adapter senses channel sends 48-bit jam signal
idle, it starts to transmit 5. After aborting, adapter
frame. If it senses channel enters exponential
busy, waits until channel backoff: after the mth
idle and then transmits collision, adapter chooses
3. If adapter transmits entire a K at random from
frame without detecting {0,1,2,…,2m-1}. Adapter
another transmission, the waits K·512 bit times and
adapter is done with frame returns to Step 2
!

5: DataLink Layer 5-44


Frame Size limitations for
Ethernet
For proper collision detection:  Minimum Frame size (F )
min
A’s frame should last at least For proper collision detection:
until B’s frame reaches A
Fmin = Min. frame size
A d B
R = Ethernet’s transmission rate,
e.g., 10 Mb/s
dmax = max. Ethernet segment
2d/S A’s frame length
time

S = Propagation speed (2x108


B’s frame m/s)
Fmin/R  2dmax/S
 Maximum Frame Size (Fmax)

For fairness among competing


A’s frame in yellow nodes
B’s frame in green Fmin=64 Bytes, Fmax=1500
Bytes
5: DataLink Layer 5-45
Ethernet’s CSMA/CD (more)
Jam Signal: make sure all Exponential Backoff:
other transmitters are  Goal: adapt retransmission
aware of collision; 48 bits attempts to estimated current
Random retransmission load
delay: K· 512 bit  heavy load: random wait will
transmission times where be longer
K is randomly selected;  first collision: choose K from
bit time is 0.1 microsec {0,1}; delay is K· 512 bit
for 10 Mbps and 0.01 transmission times
microsec for 100 Mbps  after second collision: choose
Ethernet K from {0,1,2,3}…
 after ten collisions, choose K
from {0,1,2,3,4,…,1023}
 for max value of K=1023:
See/interact with Java wait time is about 50 msec
applet on AWL Web site: for 10 Mbps, 5 msec for 100
Mbps Ethernet
highly recommended !
5: DataLink Layer 5-46
CSMA/CD efficiency
 tprop = max prop between 2 nodes in LAN
 ttrans = time to transmit max-size frame

 Efficiency goes to 1 as tprop goes to 0


 Goes to 1 as ttrans goes to infinity
 Much better than ALOHA, but still decentralized, simple, and cheap

1
efficiency 
1  5t prop / ttrans

5: DataLink Layer 5-47


10BaseT and 100BaseT
 10/100 Mbps rates
 T stands for Twisted Pair
 Base stands for Baseband (unmodulated)
 Nodes connect to a hub: “star topology”; 100
m max distance between nodes and hub

twisted pair

hub

5: DataLink Layer 5-48


Hubs
Hubs are essentially physical-layer repeaters:
 bits coming from one link go out all other links
 at the same rate
 no frame buffering
 no CSMA/CD at hub: adapters detect collisions
 provides net management functionality

twisted pair

hub

5: DataLink Layer 5-49


Gbit Ethernet
 uses 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 required for
efficiency
 Full-Duplex at 1 Gbps for point-to-point
links
 10 Gbps now !

5: DataLink Layer 5-50


Interconnecting with hubs
 Backbone hub interconnects LAN segments
 Extends max distance between nodes
 But individual segment collision domains become one large
collision domain
 Can’t interconnect 10BaseT & 100BaseT

hub

hub
hu hub
b

5: DataLink Layer 5-51


Switch
 Link layer device
 stores and forwards Ethernet frames
 examines frame header and selectively forwards
frame based on MAC dest address
 when frame is to be forwarded on segment, uses
CSMA/CD to access segment
 transparent
 hosts are unaware of presence of switches
 plug-and-play, self-learning
 switches do not need to be configured

5: DataLink Layer 5-52


Forwarding
switch
1
2 3

hub
hu hub
b

• How do determine onto which LAN segment to


forward frame?
• Looks like a routing problem...
5: DataLink Layer 5-53
Self learning
 A switch has a switch table
 entry in switch table:
 (MAC Address, Interface, Time Stamp)
 stale entries in table dropped (TTL can be 60
min)
 switch learns which hosts can be reached through
which interfaces
 when frame received, switch “learns” location
of sender: incoming LAN segment
 records sender/location pair in switch table

5: DataLink Layer 5-54


Filtering/Forwarding
When switch receives a frame:

index switch table using MAC dest address


if entry found for destination
then{
if dest on segment from which frame arrived
then drop the frame
else forward the frame on interface indicated
}
else flood

forward on all but the interface


on which the frame arrived

5: DataLink Layer 5-55


Switch example
Suppose C sends frame to D

switch address interface


1 A 1
2 3
B 1
E 2
hu hub hub G 3
A
b I
D F
B C G H
E

 Switch receives frame from from C


 notes in bridge table that C is on interface 1
 because D is not in table, switch forwards frame into
interfaces 2 and 3
 frame received by D
5: DataLink Layer 5-56
Switch example
Suppose C sends frame to D

switch address interface


1 A 1
2 3
B 1
E 2
hu hub hub G 3
A
b I C 1

D F
B C G H
E

 Switch receives frame from from C


 notes in bridge table that C is on interface 1
 because D is not in table, switch forwards frame into
interfaces 2 and 3
 frame received by D
5: DataLink Layer 5-57
Switch example
Suppose D replies back with frame to C.

address interface
switch
1 A 1
2 3
B 1
E 2
hu hub hub G 3
A
b I C 1

D F
B C G H
E

 Switch receives frame from from D


 notes in bridge table that D is on interface 2
 because C is in table, switch forwards frame only to
interface 1
 frame received by C
5: DataLink Layer 5-58
Switch example
Suppose D replies back with frame to C.

address interface
switch
1 A 1
2 3
B 1
E 2
hu hub hub G 3
A
b I C 1
D 2
D F
B C G H
E

 Switch receives frame from from D


 notes in bridge table that D is on interface 2
 because C is in table, switch forwards frame only to
interface 1
 frame received by C
5: DataLink Layer 5-59
Switch: traffic isolation
 switch installation breaks subnet into LAN
segments
 switch filters packets:
 same-LAN-segment frames not usually
forwarded onto other LAN segments
 segments become separate collision domains

switch

collision
domain

hub
hub hub

collision domain collision domain 5: DataLink Layer 5-60


Switches: dedicated access
 Switch with many A
interfaces
 Hosts have direct C’ B
connection to switch
 No collisions; full duplex
switch

Switching: A-to-A’ and B-to-


B’ simultaneously, no C
collisions
B’ A’
 combinations of
shared/dedicated,
10/100/1000 Mbps
interfaces possible
5: DataLink Layer 5-61
Institutional network

mail server
to external
network
router web server

switch
IP subnet

hub
hu hub
b

5: DataLink Layer 5-62


Switches vs. Routers
 both store-and-forward devices
 routers: network layer devices (examine network layer headers)
 switches are link layer devices

 routers maintain routing tables, implement routing


algorithms
 switches maintain switch tables, implement filtering,
learning algorithms

5: DataLink Layer 5-63


Summary comparison

hubs routers switches

traffi c no yes yes


isolation
plug & play yes no yes

optimal no yes no
routing

5: DataLink Layer 5-64


VLANs: motivation

What’s wrong with this picture? What happens if:


 CS user moves office to
EE, but wants connect to
CS switch?
 single broadcast domain:
 all layer-2 broadcast
traffic (ARP, DHCP)
crosses entire LAN
Computer
Computer (security/privacy,
Science Electrical
Engineering Engineering efficiency issues)
 each lowest level switch
has only few ports in use

5: DataLink Layer 5-65


VLANs Port-based VLAN: switch ports
grouped (by switch management
software) so that single physical
switch ……
1 7 9 15

Virtual Local 2 8 10 16

Area Network
… …
Switch(es)
supporting VLAN Electrical Engineering Computer Science
(VLAN ports 1-8) (VLAN ports 9-15)
capabilities can be
configured to define … operates as multiple virtual switches
multiple virtual
LANS over single 1 7 9 15
physical LAN 2 8 10 16

infrastructure.
… …

Electrical Engineering Computer Science


(VLAN ports 1-8) (VLAN ports 9-16)

5: DataLink Layer 5-66


Port-based VLAN
router
 traffic isolation: frames
to/from ports 1-8 can only
reach ports 1-8
 can also define VLAN based on
MAC addresses of endpoints,
rather than switch port 1 7 9 15

2 8 10 16

 dynamic membership:
… …
ports can be
dynamically assigned Electrical Engineering
(VLAN ports 1-8)
Computer Science
(VLAN ports 9-15)

 among VLANs
forwarding between VLANS:
done via routing (just as with
separate switches)
 in practice vendors sell combined
switches plus routers

5: DataLink Layer 5-67


VLANS spanning multiple
switches
1 7 9 15 1 3 5 7

2 8 10 16 2 4 6 8

… …

Electrical Engineering Computer Science Ports 2,3,5 belong to EE VLAN


(VLAN ports 1-8) (VLAN ports 9-15) Ports 4,6,7,8 belong to CS VLAN

 trunk port: carries frames between VLANS defined


over multiple physical switches
 frames forwarded within VLAN between switches can’t be
vanilla 802.1 frames (must carry VLAN ID info)
 802.1q protocol adds/removes additional header fields
for frames forwarded between trunk ports

5: DataLink Layer 5-68


802.1Q VLAN frame format
Type

802.1 frame

802.1Q frame

2-byte Tag Protocol Identifier Recomputed


(value: 81-00) CRC

Tag Control Information (12 bit VLAN ID field,


3 bit priority field like IP TOS)

5: DataLink Layer 5-69


Chapter 6: Wireless and Mobile Networks
Background:
 # wireless (mobile) phone subscribers now
exceeds # wired phone subscribers!
 computer nets: laptops, palmtops, PDAs,
Internet-enabled phone promise anytime
untethered Internet access
 two important (but different) challenges
 wireless: communication over wireless link
 mobility: handling the mobile user who changes
point of attachment to network

5: DataLink Layer 5-70


Elements of a wireless network

wireless hosts
 laptop, PDA, IP phone
 run applications
 may be stationary
(non-mobile) or
network mobile
infrastructure  wireless does not
always mean
mobility

5: DataLink Layer 5-71


Elements of a wireless network
base station
 typically connected to
wired network
 relay - responsible for
sending packets
between wired network
and wireless host(s) in
network its “area”
 e.g., cell towers,
infrastructure
802.11 access points

5: DataLink Layer 5-72


Elements of a wireless network
wireless link
 typically used to
connect mobile(s) to
base station
 also used as backbone
link
 multiple access protocol
network coordinates link access
infrastructure  various data rates,
transmission distance

5: DataLink Layer 5-73


Characteristics of selected wireless link
standards

200 802.11n

54 802.11a,g 802.11a,g point-to-point data


Data rate (Mbps)

5-11 802.11b 802.16 (WiMAX)

4 UMTS/WCDMA-HSPDA, CDMA2000-1xEVDO 3G cellular


enhanced
1 802.15

.384 UMTS/WCDMA, CDMA2000 3G

.056 IS-95, CDMA, GSM 2G

Indoor Outdoor Mid-range Long-range


10-30m 50-200m outdoor outdoor
200m – 4 Km 5Km – 20 Km

5: DataLink Layer 5-74


Elements of a wireless network
infrastructure mode
 base station
connects mobiles
into wired network
 handoff: mobile
changes base
network station providing
infrastructure connection into
wired network

5: DataLink Layer 5-75


Elements of a wireless network
ad hoc mode
 no base stations
 nodes can only
transmit to other nodes
within link coverage
 nodes organize
themselves into a
network: route among
themselves

5: DataLink Layer 5-76


Wireless network taxonomy
single hop multiple hops

host connects to host may have to


infrastructure base station (WiFi, relay through several
(e.g., APs) WiMAX, cellular) wireless nodes to
which connects to connect to larger
larger Internet Internet: mesh net

no base station, no
no
connection to larger
no base station, no
infrastructure Internet. May have to
connection to larger
relay to reach other
Internet (Bluetooth,
a given wireless node
ad hoc nets)
MANET, VANET

5: DataLink Layer 5-77


Wireless Link Characteristics (1)
Differences from wired link ….

 decreased signal strength: radio signal


attenuates as it propagates through matter
(path loss)
 interference from other sources:
standardized wireless network frequencies
(e.g., 2.4 GHz) shared by other devices
(e.g., phone); devices (motors) interfere as
well
 multipath propagation: radio signal reflects
off objects, arriving at destination at slightly
different times

…. make communication across (even a point to


point) wireless link much more “difficult”
5: DataLink Layer 5-78
Wireless Link Characteristics (2)
 SNR: signal-to-noise ratio 10-1

 larger SNR – easier to 10-2


extract signal from noise (a
“good thing”) 10-3

 SNR versus BER tradeoffs

BER
10-4
 given physical layer:
10-5
increase power -> increase
SNR->decrease BER 10-6
 given SNR: choose physical
layer that meets BER 10-7
10 20 30 40
requirement, giving highest SNR(dB)
thruput
• SNR may change with QAM256 (8 Mbps)
mobility: dynamically QAM16 (4 Mbps)
adapt physical layer
(modulation technique, BPSK (1 Mbps)
rate) 5: DataLink Layer 5-79
Wireless network characteristics
Multiple wireless senders and receivers create
additional problems (beyond multiple access):

A B C
C

A’s signal C’s signal


B strength strength
A

space
Hidden terminal problem
 B, A hear each other Signal attenuation:
 B, A hear each other
 B, C hear each other  B, C hear each other
 A, C can not hear each  A, C can not hear each other
other interfering at B

means A, C unaware of their


interference at B
5: DataLink Layer 5-80
IEEE 802.11 Wireless LAN
 802.11b  802.11a
 2.4-5 GHz unlicensed  5-6 GHz range

spectrum  up to 54 Mbps

 up to 11 Mbps  802.11g
 direct sequence spread  2.4-5 GHz range
spectrum (DSSS) in physical  up to 54 Mbps
layer
 802.11n: multiple
• all hosts use same
antennae
chipping code
 2.4-5 GHz range
 up to 200 Mbps

 all use CSMA/CA for multiple access


 all have base-station and ad-hoc network
versions
5: DataLink Layer 5-81
802.11 LAN architecture
 wireless host

Internet communicates with base


station
 base station = access
point (AP)
 Basic Service Set (BSS)
hub, switch (aka “cell”) in
or router
AP infrastructure mode
contains:
BSS  wireless hosts
1 AP  access point (AP): base
station
 ad hoc mode: hosts
only
BSS 2
5: DataLink Layer 5-82
802.11: Channels,
association
 802.11b: 2.4GHz-2.485GHz spectrum divided
into 11 channels at different frequencies
 AP admin chooses frequency for AP
 interference possible: channel can be same as
that chosen by neighboring AP!
 host: must associate with an AP
 scans channels, listening for beacon frames
containing AP’s name (SSID) and MAC address
 selects AP to associate with
 may perform authentication [Chapter 8]
 will typically run DHCP to get IP address in
AP’s subnet

5: DataLink Layer 5-83


802.11: passive/active
scanning
BBS 1 BBS 2 BBS 1 BBS 2

AP 1 AP 2 AP 1 1 AP 2
1 1 2 2
2 3
3 4

H1 H1

Passive Scanning: Active Scanning:


(1) beacon frames sent from APs (1) probe request frame broadcast
(2) association request frame sent: H1 from H1
to selected AP (2) probe response frame sent from
(3) association response frame sent: APs
H1 to selected AP (3) association request frame sent:
H1 to selected AP
(4) association response frame sent:
H1 to selected AP
5: DataLink Layer 5-84
IEEE 802.11: multiple access
 avoid collisions: 2+ nodes transmitting at same
time
 802.11: CSMA - sense before transmitting
 don’t collide with ongoing transmission by other node
 802.11: no collision detection!
 difficult to receive (sense collisions) when transmitting
due to weak received signals (fading)
 can’t sense all collisions in any case: hidden terminal,
fading
 goal: avoid collisions: CSMA/C(ollision)A(voidance)
A B C
C
A’s signal C’s signal
B strength strength
A
space
5: DataLink Layer 5-85
IEEE 802.11 MAC Protocol: CSMA/CA
802.11 sender
1 if sense channel idle for DIFS then sender receiver
transmit entire frame (no CD)
DIFS
2 if sense channel busy then
start random backoff time
timer counts down while channel idle data
transmit when timer expires
if no ACK, increase random backoff
SIFS
interval, repeat 2
ACK
802.11 receiver
- if frame received OK
return ACK after SIFS (ACK needed due
to hidden terminal problem)
5: DataLink Layer 5-86
Avoiding collisions (more)
idea: allow sender to “reserve” channel rather than random
access of data frames: avoid collisions of long data
frames
 sender first transmits small request-to-send (RTS) packets
to BS using CSMA
 RTSs may still collide with each other (but they’re
short)
 BS broadcasts clear-to-send CTS in response to RTS
 CTS heard by all nodes
 sender transmits data frame
 other stations defer transmissions
avoid data frame collisions completely
using small reservation packets!

5: DataLink Layer 5-87


Collision Avoidance: RTS-CTS
exchange
A B
AP

RTS(A) RTS(B)

reservation collision
RTS(A)

CTS(A) CTS(A)

DATA (A)
defer

time
ACK(A) ACK(A)

5: DataLink Layer 5-88


802.11 frame: addressing

2 2 6 6 6 2 6 0 - 2312 4
frame address address address seq address
duration payload CRC
control 1 2 3 control 4

Address 4: used only


in ad hoc mode
Address 1: MAC address
of wireless host or AP Address 3: MAC address
to receive this frame of router interface to
which AP is attached
Address 2: MAC address
of wireless host or AP
transmitting this frame

5: DataLink Layer 5-89


802.11 frame: addressing

Internet
H1 R1 router
AP

R1 MAC addr H1 MAC addr


dest. address source address

802.3 frame

AP MAC addr H1 MAC addr R1 MAC addr


address 1 address 2 address 3

802.11 frame
5: DataLink Layer 5-90
802.11 frame: more
frame seq #
duration of reserved
(for RDT)
transmission time (RTS/CTS)

2 2 6 6 6 2 6 0 - 2312 4
frame address address address seq address
duration payload CRC
control 1 2 3 control 4

2 2 4 1 1 1 1 1 1 1 1
Protocol To From More Power More
Type Subtype Retry WEP Rsvd
version AP AP frag mgt data

frame type
(RTS, CTS, ACK, data)

5: DataLink Layer 5-91


802.11: mobility within same
subnet
 H1 remains in same
router
IP subnet: IP
address can remain hub or
same switch

 switch: which AP is
BBS 1
associated with H1?
 self-learning
AP 1
(Ch. 5):
switch will see frame AP 2
from H1 and
“remember” which H1 BBS 2
switch port can be
used to reach H1

5: DataLink Layer 5-92


802.11: advanced capabilities
Rate Adaptation 10-1

 base station, mobile 10-2

10-3
dynamically change

BER
10-4
transmission rate 10-5

(physical layer 10-6

modulation 10-7
10 20 30 40
technique) as mobile SNR(dB)

moves, SNR varies 1. SNR decreases, BER


increase as node moves
QAM256 (8 Mbps) away from base station
QAM16 (4 Mbps)
BPSK (1 Mbps) 2. When BER becomes
operating point
too high, switch to lower
transmission rate but with
lower BER
5: DataLink Layer 5-93
802.11: advanced capabilities
Power Management
 node-to-AP: “I am going to sleep until next
beacon frame”
 AP knows not to transmit frames to this
node
 node wakes up before next beacon frame
 beacon frame: contains list of mobiles with
AP-to-mobile frames waiting to be sent
 node will stay awake if AP-to-mobile
frames to be sent; otherwise sleep again
until next beacon frame

5: DataLink Layer 5-94

You might also like