0% found this document useful (0 votes)
17 views

Mod 2 Link F24

Uploaded by

woshijuruo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Mod 2 Link F24

Uploaded by

woshijuruo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 97

04834480

Computer Networks (Honor Track)

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?

• The physical/PHY layer gives us a stream of bits. …10110 …


• How do we interpret it as a sequence of frames?
• In practice, the physical layer often helps to identify frame boundaries
- E.g., Ethernet, 802.11
• Byte Count • Byte Stuffing
- Start each frame with a length field - Have a special flag byte value that means start/end of frame

- Replace (“stuff”) the flag inside the frame with an escape code
- Any unescaped FLAG is the start/end of a frame

- Difficult to re-synchronize after framing error

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

- Preamble transmitted at 1 Mbps


- PLCP header transmitted at 2 Mbps
- More efficient than long preamble

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:

bits; send the codeword of D+R bits All codewords

• 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

▪ For a code of distance d+1, up to d errors will always be detected


- Error correction:
▪ For a code of distance 2d+1, up to d errors can always be corrected by mapping to the closest codeword

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

Three bit errors to get to B


Error codeword
B

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

- Check 4 covers positions 4, 5, 6, 7


• Take home: 2k – 1 = n + k or 2k − 1 ≥ n + k (redundancy) 18
Error Correcting Coding in the State of Art
• Convolutional codes
- Take a stream of data and output a mix of the recent input bits
▪ Makes each output bit less fragile
- Decode using Viterbi algorithm
▪ Can use bit confidence values

• Low Density Parity Check


- Invented by Robert Gallager in 1963 in his PhD thesis
▪ Promptly forgotten until 1996 because it is “practical” for large block sizes with today’s technology
- Each output bit is formed from only a fraction of the input bits
- Based on sparse matrices, decoded iteratively using a belief propagation algorithm
- Performance is similar to turbo codes but it has some implementation advantages

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

- Should be: - Or the timeout is early?


▪ Not too big (link goes idle) Sender Receiver
Frame
▪ Not too small (spurious retransmission)
Timeout ACK
- Fairly easy on a LAN
▪ Clear worst case, little variation Frame New
- Fairly difficult over the Internet Frame??
ACK
▪ Much variation, no obvious bound
▪ We’ll revisit this with TCP
24
Sequence Numbers
• Frames and ACKs must both carry sequence numbers for correctness
• To distinguish the current frame from the next one, a single bit (two numbers) is
sufficient

Sender Receiver Sender Receiver Sender Receiver


Frame 0 Frame 0 Frame 0

ACK 0 Time Timeout


Timeout Timeout X ACK 0
ACK 0
Frame 1
Frame 0 Frame 0 It’s a
It’s a Resend
ACK 1
Resend! OK … ACK 0
ACK 0

In the normal case With ACK Loss With early timeout

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!

the received and transmitted signals


• Can reduce the cost of collisions by detecting them and aborting by X

sending jam signal the rest of the frame time


- Want everyone who collides to know that it happened ASAP! X
▪ Before waiting for the ACK that will never come
- If the frame is too short, sender may realize collision happens too late!
▪ Know if collision happens before finishing transmission Spatial layout of nodes
- Time window in which a node may hear of a collision is 2D seconds
▪ D: propagation delay

• Impose a minimum frame size that lasts for 2D seconds


- So transmission can’t finish before collision
▪ Receives the first bit from another transmission when the first bit of its
transmission is received by the other end
- Ethernet minimum frame is 64 bytes
34
CSMA “Persistence” – scalability issue
• What should a node do if the line is busy? What now?

• Idea: wait until it is done, and send


• Problem is that multiple waiting nodes will queue up then collide
- More load, more of a problem Now! Uh oh Now!
• Intuition for a better solution
- If there are N queued senders, we want each to send next with
probability 1/N, but is it the best solution?
Send p=½ Whew Send p=½
• P-persistent scheme
- Transmit with probability p once the channel goes idle
- Delay the transmission by tprop with 1-p
• Non-persistent scheme
- Reschedule transmission for a later time based on a delay
distribution: sense the channel at that time, and repeat
▪ Binary Exponential Backoff (BEB)

