LAN - Ethernet and Wi-Fi
In questa pagina 5
What a LAN is
Definition (LAN). A Local Area Network is a network designed for a limited geographic area. Most LANs are connected to a WAN, i.e. to the Internet (Network Types and TopologiesNetworks are classified by extent (BAN, WLAN, LAN, MAN, WAN, WSN), by transmission medium (air, fibre, copper, visible light) and by topology: bus (shared medium, collisions), star (central node, bottleneck), ring (each node forwards to the next), mesh (a direct link between every pair: n(n-1)/2 links). The choice depends on reliability, scalability, protocol and physical medium.Network Types and Topologies →).
In the 1980s and 1990s many LAN types existed, each with its own medium access method: Ethernet uses CSMA/CD, Token Ring and Token Bus use token passing, and so on (Multiple Access Protocols - ALOHA and CSMAWhen several stations share a medium a medium access (MAC) protocol must decide who transmits. Random access: pure ALOHA (transmit immediately, vulnerable time 2 t_F), slotted ALOHA (start only at slot boundaries, vulnerable t_F), CSMA (listen before talking, vulnerable tau_p) with 1-persistent, non-persistent and p-persistent variants, CSMA/CD (detects collisions while transmitting: needs t_F >= 2 tau_p, hence a minimum frame) and the Wi-Fi CSMA/CA (IFS, contention window with backoff, ACK, RTS/CTS and NAV). Controlled access: reservation, polling, token. Channelization: FDMA, TDMA, OFDMA, CDMA, SDMA.Multiple Access Protocols - ALOHA and CSMA →). Almost all disappeared from the market except Ethernet, which managed to upgrade itself to meet the needs of every era.
The IEEE 802 project
The IEEE 802 project was promoted by a consortium of companies with the support of the IEEE (Institute of Electrical and Electronics Engineers), but the standards are published by other bodies under slightly different names: ISO and IEC list each IEEE 802. standard as ISO/IEC 8802.. Why 802? It was simply the next free number the IEEE could assign; it is sometimes tied to the date of the first meeting, February 1980 ().
The 802.x family.
| Standard | Content |
|---|---|
| 802.1 | higher-layer LAN protocols; general architecture of the project; introduces the split of the data link layer (DLL) into two sublayers: LLC (Logical Link Control) and MAC (Medium Access Control) |
| 802.2 | LLC: services and interfaces, management of logical connections in a LAN |
| 802.3 (Ethernet), 802.4 (Token Bus), 802.5 (Token Ring), 802.6 (MAN), 802.11 (wireless LAN), 802.15 (wireless PAN) | define the MAC protocols (and the physical layer) |
So an Ethernet or Wi-Fi interface implements the two lowest layers of the stack (ISO-OSI Model and TCP-IP StackCommunication between two computers is too varied a problem (signals, errors, medium access, routing, flow control, data representation) for a single protocol, so it is divided into layers. The ISO/OSI model has 7 layers (physical, data link, network, transport, session, presentation, application); the TCP/IP stack merges the top three into one application layer, so it has 5. Each layer offers a service to the one above and talks only to its peer layer through PDUs; going down a header (PCI) is added: encapsulation. Addresses: MAC (link, local), IP (network, global), port (transport).ISO-OSI Model and TCP-IP Stack →): LLC on top, MAC and PHY below.
Ethernet and IEEE 802.3
Developed in the 1970s by Robert Metcalfe and David Boggs; approved and standardized in 1980-81 by the DIX consortium (Digital, Intel, Xerox); standardized in 1983 as IEEE 802.3 (approved by ISO as ISO 8802.3). Ethernet and 802.3 differ very little.
The philosophy of Ethernet
The Ethernet link service is:
- connectionless: a frame is sent when ready;
- without flow control: the sender can overwhelm the receiver; excess frames are silently discarded and loss recovery is left to the upper layers;
- without ACK: frames have a 32-bit CRC field (FCS) to detect errors, but there is no native ARQ for bit errors (ARQ Protocols - Stop-and-Wait, Go-Back-N and Selective RepeatARQ (Automatic Repeat reQuest) makes an error-prone link reliable: the receiver acknowledges (ACK) frames received correctly and the sender retransmits when the timeout expires. Timeouts (against deadlock) and sequence numbers (against duplicates) are needed. With t_G = t_F + 2 tau_p + t_A and error probability p: Stop-and-Wait rho = t_F(1-p)/t_G; Go-Back-N with window N >= t_G/t_F rho = (1-p)/(1+(N-1)p); Selective Repeat rho = 1-p. Efficiency eta = rho I/F. The optimal window is the pipe capacity in packets. For Selective Repeat there is also an optimal frame length: with overhead o and bit error probability P_b, x_opt is about o/2 + sqrt(o/P_b) (shorter frames when the channel errs more).ARQ Protocols - Stop-and-Wait, Go-Back-N and Selective Repeat →): if the CRC fails, the receiver silently discards the frame;
- a retransmission takes place only on collision (CSMA/CD).
Why this is sensible: on the short cable of a LAN errors are rare and the cost of an ARQ for every frame would exceed the benefit; the upper layers (TCP) retransmit whatever is missing anyway.
Frame format
| Preamble | SFD | Dest. | Src. | Type / Length | Data (+ PAD) | CRC |
| 7 B | 1 B | 6 B | 6 B | 2 B | 46 - 1500 B | 4 B |- Preamble: sequence of 56 bits
10101010...for bit synchronization at the receiver. Actually added by the physical layer. - SFD (Start Frame Delimiter): the 8 bits
10101011closing the preamble and giving frame synchronization (the "flag"); also added by the PHY. - Destination and source address: 48 bits each, worldwide-unique MAC addresses. Destination: unicast (
0xxx...), multicast (1xxx...), broadcast (all 1s) as in Data Link Layer and FramingThe data link layer (DLL) delivers a frame from a node to an adjacent node over a link. Services: framing, medium access (MAC) with 48-bit MAC addresses, flow control, error detection and correction. It splits into DLC (framing, error and flow control) and MAC (shared medium access). Framing delimits frames with a flag: byte-oriented protocols (8-bit flag, ESC) use byte stuffing, bit-oriented ones (flag 01111110) use bit stuffing, which inserts a 0 after every five consecutive 1s.Data Link Layer and Framing →. - Type / Length (2 bytes). In the Ethernet (DIX) frame the field is called Type and indicates the upper-layer protocol (e.g. for IPv4; the prefix denotes hexadecimal, where each digit is bits). In the 802.3 frame it is called Length and gives the data length in bytes, excluding preamble and padding; in this case the data field holds the 802.2 (LLC) frame. The most significant bit of the field is always to tell an 802.3 frame from an Ethernet one; the theoretical maximum length would be bytes, about 32 KB, but the project limits it to B.
- Data: the LLC PDU, plus padding (PAD) up to the minimum length of bytes, which brings the frame to bytes bits (preamble and SFD excluded).
- CRC (Cyclic Redundancy Check, also FCS): 4 bytes for error detection.
Sizes: why a maximum and a minimum
The frame size is between and bytes; bytes are header and trailer (), so the data field ranges from to bytes.
Example. The ratio of useful data to frame is for the maximum frame, but only for the minimum (same bytes of overhead on a much smaller payload). At Mbit/s the maximum frame lasts ms and the minimum one s (multiply by to go from bytes to bits before dividing by the bitrate).
Why a maximum frame:
- prevent a station from holding the bus too long;
- limit the error probability of the packet (if lost, it is small and just retransmitted);
- reduce buffer memory needs (memory was expensive in the 1980s).
Why a minimum frame: not to reduce overhead (what sense would it make, if a single byte is sent?), but for the access mechanism: CSMA/CD.
The 802.3 MAC: 1-persistent CSMA/CD
The 802.3 MAC is 1-persistent CSMA/CD (Multiple Access Protocols - ALOHA and CSMAWhen several stations share a medium a medium access (MAC) protocol must decide who transmits. Random access: pure ALOHA (transmit immediately, vulnerable time 2 t_F), slotted ALOHA (start only at slot boundaries, vulnerable t_F), CSMA (listen before talking, vulnerable tau_p) with 1-persistent, non-persistent and p-persistent variants, CSMA/CD (detects collisions while transmitting: needs t_F >= 2 tau_p, hence a minimum frame) and the Wi-Fi CSMA/CA (IFS, contention window with backoff, ACK, RTS/CTS and NAV). Controlled access: reservation, polling, token. Channelization: FDMA, TDMA, OFDMA, CDMA, SDMA.Multiple Access Protocols - ALOHA and CSMA →): if the received signal differs from the transmitted one, a collision has been detected. The time to be sure the transmission did not collide is twice the maximum propagation delay ().
Formula (minimum frame size). A frame of size with bitrate lasts . To detect the collision it must hold , i.e.
The frame must contain at least the bits the medium carries in a round trip (bandwidth-delay product).
Example (historical values). Signal speed on the cable m/s; maximum cable length m (set by the designers); Mbit/s. Then s; the constraint is s and Considering the additional delays of repeaters and some safety margin, the minimum is set to 64 bytes ( bits, i.e. s at Mbit/s). When the data field is shorter, PAD is added.
Collision, jam and backoff.
- On collision the station stops transmitting and sends a jam signal so the others also know of the collision: bits in 802.3 ( to bits in Ethernet).
- Then it waits a random time (backoff), with granularity (slot time) of s (the transmission time of the B minimum frame at Mbit/s) and retransmits the frame.
- After consecutive collisions the backoff time is chosen at random between and slots, with (binary exponential backoff: the window doubles at each collision).
- After failed attempts the process is abandoned.
The s slot is the worst-case round-trip time, i.e. exactly the transmission time of the minimum frame ( bits at Mbit/s). The draw is uniform over the integer values (each with probability ), so the mean is slots. Doubling makes a new collision less likely: two stations that already collided times are probably many, and widening the interval reduces the probability that they draw the same number, .
Example. At the third consecutive collision (, ) an integer number of slots between and is drawn: the wait ranges from to s, on average s; two stations pick the same number with probability . From the tenth collision on the window no longer grows: slots, up to ms.
The four generations of Ethernet
| Generation | Bitrate |
|---|---|
| Standard Ethernet | 10 Mbit/s |
| Fast Ethernet | 100 Mbit/s |
| Gigabit Ethernet | 1 Gbit/s |
| 10-Gigabit Ethernet | 10 Gbit/s (today much higher: 25, 40, 100, 400 Gbit/s) |
Standard Ethernet (10 Mbit/s), four popular implementations in the 1980s. The name 10Base-X means: Mbit/s, baseband transmission, and = cable length in hundreds of metres ( m, m) or the medium type ( = twisted pair; = fibre).
| Implementation | Medium | Max length | Coding |
|---|---|---|---|
| 10Base5 | coaxial | 500 m | Manchester |
| 10Base2 | coaxial | 185 m | Manchester |
| 10Base-T | 2 UTP pairs | 100 m | Manchester |
| 10Base-F | 2 fibres | 2000 m | Manchester |
Fast Ethernet (100 Mbit/s): twisted pair or fibre; star topology with a LAN switch in the centre; supports full duplex (CSMA/CD not needed).
| Implementation | Medium | Length | Wires | Coding |
|---|---|---|---|---|
| 100Base-TX | UTP or STP | 100 m | 2 | 4B5B + MLT-3 |
| 100Base-FX | fibre | 185 m | 2 | 4B5B + NRZ-I |
| 100Base-T4 | UTP | 100 m | 4 | 8B6T (two) |
Gigabit Ethernet (1 Gbit/s):
- full duplex: star topology, switch with buffers, separate collision domains, no CSMA/CD;
- half duplex: CSMA/CD with hubs and a reduced network (~ m) or techniques like carrier extension or frame bursting; very rare, almost never used.
| Implementation | Medium | Length | Wires | Coding |
|---|---|---|---|---|
| 1000Base-SX | fibre (short wave) | 550 m | 2 | 8B/10B + NRZ |
| 1000Base-LX | fibre (long wave) | 5000 m | 2 | 8B/10B + NRZ |
| 1000Base-CX | STP | 25 m | 2 | 8B/10B + NRZ |
| 1000Base-T4 | UTP | 100 m | 4 | 4D-PAM5 |
10-Gigabit Ethernet (10 Gbit/s), the current implementation: possible only with optical fibre.
| Implementation | Medium | Length | Coding |
|---|---|---|---|
| 10GBase-SR | fibre at 850 nm | 300 m | 64B66B |
| 10GBase-LR | fibre at 1310 nm | 10 km | 64B66B |
| 10GBase-EW | fibre at 1350 nm | 40 km | SONET |
| 10GBase-X4 | fibre at 1310 nm | 300 m 10 km | 8B10B |
Why CSMA/CD disappears as bitrate grows. With the minimum frame of bits fixed, the constraint fixes the maximum distance of the collision domain. Substituting and solving for : For instance at Mbit/s: m. Each time grows by a factor , is divided by (inversely proportional to ).
| Bitrate | Mbit/s | Mbit/s | Gbit/s | Gbit/s |
|---|---|---|---|---|
| for bit | m | m | m | m |
(These are theoretical limits: real values are lower because of repeaters and margins, e.g. the Mbit/s network was limited to m.) From Gbit/s upward shared Ethernet links make no sense and only point-to-point full-duplex links between station and switch are used, without collisions.
Grafico interattivo: Maximum distance d = F_min * v / (2C) of the collision domain versus bitrate C (F_min = 512 bit, v = 2*10^8 m/s): 5120 m at 10 Mbit/s, 512 m at 100 Mbit/s, 51 m at 1 Gbit/s
The hub acts as a shared medium (a single collision domain), the switch separates collision domains (Network Devices - Hub, Switch and RouterDevices that interconnect networks differ by the highest layer of the stack they read. Hub (layer 1): a repeater, regenerates the signal and sends it out of all ports, all stations share the capacity. Bridge and switch (layer 2): read the MAC address and forward only to the right port, learning the table (FDB) from source addresses. Router (layer 3): reads the IP address and joins independent networks (internetwork). Switches and bridges isolate traffic and are plug and play; the router gives optimal routing but must be configured.Network Devices - Hub, Switch and Router →): it is the full-duplex switch that allowed Ethernet to increase speed.
Wi-Fi: IEEE 802.11
Definition (IEEE 802.11). IEEE specifications for wireless local area networks (in some countries the public calls them Wi-Fi, short for Wireless Fidelity).
Operating modes
Basic Service Set (BSS). Fixed or mobile stations plus a central base station, the Access Point (AP). Requires authentication and access rights to the network. Examples: offices, hot spots, conference rooms. Without an AP the architecture is ad hoc (it cannot send data to other BSSs). Examples: direct file sharing, printers.
Extended BSS (EBSS). Two or more BSSs (with APs) connected through a distribution system (wired, e.g. Ethernet, or wireless). When BSSs are connected, stations within range of each other can communicate without going through the AP. Communication between a station of a BSS and the outside goes through the AP and cannot happen without it.
Physical layer
802.11 supports several transmission rates. Higher rates need a higher SNR to be decoded correctly, and the bitrate is adapted automatically by the cards (NICs) with proprietary schemes.
Example. In the reference figure, at dB (linear ratio ): transmitting at Mbit/s of packets are lost, at Mbit/s , at Mbit/s . It pays to lower the speed: although the nominal bitrate is lower, the effective throughput is higher. Useful throughput is bitrate times the fraction of delivered packets, : at Mbit/s with loss at most Mbit/s, and with retransmissions much less; at Mbit/s with loss Mbit/s. The higher the bitrate, the more SNR is needed because the modulation has closer points and noise confuses them more easily.
MAC layer: CSMA/CA
802.11 uses CSMA/CA (described in Multiple Access Protocols - ALOHA and CSMAWhen several stations share a medium a medium access (MAC) protocol must decide who transmits. Random access: pure ALOHA (transmit immediately, vulnerable time 2 t_F), slotted ALOHA (start only at slot boundaries, vulnerable t_F), CSMA (listen before talking, vulnerable tau_p) with 1-persistent, non-persistent and p-persistent variants, CSMA/CD (detects collisions while transmitting: needs t_F >= 2 tau_p, hence a minimum frame) and the Wi-Fi CSMA/CA (IFS, contention window with backoff, ACK, RTS/CTS and NAV). Controlled access: reservation, polling, token. Channelization: FDMA, TDMA, OFDMA, CDMA, SDMA.Multiple Access Protocols - ALOHA and CSMA →: IFS, contention window with backoff, ACK after SIFS, RTS/CTS and NAV). Three typical wireless problems remain.
1. Collision during the handshake. What if a collision occurs while RTS or CTS frames are in transit (handshake period)? Two or more stations may send the RTS together. Solution: since there is no collision detection, the sender assumes a collision if it does not receive the CTS from the receiver, and retries (with backoff).
2. Hidden terminal. Two or more stations (A and B) sense the channel idle only because they are not within communication range of each other; both transmit to station C and the two packets overlap at the receiver (A and B cannot notice each other's presence).
Example. A, C, B are in a row: A and B are both within range of C but not of each other. A senses the channel idle and starts transmitting to C; B, which does not hear A, senses the channel idle and starts too. The two frames collide at C.
Solution: RTS/CTS handshake. Even if A's RTS does not reach B (out of range), the CTS from C (the destination) reaches both A and B: B knows a transmission is under way and sets the NAV.
Grafico interattivo: Hidden terminal: A and B are both within range of C (distance 2 against range 2.5) but not of each other (distance 4 > 2.5), so they do not hear each other's transmissions and their frames overlap at C; the CTS from C reaches both
3. Exposed terminal. A station refrains from using a channel when it is actually free: station C hears the RTS from A and does not transmit, even though a communication between C and D could not cause collisions in the area between A and C. The behaviour is too conservative: capacity is wasted.
The 802.11 family
| Standard | Year | Frequency | Max bitrate | Max range |
|---|---|---|---|---|
| 802.11a | 1999 | 5 GHz | 54 Mbit/s | 400 ft (~120 m) |
| 802.11b | 1999 | 2.4 GHz | 11 Mbit/s | 450 ft |
| 802.11g | 2003 | 2.4 GHz | 54 Mbit/s | 450 ft |
| 802.11n | 2009 | 2.4 / 5 GHz | 600 Mbit/s | 825 ft |
| 802.11ac | 2014 | 5 GHz | 1 Gbit/s | 1000 ft |
| 802.11ac Wave 2 | 2015 | 5 GHz | 3.47 Gbit/s | 10 m |
| 802.11ad | 2016 | 60 GHz | 7 Gbit/s | 30 ft |
| 802.11af | 2014 | 2.4 / 5 GHz (TV white space) | 26.7 - 568.9 Mbit/s | 1000 m |
| 802.11ah | 2016 | below 1 GHz | 347 Mbit/s | 1000 m |
| 802.11ax | 2019 | 2.4 / 5 GHz | 10 Gbit/s | 1000 ft |
| 802.11ay | late 2019 | 60 GHz | 100 Gbit/s | 300-500 m |
(Ranges are given in feet or metres as in the course material; values are indicative and some standards were listed as "expected" in 2019-2021.) The bandwidths are: a MHz at GHz; b MHz at GHz; g and MHz at GHz; n and MHz at and GHz; ac from to MHz at GHz; ad GHz at GHz; af free TV spectrum; ah below GHz.
Ethernet and Wi-Fi compared
| Ethernet (802.3) | Wi-Fi (802.11) | |
|---|---|---|
| Medium | cable (copper, fibre) | radio |
| Medium access | CSMA/CD (full duplex with switch: no collisions) | CSMA/CA |
| Collision detection | yes, during transmission | no: avoided |
| Link-layer ACK | no | yes (stop-and-wait, after SIFS) |
| Bitrate | fixed by cable type | adapted to the SNR |
| Typical problems | minimum frame, collision domain | hidden and exposed terminal |
The most evident sign of the difference: in Ethernet errors on the cable are rare and reliability is left to the upper layers; on the radio channel losses are normal, so Wi-Fi has link-layer ACKs and retransmissions.
Versione ripasso
LAN and IEEE 802. LAN: limited area, usually connected to a WAN; of the many 1980s-90s LANs (Ethernet with CSMA/CD, Token Ring and Token Bus with tokens) only Ethernet survived because it kept upgrading. IEEE 802.x (ISO/IEC 8802.; "802" next free number, or February 1980): 802.1 architecture, DLL LLC MAC; 802.2 LLC; 802.3 Ethernet, 802.4 Token Bus, 802.5 Token Ring, 802.6 MAN, 802.11 Wi-Fi, 802.15 PAN: the MACs.
Ethernet. Metcalfe and Boggs, 1970s; DIX (Digital, Intel, Xerox) 1980-81; IEEE 802.3 in 1983 (minimal differences). Service: connectionless, no flow control (excess frames silently discarded, recovery by upper layers), no ACK (32-bit CRC; wrong CRC silent discard; no ARQ for bit errors), retransmission only after a collision (CSMA/CD).
Frame. Preamble 7 B (10101010..., bit sync) SFD 1 B (10101011, frame sync), added by the PHY; destination 6 B; source 6 B (unicast 0..., multicast 1..., broadcast all 1s); type/length 2 B (Ethernet: type, e.g. 0x0800 IPv4; 802.3: length, with the LLC frame inside; most significant bit , theoretical maximum ); data - B ( PAD up to ); CRC 4 B. Total - B ( B of header and trailer). Efficiency: at most, at least. At Mbit/s: ms (maximum), s (minimum).
- Why a maximum: no station monopolizes the bus, limited errors (little to retransmit), small buffers (memory was expensive in the 1980s).
- Why a minimum: not for overhead but for CSMA/CD.
1-persistent CSMA/CD. Collision if the received signal differs from the transmitted one; certainty after . . Example: m/s, m, Mbit/s: s, s, bit B; with repeaters and margin B ( bit). Collision: jam of bits (- in Ethernet); backoff with slot of s ( minimum frame at Mbit/s), after collisions in slots with ; stop after attempts. Example: - slots -s; from up to slots ms.
Generations.
- 10 Mbit/s (10Base-X: baseband, hundreds of metres or medium): 10Base5 coax m, 10Base2 m, 10Base-T UTP m, 10Base-F fibre m; Manchester coding.
- 100 Mbit/s: star with switch, full duplex no CSMA/CD; 100Base-TX (UTP/STP m, 4B5B+MLT-3), -FX (fibre m), -T4 (UTP, 4 wires).
- 1 Gbit/s: full duplex with switch and separate collision domains, no CSMA/CD; half duplex (hub, CSMA/CD, m, carrier extension, frame bursting) almost never used; 1000Base-SX m, -LX m, -CX m, -T m.
- 10 Gbit/s: fibre only; 10GBase-SR m, -LR km, -EW km.
- Why CSMA/CD disappears: with bit: , , , m at M, M, G, Gbit/s (theoretical limits). The hub is one collision domain, the switch separates them.
- BSS: stations AP (authentication and rights; offices, hot spots); without AP: ad hoc (cannot reach other BSSs). EBSS: several BSSs with a distribution system (wired or not); within a BSS stations in range talk without the AP, towards the outside the AP is needed.
- PHY: several bitrates, higher needs more SNR; automatic adaptation (proprietary schemes). Example dB: Mbit/s loss, , ; Mbit/s beats .
- Handshake collision: no CTS a collision is assumed and the sender retries.
- Hidden terminal: A and B do not hear each other, transmit to C and collide at C; C's CTS reaches both NAV.
- Exposed terminal: C hears A's RTS and refrains even if C-D would not disturb; too conservative.
- Family: a (, GHz, Mbit/s), b (, GHz), g (, ), n (, ), ac (, Gbit/s, GHz), ad/ay ( GHz), af/ah (long range, m), ax ( Gbit/s).
Comparison. Ethernet: cable, CSMA/CD (full duplex: no collisions), no link ACK, fixed bitrate. Wi-Fi: radio, CSMA/CA, stop-and-wait ACK after SIFS, bitrate adapted to the SNR.
- Typical mistakes: saying Ethernet has ACKs or flow control; believing the minimum frame reduces overhead (it serves collision detection); forgetting that a wrong CRC means silent discard; applying CSMA/CD to Wi-Fi.