Mod 2 Link F24
Mod 2 Link F24
Module 2
Link Concepts and (W)LAN Technologies
Chenren Xu(许辰人)
Fall 2024
Includes material from lectures by David Wetherall (UW) and Jim Kurose (UMASS);
Jointly prepared with Bo Liang. 1
Link Layer Overview
• Scope of the Link Layer • Logic Link Control (LLC)
- Concerns how to transfer messages over one or - Provide interfaces for higher layers
more connected links - Error control and flow control
▪ Messages are frames, of limited sizes • Media Access Control (MAC)
▪ Builds on the physical layer - Encapsulate data into frames when transmitting
- Acquire data from frames received
- Control the access on media
Network
• Protocol standards on Layer 2
- 802.3 (Ethernet), 802.11 (e.g., WLAN), …
Link
Virtual data path
Application
Actual data path
Physical Transport
Network
LLC
Frame Link
MAC
Physical
2
Implementation
• Every host, access point, switch and router
• Implemented in “adaptor” or network interface card (NIC) or on a chip
- Ethernet card, 802.11 card
- Implements link and physical layers
• Attaches to host system buses
• Combination of hardware, software, firmware
- Firmware: a specific class of computer software that provides
the low-level control for the device’s specific hardware
• High MAC & Low MAC
- Not a standard, but helps to understand MAC layer
- Low MAC: Low latency is important
▪ Implemented in hardware like NIC (lower)
▪ SIFS, DIFS, ACK, CRC
- High MAC: A little bit long latency is acceptable
▪ Implemented in software like MAC layer driver in Linux (higher) Architecture of Linux 802.11
▪ Retransmission, Beacon
• Recommended reading
- “Linux Kernel Networking Implementation and Theory” by Rami Rosen 3
Topics
• Framing – How to turn raw bits into information units?
- Delimiting start/end of frames
• Error Control
- Error detection and correction, retransmission
• Multiple Access
- MAC and CSMA
• (W)LAN
- 802.11, modern Ethernet, switching and examples
4
Framing Methods Um?
- Replace (“stuff”) the flag inside the frame with an escape code
- Any unescaped FLAG is the start/end of a frame
5
Practical Framing
• Bit Stuffing
- Like Byte Stuffing, but at bit level
- Less overhead
- A well-defined bit pattern is called a preamble at the beginning of the frame
• Typical structure of a “wired” packet:
- Preamble: synchronize clocks between sender and receiver (framing)
- Header: addresses, type field, length, etc.
- The data to be send, e.g., an IP packet
- Trailer: padding, CRC, ..
Dst. Src.
Preamble Type Length Data CRC
Address Address
6
Practical Framing
• 802.11 Long Preamble: 144 bits • How does wireless differ?
- Interoperable with and only needed for some older 802.11 - Different rates for different parts of packet
devices and in networks with high interference or low SNR - Explicit multi-hop support
- Entire Preamble and 48 bit PLCP Header sent at 1 Mbps - Control information for physical layer
• 802.11 Short Preamble: 72 bits - Ensure robustness of the header
Tx at 1 Mbps Tx at X Mbps
128-bit
16-bit Start Frame Signal Speed Service Length of 16-bit Data
Preamble
Delimiter 1,2,5.5,11 Mbps (unused) Payload CRC 0-2312 bytes
56-bit
Tx at 1 Mbps Tx at 2 Mbps Tx at X Mbps
7
Topics
• Framing
- Delimiting start/end of frames
• Error Control – what can network do if link error and loss?
- Error control and correction, retransmission
• Multiple Access
- MAC and CSMA
• (W)LAN
- 802.11, modern Ethernet, switching and examples
8
Error Control/Handing
• Some bits will be received in error due to noise. What can we do?
- Detect errors with codes
- Correct errors with codes
- Retransmit lost frames
• Reliability is a concern that cuts across the layers
- Link layer?
- Network layer?
- Transport layer?
- Application layer?
9
Motivating Example
• Problem – Noise may flip received bits
• Approach – Add redundancy
- Error detection codes
▪ Add check bits to the message bits to let some
errors be detected
- Error correction codes
▪ Add more check bits to let some errors be
corrected
- Key issue is to structure the code to detect
many errors with few check bits and modest
computation
10
Using Error Codes
• Codeword consists of D data plus R Data bits Check bits
check bits D R=fn(D)
- Code rate = D / (D + R)
• Sender: • Intuition for Error Codes
- Compute R check bits based on the D data - For D data bits, R check bits:
• Receiver:
Correct codewords
- Receive D+R bits with unknown errors
- Recompute R check bits based on the D data - Randomly chosen codeword is unlikely
bits; error if R doesn’t match R’ to be correct (1/2R); overhead is low
11
R.W. Hamming (1915-1998)
• Much early work on codes:
- “Error Detecting and Error Correcting Codes”, BSTJ, 1950
• See also:
- “You and Your Research”, 1986
• Founder of ACM, ACM Turing Prize, member of NAE
• Distance in the context of coding
- Distance is the number of bit flips needed to change (D+R)1 to (D+R)2
- Hamming distance of a code
▪ The minimum distance between any pair of codewords
- Error detection: Source: IEEE GHN, © 2009 IEEE
12
Error Detection
• Some bits may be received in error due to noise. How do we detect this?
- Parity
▪ Is little used
- Checksums
▪ Used in Internet: IP, TCP, UDP, … but it is weak
- CRCs
▪ Widely used on links: Ethernet, 802.11, ADSL, Cable, …
• Detection will let us fix the error, for example, by retransmission (later)
13
Error Detection – Parity Bit
• Take D data bits, add 1 check bit that is the sum of the D bits
- Sum is modulo 2 or XOR
- Example: 1001100 → 1
• How well does parity work?
- At least 2 bits flip, the checksum would not show the error
- Or we can say, the distance of valid Parity Bit codeword is 2
- How many errors will it detect/correct? 1/0
• What about larger errors?
- Odd # of errors
14
Error Detection – Checksums
• Idea: sum up data in N-bit words
1500 bytes 16 bits
- Widely used in, e.g., TCP/IP/UDP
- Stronger protection than parity “The checksum field is the 16 bit one’s complement of
the one’s complement sum of all 16 bit words …”
• Internet Checksum – RFC 791
- Sum is defined in 1s complement arithmetic (must
add back carries) – and it’s the negative sum
- Receiving
- Sending 0001 0001
f203 1. Arrange data in 16-bit words f203
1. Arrange data in 16-bit words f4f5 f4f5
f6f7 2. Checksum will be non-zero, add f6f7
+(0000) + 220d
2. Put zero in checksum position, add ------ 3. Add any carryover back to get 16 bits ------
2ddf0 2fffd
3. Add any carryover back to get 16 bits 4. Negate the result and check it is 0
fffd
4. Negate (complement) to get sum ddf0 + 2
+ 2 ------
------ ffff
- How well does the checksum work? ddf2
0000
▪ What is the distance of the code? 2
220d
▪ How many errors will it detect/correct? 1/0
▪ What about larger errors? All burst error up to 16
▪ Crash under many conditions, like add many zeros
15
Error Detection – Cyclic Redundancy Check (CRC)
• Even stronger protection • Send Procedure:
- Given n data bits, generate k check - Extend the n data bits with k zeros
Data bits:
bits such that the n+k bits are evenly - Divide by the generator value C 11010111
11
divisible by a generator C - Keep remainder, ignore quotient
- Adjust k check bits by remainder
• The catch: Check bits:
• Receive Procedure: C(x)=x4+x1+1
- It’s based on mathematics of finite C = 10011
- Divide and check for zero remainder k =4
fields, in which “numbers” represent
polynomials
• Protection depend on generator
- Standard CRC-32 is 10000010 01100000 10001110
- E.g., 10011010 is x7 + x4 + x3 + x1
110110111
• What this means: • Properties:
- We work with binary values and
- Hamming distance = 4, detects up to triple bit errors
operate using modulo 2 arithmetic - Also odd number of errors
- And bursts of up to k bits in error
- Not vulnerable to systematic errors like checksums
- Can be easily implemented on the shift register
16
Why Error Correction is Hard
• If we had reliable check bits we could use them to narrow down the position of the error
- Then correction would be easy
• But error could be in the check bits as well as the data bits!
- Data might even be correct
• Intuitions for error correction code
- Suppose we construct a code with a Hamming distance of at least 3
▪ Need ≥3 bit errors to change one valid codeword into another
▪ Single bit errors will be closest to a unique valid codeword
- If we assume errors are only 1 bit, we can correct them by mapping an error to the closest valid codeword
▪ Works for d errors if HD ≥ 2d + 1
- Visualization of code
Valid codeword
Single bit error from A A
17
Hamming Code
• Gives a method for constructing a code with • To decode:
n = 4 bits data, k bits check bits - Recompute check bits
▪ With parity sum including the check bit
- We want to know which bit is wrong
- Arrange as a binary number
- 2k – 1 (# of the error types it can represent) =
- Value (syndrome) tells error position
n + k (# of error positions) ▪ Value of zero means no error
- Put check bits in positions p that are powers of ▪ Otherwise, flip bit to correct
2, starting with position 1
Code construction No Error Error Correction
- Check bit in position p is parity of positions with 0 1 0 0 1 0 1 0 1 0 0 1 0 1 0 1 0 0 1 1 1
a p term in their values p1= 0+1+1 = 0, p1= 0+0+1+1 = 0 p1= 0+0+1+1 = 0
• Example: data = 0101, 3 check bits p2= 0+0+1 = 1, p2= 1+0+0+1 = 0 p2= 1+0+1+1 = 1,
p4= 1+0+1 = 0 p4= 0+1+0+1 = 0 p4= 0+1+1+1 = 1
- 7 bit code, check bit positions 1, 2, 4
Syndrome = 000, Syndrome = 110,
- Check 1 covers positions 1, 3, 5, 7 no error flip position 6
- Check 2 covers positions 2, 3, 6, 7 Data = 0 1 0 1 Data = 0 1 0 1
19
Coding in the State of Art
• Heavily used in physical layer
- LDPC is now (and the future), e.g., data channel in 5G
▪ 技术与国家 – 5G eMBB编码投票战始末
➢ https://zhuanlan.zhihu.com/p/37060223
- Convolutional codes widely used in practice
• Error detection (w/retransmission) is used in the link layer and above for residual errors
• Correction also used in the application layer
- Called Forward Error Correction (FEC)
▪ Normally with an erasure error model
▪ E.g., Reed-Solomon (CDs, DVDs, etc.)
• Coding gain
- The reduction in the required Eb/N0 to achieve a specified BER of an error-correcting coded system
20
Detection vs. Correction
• Which is better will depend on the pattern of errors
- For example: 1000-bit messages with a bit error rate (BER) of 1 in 10000 or 10-4, i.e., 10% has
one bit error in message
• Which has less overhead?
- It still depends! We need to know more about the errors
Error correction Error detection
Need ~1 check bits per message plus 1000
Bit errors are random – messages Need ~10 check bits per message
bit retransmission 1/10 of the time
have 0 or maybe 1 error Overhead: 10
Overhead: 1 + 1000 × 0.1 = 101
Errors come in bursts of 100 – Need >> 100 check bits per Need 32 check bits per message plus 1000
only 1 or 2 messages in 1000 have message bit retransmission 2/1000 of the time
errors Overhead: >> 100 Overhead: 32 + 1000 × 0.002 = 34
More efficient when errors are not expected,
Needed when errors are expected,
In general and when errors are large when they do
or when no time for retransmission
occur
21
Context on Reliability
• Where in the stack should we place reliability functions?
• Everywhere! It is a key issue
- Different layers contribute differently
Recover actions
Application
(correctness)
Transport
Network
Link
Mask errors
Physical (performance optimization)
22
Automatic Repeat reQuest (ARQ)
• ARQ often used when errors are common or must be corrected
- E.g., WiFi, and TCP (later)
• Rules at sender and receiver:
- Receiver automatically acknowledges correct frames with an ACK
- Sender automatically resends after a timeout, until an ACK is received
• Normal operation (no loss) • Loss and retransmission
Sender Receiver Sender Receiver
Frame Frame
X
Timeout Time Timeout Time
ACK
Frame
Timeout
ACK
23
So What’s Tricky About ARQ?
• Two non-trivial issues: • Duplication
- How long to set the timeout? - What happens if an ACK is lost?
Sender Receiver
- How to avoid accepting duplicate frames
Frame
as new frames
Timeout
• Want performance in the common case X ACK
Frame
and correctness always New
Frame??
• Timeout ACK
25
Limitation of Stop-and-Wait
• It allows only a single frame to be outstanding from the sender – one packet at a time:
- Good for LAN, not efficient for high BD
• Example: R = 1 Mbps, D = 50 ms
- How many frames/sec? If R = 10 Mbps?
• Sliding Window – Generalization of stop-and-wait
- Allows W frames to be outstanding
- Can send W frames per RTT (= 2D)
- Various options for numbering frames/ACKs and handling loss
▪ Will look at along with TCP
• In the end, why do we need reliable transmission on both link and e2e level?
26
Topics
• Framing
- Delimiting start/end of frames
• Error Control
- Error control and correction, retransmission
• Multiple Access – How to coordinate network access over a broadcast medium?
- MAC and CSMA
• (W)LAN
- 802.11, modern Ethernet, switching and examples
27
Multiplexing Network Traffic Allows Multiple Access
• Review: TDM and FDM Rate TDM
- In TDM a user sends at a high rate a fraction of the time;
in FDM, a user sends at a low rate all the time Time
FDM
- Statically divide a resource
▪ Suited for continuous traffic, fixed number of users
Rate Two users, each need R
- Widely used in telecommunications R
▪ TV/radio stations use FDM
▪ Earlier cellular allocates calls use TDM within FDM Time
Rate
R
• Network traffic is bursty
- Load varies greatly over time
Time
- Inefficient to always allocate user their ON needs with TDM/FDM Rate
Together they need R’ < 2R
• Multiple access schemes R’<2R
- Multiplex users based on demands – for gains of statistical multiplexing
- But communication about channel sharing must use channel itself! Time
28
Centralized versus Decentralized Multiple Access
• Who gets to send a packet next?
• Scheduled multiple access Ho hum
Busy! Zzzz.
- Explicit coordination ensures that only one node transmits
- Looks cleaner, more organized, but …
▪ Coordination introduces overhead – require communication
▪ Not efficient for real traffic – bursty and opportunistic
• Assume no-one is in charge
- How do nodes share a single link? Who sends when, collision and its detection
• We will look at two kinds of multiple/media/medium access (MAC) protocols
- Randomized: nodes randomize their resource access attempts, e.g., (slotted) ALOHA, CSMA/(CD/CA)
▪ Good for low load situations
- Contention-free: nodes order their resource access attempts
▪ Good for high load or guaranteed quality of service situations
29
ALOHA Network and ALOHA Protocol
• Seminal computer network connecting the Hawaiian islands in the late 1960s
- When should nodes send? A new protocol was devised by Norm Abramson …
• Simple idea
- All frames have the same length with time T
- Node just sends when it has traffic
- Population of stations attempt to transmit within period T follows Poisson distribution
- G be the average # of stations that begin transmission within period T, called traffic load
- If there was a collision (no ACK received) then wait a random time and resend
30
ALOHA Analysis: From Unslotted to Slotted
𝐺𝑥 𝑒 −𝐺
• Probability that exactly 𝑥 stations begin transmission during T: 𝑃 𝑋 = 𝑥 =
𝑥!
• S (Throughput) = G (Traffic load) × P0 (Success Probability)
• P (No other users send packets in this frame time) = P (x = 0) = e -G
• (Unslotted) ALOHA
- Success: no other packets in two-frame time
- S = G × e-2G, when G = 0.5, the maximum S = 1/2e (18% efficiency)
• Slotted ALOHA:
- Transmission can only start at the beginning of each slot of period T
- Success: no other packets in one frame time (including holding and waiting)
- S = G × e-G, when G = 1, the maximum S = 1/e (up to 37%)
- When traffic load is low, more idle slots, less collision slots
- When traffic load is high, more collision slots with exponential rising
- Pk (retransmit k times) = e-G(1 – e-G)k-1
k−1
- E (retransmission time) = σ kPk = σ ke−G 1 − e−G = eG
• Simple, decentralized protocol that works well under low load!
- But not efficient under high load
- Slotted ALOHA is better 31
Classic Ethernet
• ALOHA inspired Bob Metcalfe to invent Ethernet
for LANs in 1973
- Nodes share 10 Mbps coaxial cable
- Hugely popular in 1980s, 1990s
32
Carrier Sense Multiple Access (CSMA)
• Improve ALOHA by carrier sensing: make sure the channel is idle before we send
- If channel sensed idle, transmit entire frame
X
- If channel sensed busy, defer transmission
- Can do easily with wires, not wireless
• Collision can still occur
- Still possible to listen and hear nothing when another node is sending because of delay
- Entire packet transmission time wasted
▪ Distance and propagation delay play role in determining collision probability
• Carrier sensing can be either physical or virtual
33
CSMA/CD (with Collision Detection)
• Collisions are detected by listening on the medium and comparing Jam! XXXXXXXX Jam!
37
Turn-Taking Multiple Access – Token Ring as an Example
• Define an order in which nodes get a chance to send
- Or pass, if no traffic at present
• Arrange nodes in a ring; token rotates “permission to send” to each node in turn
• Advantage
- Fixed overhead with no collisions
▪ More efficient under load Node Token
- Regular chance to send with no unlucky nodes
- Predictable service, easily extended to guaranteed quality of service
• Disadvantage
- More things that can go wrong than random access protocols!
▪ E.g., what if the token is lost? Direction of
transmission
- Higher overhead and latency at low load
- Unfriendly to mobility
38
Ethernet, or IEEE 802.3
• Classic Ethernet, or IEEE 802.3 • Modern Ethernet
- Most popular LAN of the 1980s, 1990s - Use point-to-point “links” with switches
▪ 10 Mbps over shared coaxial cable, with baseband signals ▪ Store-and-forward, not multiple access, but still
called Ethernet
▪ Multiple access with “1-persistent CSMA/CD with BEB”
▪ Very common in wired networks, at multiple layers
▪ To be introduced later
Switch
Switch ports
Twisted pair
• Frame Format
Packet from Network layer (IP)
- Has addresses to identify the sender and receiver
- CRC-32 for error detection; no ACKs or retransmission
- Start of frame identified with physical layer preamble
39
Wireless Complications – Different Coverage Areas
• Nodes A and C are hidden terminals when sending to B
- Can’t hear each other (to coordinate) yet collide at B
- We want to avoid the inefficiency of collisions
• Nodes B and C are exposed terminals when sending to A and D
- Can hear each other yet don’t collide at receivers A and D
- We want to send concurrently to increase performance
• Node C will almost always “win” if there is a collision at receiver D
- This “capture effect” can lead to extreme unfairness and even starvation
- Power control is the solution, but very difficult to manage in a
non-provisioned environment
• Collision detection is not practical in radio environment
- While transmitting, a station cannot distinguish incoming weak signals
from noise: its own signal is too strong
- Transmitter cannot detect competing transmitters
40
Possible Solution: Multiple Access Collision Avoidance (MACA)
• MACA uses a short handshake instead of CSMA (Karn, 1990)
- 802.11 uses a refinement of MACA
• Protocol rules:
1. A sender node transmits a RTS (Request-To-Send, with frame length)
2. The receiver replies with a CTS (Clear-To-Send, with frame length)
3. Sender transmits the frame while nodes hearing the CTS stay silent
▪ Collisions on the RTS/CTS are still possible, but less likely
42
(W)LAN – How does your packet go into the network?
• 802.11 design considerations
• 802.11 architecture and protocol stack
• 802.11 MAC sublayer protocol
• 802.11 frame structure
• Several Primary 802.11 Amendments
• Services
• Switching
• Wireless MAC sublayer Examples
- Bluetooth, RFID, LoRa, Zigbee, NFC, UWB
43
WLAN requirements – design space and consideration
• Throughput • Transmission robustness and security
- MAC protocol should maximize capacity - Vulnerable to interference and network
of the wireless medium eavesdropping
45
802.11, or Wi-Fi Overview To Network
Access
• A WLAN standard adopted in 1997 with goal of providing: Point
- Last mile multi-access to (Internet) services in wired networks
- High throughput and highly reliable data delivery
Client
- Continuous network connection, e.g., client mobility
• The protocol defines:
- MAC sublayer and MAC management protocols and services
- Several PHY techniques: IR, FHSS, DSSS, OFDM, MIMO, etc.
• Various features have been developed over time driven by:
- Hardware innovation supporting real-time operation of advanced communication technology
- New requirements: bandwidth, latency, energy, range, etc.
• Physical Layer • Link Layer
- Uses (multiple) 20 MHz channels on ISM bands - Multiple access uses CSMA/CA with optional RTS/CTS
▪ 802.11b/g/n on 2.4 GHz; 802.11 a/n/ac on 5 GHz - Frames are ACKed and retransmitted with ARQ
- OFDM modulation (except 802.11b) - Funky addressing (four addresses!) due to AP
▪ Rates adaption for varying SNRs plus error correction - Error detection with a 32-bit CRC
▪ Since 802.11n uses multiple antennas - Many, many features
▪ E.g., encryption, power save
46
Wi-Fi vs. IEEE 802.11?
• IEEE 802.11 is a standard
• Wi-Fi = “Wireless Fidelity” is a trademark
• Fidelity = Compatibility between wireless equipment from different manufactures
• Wi-Fi Alliance is a non-profit organization that does the compatibility testing
- WiFi.org
• 802.11 has many options and it is possible for two equipment based on 802.11 to
be incompatible.
- All equipment with “Wi-Fi” logo has selected options such that they will interoperate
47
Infrastructure and Ad Hoc Mode
• Infrastructure mode: stations communicate with one or more access points which
are connected to the wired infrastructure, with two modes of operation:
- Distributed Control Functions (DCF): contention-based
▪ Deployed in practice
- Point Control Functions (PCF): reservation-based
▪ Rarely used – inefficient, not discussed in this course
- Set of stations associated with one AP that provides access to wired infrastructure Distribution System
50
802.11 MAC – Carrier Sense Multiple Access (with Collision Avoidance)
• Distributed Coordination Function (DCF) technique
• If the channel is sensed idle initially and lasting for Distributed
Coordination Function interframe Space (DIFS), frame is transmitted
- DIFS = SIFS + 2 × slot time
▪ Short Interframe Space (SIFS): time for a wireless interface to process a received
frame and to respond with a response frame, e.g., between DATA and ACK
▪ 802.11n/ac: SIFS = 16 us; slot time = 9 us
• If the channel is sensed busy, the station waits until the current
transmission is over, delays DIFS with a random backoff (also known as
contention window), and sends the frame.
• Fairness consideration
- The backoff timer is halted if the medium becomes
busy and resumes once it becomes idle
- If the frame is sent and an ACK is not received after a
SIFS, then retransmit after the random backoff
procedure (binary exponential backoff)
51
802.11 Carrier Sense Basics
• Clear Channel Assessment (CCA): listens the received energy on the radio interface
• Carrier Sense: the ability of the receiver to detect (and decode) an incoming Wi-Fi signal
preamble
- “BUSY” will be held for the length of the received frame as indicated in the frame’s PLCP Length
field (in microseconds for full frame MPDU payload)
- Indicates the medium is busy for the current frame
• Energy Detection: the ability of the receiver to detect the non-Wi-Fi energy level present
on the current channel
- Based on noise floor, ambient energy, interference sources and unidentifiable/corrupted Wi-Fi
transmissions
- Sample rate and sensitivity level needs to be engineered
52
Virtual Carrier Sense
• Use RTS/CTS to avoid hidden terminal collision
• Network Allocation Vector (NAV)
- Every frame has a “Duration ID” which indicates how long the medium will be busy
▪ RTS has duration of RTS + SIFS + CTS + SIFS + Data + SIFS + ACK
▪ CTS has duration of CTS + SIFS + Frame + SIFS + ACK
▪ Data has duration of Data + SIFS + ACK
▪ ACK has a duration of ACK
- All stations keep a “NAV” timer in which they record the duration of the each frame they hear
- Stations do not need to sense the channel for idle status until NAV becomes zero
53
Use of RTS/CTS
Bytes 2 2 6 6 6 2 6 2 4 variable 4
Bits 2 2 4 1 1 1 1 1 1 1 1
55
802.11 Frame Address Fields
RA: Receiver Address
TA: Transmitter Address
DA: Destination Address
SA: Source Address
BSSID: MAC address of AP in an infrastructure BSS
56
Multi-bitrate
• Wi-Fi standards allow for multiple bit rates • High level designs of Rate Adaptation
- 802.11b has 4 rates, more recent standards have 10s - Goal: pick rate that provides best throughput
▪ Allows for adaptation to channel conditions - “Trial and Error”
- Specific rates and selection algorithm depends on the ▪ Sequence of x successes: increase rate
version and vendor ▪ Sequence of y failures: reduce rate
58
WLAN Identification
• Service Set Identifier (SSID) – identifier for a WLAN
- Human readable
▪ E.g., “Wifeless EECS”, “Password is not 123456”
802.11 LAN
STA1
- Mechanism used to segment wireless networks
▪ Effectively the name of the wireless network – a set of multiple interconnected 802.x LAN
BSS1
wireless BSSs that share the same SSID ESS Access
Point Portal
▪ Multiple independent wireless networks can coexist in the same location –
Distribution System
Extended Service Set (ESS) Access
Point
- Each AP is programmed with a SSID that corresponds to its network
BSS2
▪ AP can also broadcast multiple SSIDs as VAP backed up by VLAN
- Security compromises
STA2
▪ AP can be configured to “broadcast” its SSID (which can be optionally disabled) 802.11 LAN STA3
60
Association Management: Scan, Select and Join
• Stations can detect AP based by scanning • Selecting a BSS/ESS typically must involve the user
- Passive Scanning: station simply listens for - What networks do you trust? Are you willing to pay?
Beacon and gets info of the BSS - Can be done automatically based on user preferences
▪ Beacons are sent roughly 10 times per second • The wireless host selects the AP it will use in an
▪ Power is saved
ESS based on vendor-specific algorithm
- Active Scanning: station transmits Probe
- Uses the information from the scan
Request and elicits Probe Response from AP
- Typically simply joins the AP with the strongest signal
▪ Saves time in scanning (all channels)
▪ Wait for 10 – 20 millisecond for response • Associating with an AP
- Scanning all available channels can become - Synchronization in Timestamp Field and frequency
61
Association Management: Roaming
• Reassociation: association is transferred from active AP to a new target AP
- Supports mobility in the same ESS – layer 2 roaming
• Client driven
- Failure driven: only try to reassociate after connection to current AP is lost
▪ Typically efficient for stationary/nomadic clients since it not common that the best AP changes during a session
▪ Can be very disruptive for mobile devices and latency sensitive applications
- Proactive reassociation: periodically try to find an AP with a stronger signal
▪ Tricky part: cannot communicate while scanning other channels, but can do this using power save mode
▪ Throughput during scanning is still affected though
Set “AUTHORIZED”
WPA/WEP
encryption key
Access to
DHCP server
63
WLAN Security Discussion
• Requirements
- Authentication: only allow authorized stations to associate with and use the AP
- Confidentiality: hide the contents of traffic from unauthorized parties
- Integrity: make sure traffic contents is not modified while in transit
• Examples • Best practice
- Insertion attacks: unauthorized clients or AP - Use WPA2
▪ Client: reuse MAC or IP addr – free service on “secured” APs ▪ Widely supported today
▪ AP: impersonate an AP, such as “PKU” ▪ If not available, use WEP or WPA
- Brute Force Attacks Against AP Passwords - Change the default configuration of your AP
65
Several Primary 802.11 Amendments
• 802.11a – 1999: PHY Standard: 8 channels: OFDM, up to 54 Mbps in the 5 GHz band
• 802.11b – 1999: PHY Standard: 3 channels: DSSS, up to 11 Mbps in the 2.4 GHz band.
• 802.11g – 2003: PHY Standard: 3 channels: OFDM and PBCC, extend 802.11b to 20+ Mbps
• 802.11n – 2009: PHY/MAC Standard: MIMO, Enhancements for higher throughput (100+ Mbps)
• 802.11ac – 2013: PHY/MAC Standard: Enhancements to support 0.5-1 Gbps in < 5 GHz band
• 802.11ad – 2012: PHY/MAC Standard: Enhancements to support 1+ Gbps in < 60 GHz band
• Others:
- 802.11c: Bridge operation at 802.11 MAC layer
- 802.11d: MAC Standard: support for multiple regulatory domains (countries)
- 802.11e: MAC Standard: QoS and security support: supported by many vendors
- 802.11f: Inter-Access Point Protocol: deployed
- 802.11h: MAC Standard: spectrum managed 802.11a (TPC, DFS): standard
- 802.11i: MAC Standard: Enhance security and authentication mechanisms
66
802.11 PHY Layer Standards
802.11n 802.11ac 802.11ax
Standard 802.11a 802.11b 802.11g 802.11ad 802.11ah 802.11ay
Wi-Fi 4 Wi-Fi 5 Wi-Fi 6
Year Introduced 1999 1999 2003 2009 2012 2014 2016 2018 2017
Maximum data 54 11 288.8/600 78 Mbps to 3.2
54 Mbps 6.76 Gbps 347 Mbps 10.53 Gbps 20 Gbps
transfer speed Mbps Mbps Mbps Gbps
2.4
Frequency band 5 GHz 2.4 GHz 2.4/5 GHz 5 GHz 60 GHz 0.9 GHz 2.4/5 GHz 60 GHz
GHz
Highest order
64-QAM 11-CCK 64-QAM 64-QAM 256-QAM 64-QAM 256-QAM 1024-QAM NA
modulation
Range (m):
35/120 35/140 38/140 70/250 35/NA 60/200 NA NA 10/100
Indoor/Outdoor
67
802.11b – 1999
• Physical channels
- Each channel is 22 MHz and 5 MHz apart
▪ 11 channels in US, 14 in Japan and 13 in most others
- Significant overlap
▪ Non-overlapping channels are 1, 6 and 11
• Physical layer – DSSS
- DBPSK & DQPSK
- Uses one of 11 overlapping channels (22 MHz)
- 1 and 2 Mbps: uses Barker Code (11-chip spreading code)
- 5.5 and 11 Mbps: uses Complementary Code Keying (8-chip code) to generate spreading sequences
68
802.11a – 1999
• Physical channels 36 40 44 48 52 56 60 64 channel#
- Center freq = 5000 + 5 × channel number [MHz]
• Modulation 5150 5180 5200 5220 5240 5260 5280 5300 5320 5350 [MHz]
- Use OFDM to divide each physical channel (20 MHz) into 64 subcarriers (FFT size)
▪ 6 at each start and end as guard, 48 as data and 4 as pilot – 20M/64 = 0.3125 MHz each
▪ Pilots are subcarriers of known modulation symbols used for synchronization and channel estimation
▪ Adaptive modulation
• What are the benefits of 802.11a compared with 802.11b?
- Greater throughput (up to 54 Mbps)
- Less potential interference (5 GHz)
- More non-overlapping channels
• Data rate = Data carriers × Spatial streams × Bits per
symbol × Code Rate / Symbol Duration
- (48 × 1 × 6 × ¾ ) / 4 us = 54 Mbps
▪ Symbol duration of 3.2 us and guard interval of 800 ns 69
802.11g – 2003
• 802.11g basically extends of 802.11b for higher rates – effectively 802.11a at 2.4 GHz
- Use the same technology DSSS/CCK for old rates (1, 2, 5.5, 11)
- Uses 802.11a OFDM technology for new rates, same as 802.11a → 54 Mbps
- Extended Rate Physical Layer (ERP)-OFDM
72
Service Data Unit (SDU) and Protocol Data Unit (PDU)
• SDU: a unit of data that has been passed down from an OSI layer or sublayer to a lower layer
- It becomes part of the packet when passing to lower layer
• PDU: a unit of data that will be sent to the peer protocol layer at the receiving end
• SDU is the “payload” of a given PDU
• SDUs may be fragmented or aggregated to form a PDU
73
Frame Aggregation
• Frame Bursting
- Transmit multiple PDUs together, e.g., jumbo packet
• Frame Fragmentation
- SDU fragment in a PDU
• Frame Aggregation
- Multiple SDUs in one PDU
▪ All SDUs must have the same transmitter and receiver address
76
Modern/Switched Ethernet
• Nodes are connected with a switch instead of multiple access
- Uses multiple links/wires as the basis of modern (switched) Ethernet
• Hosts are wired to Ethernet switches with twisted pair Switch
- Switch serves to connect the hosts Switch
• Inside a Switch
Switch ports
- Uses frame addresses to connect input port to the right output port; Twisted pair
multiple frames may be switched in parallel 1
- Port may be used for both input and output (full-duplex), and no MAC 2 1→4
3 and
- Need buffers for multiple inputs to send to one output
...
2→3
- Sustained overload will fill buffer and lead to frame loss 4
Input Loss! Output
• Advantages XXX
- Switches and hubs have replaced the shared cable of classic Ethernet ...
...
...
...
▪ More reliable; Switches offer scalable performance
▪ Wire cut is not a single point of failure that is hard to find
Input Buffer Fabric Output Buffer
▪ E.g., 100 Mbps per port instead of 100 Mbps for all nodes of shared cable
77
Switch Forwarding Address Port
A
• Switch needs to find the right output port for the destination D B
C
address in the Ethernet frame. How? D
Switch
- Want to let hosts be moved around readily; don’t look at IP
• Backward Learning Address
A
Port
1
- Switch forwards frames with a port/address table as follows: D B
...
...
...
...
- D-right → C-left, E, F: both E and F all receive multiple copies! Left / Right
- C-right → D-right, A, B D
- C-left → D-left, A, B
E F
- D-left → …
- D-right → …
79
Spanning Tree Solution
• Switches collectively find a spanning tree for the topology
- A subset of links that is a tree (no loops) and reaches all switches
- Then switches forward as normal on the spanning tree
- Broadcasts will go up to the root of the tree and down all the branches
Root
80
Spanning Tree Algorithm
• Rules of the distributed game: • Outline:
- All switches run the same algorithm - Elect a root node of the tree (switch with the lowest address)
- They start with no information - Grow tree as shortest distances from the root (using lowest
- Operate in parallel and send messages address to break distance ties)
- Turn off ports for forwarding if they aren’t on the spanning tree
- Always search for the best solution
• Details:
• Ensures a highly robust solution
- Each switch initially believes it is the root of the tree
- Any topology, with no configuration
- Each switch sends periodic updates to neighbors with:
- Adapts to link/switch failures, … ▪ Its address, address of the root, and distance (in hops) to root
- Switches favors ports with shorter distances to lowest root
▪ Uses lowest address as a tie for distances
81
Spanning Tree Example
A,A,0 B,B,0 A,A,0 B,B,0 A,A,0 B,A,2 A,A,0 B,A,2 A,A,0 B,A,2
E,E,0 F,F,0 E,A,1 F,B,1 E,A,1 F,B,1 E,A,1 F,A,3 E,A,1 F,A,3
• 1st round, sending: • 2nd round, sending: • 3rd round, sending: • 4th round, steady state has been reached
- A sends (A, A, 0) to say it is - Nodes broadcast their - Nodes broadcast their - Nodes turn off forwarding that is not on the ST
root updated state updated state • Algorithm continues to run
- B, C, D, E, and F do likewise • 2nd round receiving: • 3rd round receiving: - Adapts by timing out information
- A remains (A, A, 0) - A remains (A, A, 0)
• 1st round, receiving: - E.g., if A fails, other nodes forget it, and B will
- B updates to (B, A, 2) via - B remains (B, A, 2) via C become the new root
- A still thinks is it (A, A, 0)
- B still thinks (B, B, 0)
C - C remains (C, A, 1) • Forwarding proceeds as usual on the ST
- C remains (C, A, 1) - D remains (D, A, 2) via C- - Initially D sends to F
- C updates to (C, A, 1)
- D updates to (D, A, 2) via left ▪ D → C-left, C → A, B, A → E, B → F
- D updates to (D, C, 1) C - E remains (E, A, 1) - And F sends back to D:
- E updates to (E, A, 1) - E remains (E, A, 1) - F updates to (F, A, 3) via B ▪ F → B, B → C, C → D, (not such a great route
- F updates to (F, B, 1) - F remains (F, B, 1) though)
82
Radia Perlman (1951–)
• Key early work on routing protocols • I think that I shall never see
- Routing in the ARPANET A graph more lovely than a tree.
A tree whose crucial property
- Spanning Tree for switches (next)
Is loop-free connectivity.
- Link-state routing (later)
A tree that must be sure to span
• Known as “Mother of the Internet” So packets can reach every LAN.
- She dislikes though First, the root must be selected.
• Now focused on network security By ID it is elected.
Least-cost paths from root are
traced.
In the tree, these paths are placed.
A mesh is made by folks like me,
Then bridges find a spanning tree.
83
MAC addresses and Address Resolution Protocol (ARP)
• MAC (or LAN or physical or Ethernet) address: • Goal of ARP: from IP address to MAC address
- Function: used “locally” to get frame from one • ARP table: in each IP node (host, router) on LAN
interface to another physically-connected - IP/MAC address mappings for some LAN nodes
interface (same network, in IP-addressing sense) ▪ <IP addr; MAC addr; TTL>; TTL: typically 20 min
- 48 bit MAC address (for most LANs) burned in • ARP protocol: used in same LAN
- A wants to send packets to B without B’s MAC addr
NIC ROM, also sometimes software settable
- A broadcasts ARP query packet with B’s IP addr
- Allocated and administered by IEEE
▪ Dest MAC addr = FF-FF-FF-FF-FF-FF
- Flat rather than hierarchical: portability
- B receives ARP packet, replied to A with its MAC
1A-2F-BB-76-09-AD addr
- A caches IP-to-MAC addr pair in its ARP table
LAN adapter
(wired or wireless) ▪ Soft state: information that times out unless refreshed
71-65-F7-2B-08-
53
58-23-D7-FA-20-B0 - ARP is “Plug-and-play”
0C-C4-11-6F-E3-98 ▪ Nodes create their ARP tables without intervention from
net administrator
84
Virtual Local Area Network (VLAN)
• CS user moves office to EE, but wants connect to CS switch?
- Take Apple for example…
Computer
• VLAN: switch(es) supporting VLAN capabilities can be configured to Science
EE
define multiple virtual LANS over single physical LAN infrastructure.
• Port-based VLAN: switch ports grouped (by switch management software)
so that single physical switch can operate as multiple virtual switches
• 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
• Dynamic membership: ports can be dynamically assigned among VLANs
1 7 9 15
switches) … …
- In practice vendors sell combined switches plus routers EE (VLAN ports 1-8) CS (VLAN ports 9-15)
85
VLANS spanning multiple switches
• Trunk port: carries frames between VLANS 1
2
7
8
9
10
15
16
1
2
3
4
5
6
7
8
Dest. Source
Preamble
Address Address
Type Data (payload) CRC 802.1 frame
Dest. Source
Preamble
Address Address
Type Data (payload) CRC 802.1Q frame
86
Bluetooth Overview
• SIG (Special Interest Group, from 1994) develops a standard for connecting
communication devices with short-range, low-power, inexpensive wireless radios
• Bluetooth history (range, data speed and power consumption)
- Bluetooth Classic
▪ 1.0, 1999. For wireless headphones, speakers and game controllers with 1 Mbps
▪ 2.0, 2004. First Bluetooth-enabled stereo headphones. Higher data rates (2–3 Mbps), longer
communication distances (30 m)
▪ 3.0, 2009. Device Pairing in combination with 802.11 for high-throughput data transfer (up to 24 Mbps), a
game-changing update (can support video), but still is limited by its power consumption
- Bluetooth Low Energy (BLE)
▪ 4.0, 2010. Return to 1–2 Mbps but keep energy demands low. fitness trackers, hearing aids, and
headphones can stay paired longer using less power.
▪ 5.0, 2016. Support multiple bitrate with different communication distances (up to 240 m)
Optional material 87
Bluetooth Architecture
• Piconet: one controller node and up to seven active worker nodes
- Up to 255 further slave devices can be inactive, or parked
- Centralized TDM system
- Only controller-worker communication, not worker-worker communication
• Scatternet: interconnected collection of piconets with bridge node
• For example, Two piconets can be connected to form a scatternet
Optional material 88
Bluetooth Protocol Stack
• Do not follow the OSI model or TCP/IP model
• Physical radio layer – Physical layer
- Radio transmission and modulation, for inexpensive devices
- 2.4GHz ISM band (overlapped with Wi-Fi and Zigbee),79 channels of
1MHz, Hop and adapt its hop sequence to exclude interface channels
• Link control – MAC sublayer + elements of PHY
- Control time slots and frame grouping
- Frames can be 1, 3, or 5 slots long
• Link manager
- Logical channels establishment (e.g., power management, paring and
encryption)
• Host controller interface line
- Protocols below this line will be implemented on a Bluetooth chip
• L2CAP: Logical Link Control Adaptation Protocol
- Framing, provide reliability if needed
• Profile: support special applications
- Audio/video/networking/connecting keyboard and so on
Optional material 89
Bluetooth Frame Structure
• Access code
• Header containing typical MAC sublayer fields
• (Enhanced rate) guard field and synchronization pattern
• Payload up to 2744 bits
Optional material 90
RFID Overview
• RFID (Radio-Frequency IDentification) is a technology with a long history
- The predecessor can be traced back to the covert listening device invented by the Soviet Union in 1945.
“The Thing”, or “the Great Seal Bug”.
- The early device was patented in 1973
• Use multiple frequency bands
- LF (Low Frequency): 120–150 kHz
- HF (High Frequency): 13.56 MHz
- UHF (Ultra High Frequency): 433MHz or ISM band
- Microwave: 2.4GHz (ISM band) or 3.1–10 GHz (Ultra wide band)
- The cost, data rate, and communication range are higher on higher frequency band
• Standards
- Tens of standards
- EPC Gen2 (EPCglobal UHF Class 1 Generation 2), widely used in supply chain
Optional material 91
RFID Architecture
• Architecture
- Tag (passive, active or battery-assisted-passive)
▪ Chip, antenna, and substrate
- Reader (Interrogator)
▪ Power tags, centralized control
• EPC GEN II
- Physical layer (backscatter and half-duplex)
▪ Interrogator sends double-sideband amplitude shift keying (DSB-ASK), SSB-ASK or phase-reversal amplitude shift
keying (PR-ASK)
▪ Interrogator transmits an unmodulated RF carrier and listening for a backscatter reply
▪ Tags communicate by modulating amplitude and/or phase of the carrier
- Tag-identification layer
▪ Interrogator uses three basic operations: select, inventory, access
▪ Choosing a tag population, identifying individual tags and communicating with an identified tag
• Recommend reading:
- https://www.asiarfid.com/what-is-rfid.html
Optional material 92
LoRa
• LoRa (Long Range) is a low-power for 5 – 10 km wide area network
technique.
- Environmental monitoring
- Disaster warning
- Smart agriculture
• LoRa Alliance (nonprofit association)
- But PHY layer is a proprietary protocol of Semtech
- Semtech produces all the commercial LoRa chips
• Open source: BastilleResearch/gr-lora
• Architecture
- LoRa Modulation
▪ Based on spread-spectrum modulation techniques derived from chirp spread
spectrum, achieve data rates between 0.3 kbps and 27 kbps
▪ 470 – 510 and 779 – 787 MHz in China
▪ 902 – 928 MHz in North America
- LoRa MAC
- Application Layer
Optional material 93
Zigbee
• IEEE 802.15.4-based, for small, low-power, low data rate, and close proximity wireless ad hoc network (or
mesh network)
• Intended to be simpler and less expensive than other wireless personal area networks (WPANs), such as
Bluetooth or Wi-Fi. (e.g., Home automation, sensor networks, industrial control systems)
- 2.4GHz (250kb/s)
- 784 MHz (20kb/s) in China
- 868 MHz in Europe
- 915MHz in the US
• Open source
- bastibl/gr-ieee802-15-4
• Architecture
- PHY
- MAC: CSMA/CA
- Network
- Application
- Also define Profile
Optional material 94
UWB
• UWB (Ultra WideBand) is a low-energy radio
technology for short-range, high-bandwidth
communication
• Lack of widely accepted standards
• Use pulse-position of time modulation, which
occupies a large bandwidth (more than 500 MHz)
• Applications
- Real-time location
- Mobile telephony (e.g., iPhone 11, Samsung Galaxy
Note20 Ultra)
Optional material 95
NFC
• NFC (Near-Field Communication) is a set of communication protocols for communication between
two devices over a distance of 4 cm or less
• NFC Forum
- Established by Nokia, Philips and Sony
• Standards
- FeliCa, MIFARE, ...
• Architecture
- NFC controller
- NFC protocol stack
- Security chip (Optional)
- Applications
• Applications
- Contactless payment systems
- Bootstrapping other connections
- Identity and access tokens
Optional material 96
What’s happening in USA on Wireless Networking
https://beta.sigmobile.org/uploads/images/Reports/2017-NSF-Visioning-
Workshop-Report-on-Extreme-Wireless-Networking-9.pdf 98