G: Transmission Attempts per Packet time 35


Binary Exponential Backoff (BEB)
Procedure Packet?
No
• NIC receives datagram from network layer, creates frame
Sense Detect
Send
- If NIC senses channel idle, starts frame transmission Carrier Collision
- Else if NIC senses channel busy, waits until channel idle, Yes
Discard
then transmits Packet Jam channel
attempts < 16 b = BEB();
• If NIC transmits entire frame without detecting another wait(b);
attempts == 16 attempts++;
transmission, NIC is done with frame
• If NIC detects another transmission while transmitting, • Exponentially increasing random delay
aborts and sends jam signal - Infer # of senders from # of collisions
• After aborting, NIC enters BEB: - More senders → increase wait time
- After mth collision, NIC chooses K at random from {0, 1, 2, • BEB doubles interval for each
…, 2m – 1}. NIC waits K x 512 bit times, returns to Step 2 successive collision
▪ After ten or more collision, choose K from {0, 1, 2, 3, 4, …, 1023} - Quickly gets large enough to work
- Longer backoff interval with more collisions
36
Issues with Random Multiple Access
• CSMA is good under low load:
- Grants immediate access
- Little overhead (collisions)
• But not so good under high load:
- High overhead (expect collisions)
- Access time varies (lucky/unlucky)
• We want to do better under high load!

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

• A → B with hidden terminal C • B → A, C → D as exposed terminals


- A sends RTS, to B - B and C send RTS to A and D
RTS RTS RTS
A B C D A B C D

- B sends CTS, to A, and C too - A and D send CTS to B and C


Alert! All OK All OK
RTS RTS RTS
A B C D A B C D
CTS CTS CTS CTS

MACAW: a media access protocol for wireless LAN’s, SIGCOMM’96 41


Topics
• Framing
- Delimiting start/end of frames
• Error Control
- Error control and correction, retransmission
• Multiple Access
- MAC and CSMA
• (W)LAN – How does your packet go into the network?
- 802.11, modern Ethernet, switching and examples

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

• Number of nodes • Collocated network operation


- Interference of coexisted wireless networks
- Hundreds of nodes
• License-free operation
• Connection to backbone LAN
- No need to secure a license for the frequency
- Accommodation for mobile users and ad
band
hoc wireless networks
• Handoff/roaming
• Service area - Layer 2 client mobility
- Coverage area has a diameter of 100 – • Dynamic configuration
300 m - Automated addition, deletion and relocation of
• Battery power consumption end systems without disruption to other users
- Sleep mode is a critical design 44
802.11 family

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

• Alternative is “ad-hoc” mode: multi-hop, assumes no infrastructure


- Rarely used, e.g., military, disaster
- Recurrent research topic!
▪ Sensor, vehicular, drone, BLE, mmWave
- Ad-hoc is a PHY layer connectivity concept while mesh is a network layer routing function
▪ Mesh concerns multi-hop facility
- Also used for describing “自由散漫”
48
802.11 Architecture
• Station (STA)
- Terminal with access mechanisms to the wireless medium and radio contact to Infrastructure Network

the access point 802.11 LAN


STA1
• Access Point (AP)
- Station integrated into the wireless LAN and the distribution system 802.x LAN
BSS1
Access
• Basic Service Set (BSS) ESS
Point Portal

- Set of stations associated with one AP that provides access to wired infrastructure Distribution System

• Extended Service Set (ESS) Access


Point
- A set of infrastructure BSSs that work together – aggregation of APs from BSSs BSS2
• Distribution System (DS)
- Interconnection network to form one logical network (ESS) based on BSSs STA2
802.11 LAN STA3
• Portal
- Bridge to other (wired) networks
STA STA
Ad Hoc Network IBSS IBS
• Independent BSS (IBSS) STA STA S

- Set of computers in ad-hoc mode


49
(Review) Ingredients of MAC Protocols
• Carrier sense (CS)
- Hardware capable of sensing whether transmission taking place in vicinity
- Not all PHY layers support CS (i.e., RFID, weak tags)
• Collision detection (CD)
- Hardware capable of detecting collisions
• Collision avoidance (CA)
- Protocol for avoiding collisions
• Acknowledgments
- When collision detection is not possible, link-layer mechanism for identifying failed transmissions
• Backoff mechanisms
- Methods for estimating contention and deferring transmissions

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

RTS/CTS can be optionally (and is by default) turned off to reduce overhead 54


802.11 Frame Format

Bytes 2 2 6 6 6 2 6 2 4 variable 4

Frame Address 1 Address 2 HT Check


Duration Address 3 Sequence Address 4 QoS Data
Control (recipient) (transmitter) Control Sequence

Version Type Subtype To From More Pwr. More


Retry Protected Order
= 00 = 10 = 0000 DS DS frag. mgt. data

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

Physical Physical Logical Logical


Receiver Transmitter Transmitter Receiver

To DS From DS Message Address 1 Address 2 Address 3 Address 4

station-to-station frames in an IBSS; all


Ad hoc 0 0 management/control frames DA SA BSSID N/A

from AP 0 1 From AP to station DA BSSID SA N/A

to AP 1 0 From station to AP BSSID SA DA N/A

in DS 1 1 From one AP to another in same DS RA TA DA SA

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

- Packets have multi-rate format ▪ Many variants – RRAA


➢ “Robust Rate Adaptation for 802.11 Wireless
• Many factors influence packet delivery: Networks”, ACM MobiCom, 2006
- Fast and slow fading: nature depends strongly on the - Signal strength
environment ▪ Use path loss information to calculate “best” rate
- Interference versus Wi-Fi contention: response to ▪ Assumes a relationship between PDR and SNR
collisions is different ▪ Tends to be a bit harder to manage – Charm
➢ “Efficient Channel-aware Rate Adaptation in Dynamic
- Random packet losses: can confuse “smart”
Environments”, ACM MobiSys, 2008
algorithms
▪ Cross-layer
- Hidden terminals: decreasing the rate will increase ➢ “Cross-Layer Wireless Bit Rate Adaptation”, ACM
the chance of collisions SIGCOMM, 2009
57
802.11 Management and Control Services
• Synchronization
- Beacon
• Association management
- Join, handoff/roam and disconnect
• Security
- Authentication, confidentiality and integrity
• Power management
- Power saving or “sleep” mode without missing a message

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

▪ SSID may be shared among users of the wireless segment


• Basic Service Set Identifier (BSSID)
- The MAC address of the AP
- A subset of SSID
59
Association Management Overview
• Stations must associate with an AP before they can use the wireless network
- AP must know about them so it can forward packets
- Often also must authenticate
• Association is initiated by the wireless host – involves multiple steps:
- Scanning: finding out what access points are available
▪ Active/Passive scanning
- Selection: deciding what AP (or ESS) to use
- Authentication: needed to gain access to secure APs
- Association: protocol to “sign up” with AP
▪ Involves exchange of parameters
• Disassociation: station or AP can terminate association
- Client sends disassociation request or timeout
• Remember: this is layer 2 connectivity
- Don’t guarantee a higher layer connectivity, e.g., Internet access

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

very time consuming! - Adopt PHY parameters


▪ Especially with passive scanning - Other parameters: BSSID, WEP, Beacon Period, etc.
▪ Cannot transmit and receive frames during most
of that time – not a big problem during initial
association

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

• Distribution System assisted


- Coordination between APs is defined in 802.11f
- Inter-AP authentication and discovery typically
coordinated using a RADIUS server
- “Fast roaming” support (802.11r) also streamlines
authentication and QoS, e.g. for VoIP
▪ Wi-Fi Goes to Town: Rapid Picocell Switching for Transit
Wireless Networks, SIGCOMM’17
62
802.1x and Extensible Authentication Protocol (EAP) Execution
• Enables authentication and key
management for 802.11 networks
• Three components Set “UNAUTHORIZED”
- Supplicant (E.g., client software) All client traffic except
802.1x messages are
- Authenticator (E.g., access point, switch) blocked
- Authentication server (E.g., RADIUS
/AAA server)

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

▪ Dictionary attacks against SSID ▪ Change default passwords/SSID on APs


- Use MAC filtering if available
- Encryption Attacks
▪ Whitelist makes sense for personal usage
▪ Exploit known weaknesses of WEP
- Use a VPN or application layer encryption
- Misconfigurations, e.g., use default password
▪ Must assume that wireless segment is untrusted
▪ Common mistake in today’s IoT device
▪ Provides end-to-end encryption
- Jamming, e.g., denial of service
▪ Cordless phones, baby monitors, leaky microwave oven, etc. 64
Power Management
• Goal: to enhance battery life of the (mobile) stations
• Observation/insight: idle receive state dominates WLAN adapter power consumption over time
• Idea: allow idle stations to power off their (radio) transceiver while still maintaining an active session
- AP keeps track of stations in Power Savings mode and buffers their packets
- Traffic Indication Map (TIM) is included in beacons to inform which power-save stations have packets waiting at the AP
▪ TIM: list of unicast receivers transmitted by AP
- Power Saving stations wake up periodically and listen for beacons
▪ If they have data waiting, they can send a PS-Poll to request that the AP sends their packets
• Timing Synchronization Function (TSF): stations wake up at the same time
- Synchronizes clocks of the nodes in the BSS via beacon frames
• Broadcast/multicast frames are also buffered at AP
- Sent after beacons that includes Delivery Traffic Indication Map (DTIM)
▪ DTIM: list of broadcast/multicast receivers transmitted by AP
- AP controls DTIM interval

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

Channel 2, 4, 8, 16 20, 40, 80, 8000


20 MHz 22 MHz 20 MHz 20, 40 MHz 20, 40, 80, 160 MHz 2160 MHz
bandwidth MHz 160 MHz MHz

Highest order
64-QAM 11-CCK 64-QAM 64-QAM 256-QAM 64-QAM 256-QAM 1024-QAM NA
modulation

DSSS, SC, LPSC,


Spectrum usage OFDM DSSS OFDM OFDM OFDM OFDM OFDM
OFDM OFDM

Antenna 1x1 1x1 1x1 Up to 4 x 4 Up to 8 x 8 MIMO, MU-


NA MIMO MU-MIMO
configuration SISO SISO SISO MIMO MU-MIMO MIMO

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

Estimated Distance (m) versus Data Rate


70
802.11n – 2009
• Main upgrades: MIMO, 40 MHz channels bonding and frame aggregation
• Diversity: More receive antennas than the number of streams – Select the best subset of antennas.
• Beamforming: Focus the beam directly on the target antenna.
• Frame Aggregation: Pack multiple input frames inside a frame → less overhead → more throughput
• Lower FEC Overhead: 5/6 instead of 3/4
• Reduced Guard Interval: 400 ns instead of 800 ns
• Reduced Inter-Frame Spacing: SIFS = 2 us, instead of 10 us
• Greenfield Mode: Optionally eliminate support for a/b/g (shorter and higher rate preamble)
• Dual Band: Both 2.4 and 5.8 GHz
• Space-Time Block Code for MIMO
• Channel Bonding: Use two adjacent 20 MHz channels
• More Subcarriers: 52 + 4 instead of 48 + 4 with 20 MHz, 108 + 6 with 40 MHz
• Max Data rate: (108 × 4 × 6 × 5/6 ) / 3.6 us = 600 Mbps
• “802.11n – A Survival Guide” by Matthew S. Gast 71
Guard Interval
• Rule of Thumb: Guard Interval = 4 × Multi-path delay spread
• Initial 802.11a design assumed 200 ns delay spread
- 800 ns GI + 3200 ns data → 20% overhead
• Most indoor environment have 50-75 ns
• So if both sides agree, 400 ns can be used in 802.11n
- 400 ns GI + 3200 ns data → 11% overhead

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

A-MPDU aggregation: CRC is at MAC-level


No aggregation

A-MPDU of A-MSDU aggregation: finer granularity


A-MSDU aggregation: minimum protocol overhead
74
802.11ac
• Supports 80 MHz and 80+80 non-continuous MHz channels
• 5 GHz only – No 2.4 GHz
• 256-QAM 5/6: 8/6 times 64-QAM → 1.33x
• 8 Spatial Streams: 2x
• Multi-User MIMO
• Null Data Packet (NDP) explicit beamforming only
- For alignment purpose
• Less pilots: 52 + 4 (20 MHz), 108 + 6 (40 MHz), 234 + 8 (80
MHz), 468 + 16 (160 MHz) → 9x
• MAC enhancement for high-speed
- HT (high-throughput) Control field redefined
• Max Data rate = (468 × 8 × 8 × 5/6) / 3.6 us = 6.933 Gbps
- 468 data subcarriers, 256 QAM, 8 spatial streams, 5/6 code rate
• “802.11ac – A Survival Guide” by Matthew S. Gast
75
Multi-User MIMO
• MIMO: Multiple uncorrelated spatial beams
- Multiple antenna’s separated by 𝝀/𝟒
- Cannot put too many antennas on a small device
• MU-MIMO: Two single-antenna users can act as one multi-antenna device.
- The users do not really need to know each other
• Simultaneous communication with two users on the same frequency at the same
time.

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

▪ To fill the table, it looks at the source address of input frames C


D
▪ To forward, it sends to the port, or else broadcasts to all ports Switch
• Learning with Multiple Switches Address Port
- Just works with multiple switches and a mix of hubs assuming no A 1
D B
loops, e.g., A sends to D then D sends to A
C
D 4
Ethernet Frame Switch

...
...
...
...

Source Destination Switch 78


Problem – Forwarding Loops
• May have a loop in the topology
- Redundancy in case of failures
- Or a simple mistake
Redundant
• Want LAN switches to “just work” Links
- Plug-and-play, no changes to hosts
- But loops cause a problem …
• Suppose the network is started and A sends to F. What happens?
- A→C
A B
- C → B, D-left, D-right
- D-left → C-right, E, F: C receives the unwanted copies back! C

- 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

Topology One ST Another ST

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

Hi, I’m C, the root is A, it’s 2 hops away or (C, A, 2)

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

C,C,0 C,A,1 C,A,1 C,A,1 C,A,1

D,D,0 D,C,1 D,A,2 D,A,2 D,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

• Forwarding between VLANs: done via routing (just as with separate 2 8 10 16

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

defined over multiple physical switches … … …


- Frames forwarded within VLAN between switches EE CS (VLAN ports 9-15) Ports 2,3,5 belong to EE VLAN
(VLAN ports 1-8) Ports 4,6,7,8 belong to CS VLAN
can’t be vanilla 802.1 frames (must carry VLAN ID
info)
- 802.1q protocol adds/removed additional header
fields for frames forwarded between trunk ports

Dest. Source
Preamble
Address Address
Type Data (payload) CRC 802.1 frame

Dest. Source
Preamble
Address Address
Type Data (payload) CRC 802.1Q frame

2-byte Tag Protocol Identifier Tag Control Information Recomputed CRC


(value: 81-00) (12 bit VLAN ID field, 3 bit priority field like IP TOS)

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

You might also like