LAN and WAN Protocols

Ethernet (IEEE 802.3)

Ethernet is the most widely deployed LAN technology. It was developed jointly by Xerox, Intel, and DEC in 1975 and later standardized by the IEEE 802.3 committee.

MAC Addresses

MAC Address

A MAC address (Media Access Control Address) is the physical address used by the data link layer to uniquely identify a network interface within a LAN. A MAC address is 48 bits (6 bytes) long and is usually written as 12 hexadecimal digits, for example 00:1A:2B:3C:4D:5E.

The structure of a MAC address:

  • First 24 bits (OUI, Organizationally Unique Identifier): the vendor code assigned by the IEEE to equipment manufacturers
  • Last 24 bits: the device serial number assigned by the vendor

Special MAC addresses:

  • Broadcast address: FF:FF:FF:FF:FF:FF, meaning all stations in the LAN
  • Multicast address: the lowest bit of the first byte is 1, meaning a group of stations
  • Unicast address: the lowest bit of the first byte is 0, meaning a single station

The Ethernet Frame (Ethernet II Format)

Ethernet Frame (Ethernet II) Structure

Preamble7 bytes
SFD1 byte
Destination MAC6 bytes
Source MAC6 bytes
Type/Length2 bytes
Data Payload46~1500 bytes
FCS4 bytes

Ethernet frame: the preamble synchronizes the clock, the SFD marks the start of the frame, and the FCS is a CRC check

The fields are:

  1. Preamble: 7 bytes of alternating 0 and 1 bits (10101010), used by the receiver to synchronize its clock
  2. Start Frame Delimiter (SFD): 1 byte, 10101011, marking the start of the frame
  3. Destination MAC address: 6 bytes, the physical address of the receiver
  4. Source MAC address: 6 bytes, the physical address of the sender
  5. Type/Length field: 2 bytes
    • a value ≥ 1536 (0x0600) indicates a type (for example 0x0800 for IPv4, 0x0806 for ARP, 0x86DD for IPv6)
    • a value ≤ 1500 indicates a length (the original 802.3 format)
  6. Data field: 46 to 1500 bytes. Padding is required when the data is shorter than 46 bytes, because the minimum Ethernet frame length is 64 bytes (14 bytes of header + 46 bytes of data + 4 bytes of FCS)
  7. FCS (Frame Check Sequence): 4 bytes, a CRC-32 check used for error detection

The Evolution of Ethernet

StandardSpeedMediumName origin
10BASE510 MbpsThick coaxial cableMaximum segment length 500 m
10BASE210 MbpsThin coaxial cableMaximum segment length about 200 m (185 m in practice)
10BASE-T10 MbpsTwisted pairT = Twisted Pair
100BASE-TX100 MbpsCategory 5 twisted pairFast Ethernet
1000BASE-T1 GbpsCategory 5e twisted pairGigabit Ethernet
10GBASE-T10 GbpsCategory 6a twisted pair10 Gigabit Ethernet

Modern Ethernet uses switches and twisted pair (or fiber) almost exclusively, runs in full-duplex mode, and no longer uses CSMA/CD.

Virtual LANs (VLAN)

A VLAN (Virtual LAN) logically divides a physical LAN into several independent broadcast domains through switch configuration.

  • Purpose: isolate broadcast domains and improve network security and performance
  • Implementation: insert a 4-byte VLAN tag (the 802.1Q tag) into the Ethernet frame, carrying a VLAN ID (12 bits, 0 to 4095)
  • Trunk port: a port connecting two switches, carrying frames with VLAN tags
  • Access port: a port connecting an end device, belonging to a single VLAN and carrying untagged frames

Wireless LANs (IEEE 802.11)

A wireless LAN (WLAN) uses radio waves as its transmission medium. The most common standards are the IEEE 802.11 family (marketed as Wi-Fi).

The Evolution of the 802.11 Standards

StandardYearBandMaximum rateNotes
802.1119972.4 GHz2 MbpsThe original standard
802.11b19992.4 GHz11 MbpsThe first widely used standard
802.11a19995 GHz54 MbpsNot compatible with b
802.11g20032.4 GHz54 MbpsBackward compatible with b
802.11n (Wi-Fi 4)20092.4/5 GHz600 MbpsMIMO technology
802.11ac (Wi-Fi 5)20145 GHz3.5 GbpsWider channels, more MIMO
802.11ax (Wi-Fi 6)20192.4/5 GHz9.6 GbpsOFDMA, higher density

The 802.11 Frame

An 802.11 frame is more complex than an Ethernet frame and contains up to four address fields, because the wireless environment requires distinguishing the transmitter, the receiver, the source, and the destination:

802.11 Frame Structure

Frame Control2 bytes
Duration/ID2 bytes
Address 16 bytes
Address 26 bytes
Address 36 bytes
Sequence Control2 bytes
Address 46 bytes
DataVariable
FCS4 bytes

An 802.11 frame carries up to four address fields to distinguish the receiver, the transmitter, the source, and the destination in a wireless environment

  • Address 1: the receiver address (RA, Receiver Address)
  • Address 2: the transmitter address (TA, Transmitter Address)
  • Address 3: the source address (SA) or the destination address (DA), depending on the frame type
  • Address 4: used only in a Wireless Distribution System (WDS)

Operating Modes

  1. Infrastructure mode: all stations communicate through an AP (Access Point), which connects to the wired network. This is the most common mode.
  2. Ad Hoc mode: stations communicate directly with each other without an AP. Also called an IBSS (Independent BSS).

Wi-Fi Security

  • WEP (Wired Equivalent Privacy): the earliest encryption standard, based on RC4. It has been broken and is not secure.
  • WPA (Wi-Fi Protected Access): an improved version of WEP using TKIP encryption
  • WPA2: the current mainstream standard, using AES encryption (CCMP), with strong security
  • WPA3: the newest standard, further strengthening security and supporting 192-bit encryption

Wide Area Network Protocols

The PPP Protocol

PPP is a data link layer protocol that carries network layer data over point-to-point links. It is widely used for dial-up access, DSL, and leased lines.

The PPP Protocol

PPP is a byte-oriented data link layer protocol that transfers data over a point-to-point link between two nodes. It supports multiple network layer protocols (IP, IPX, and so on) and provides authentication, compression, and error detection.

The PPP Frame

PPP Frame Structure

Flag1 byte
Address1 byte
Control1 byte
Protocol2 bytes
DataVariable
FCS2 bytes
Flag1 byte

PPP frame: the flag field is 0x7E, and the protocol field indicates the payload type (for example 0x0021 = IPv4)

  • Flag field: 0x7E, the frame delimiter (the same as HDLC)
  • Address field: 0xFF, the broadcast address (PPP is point-to-point, so it has no real meaning)
  • Control field: 0x03, an unnumbered frame (UI)
  • Protocol field: indicates the protocol type of the data field (for example 0x0021 = IPv4, 0xC021 = LCP, 0x8021 = IPCP)
  • FCS: usually 2 bytes (it can also be negotiated as 4 bytes), a CRC check

The PPP Phases

Establishing and maintaining a PPP link goes through four phases:

  1. Link establishment: LCP (Link Control Protocol) negotiates link parameters such as the maximum receive unit (MRU), the authentication protocol, and the compression protocol
  2. Authentication (optional): PAP (Password Authentication Protocol) or CHAP (Challenge Handshake Authentication Protocol) performs the authentication
    • PAP: a two-way handshake that sends the password in clear text, so it is weak
    • CHAP: a three-way handshake that uses an MD5 hash and never transmits the password in clear text, so it is strong
  3. Network layer protocol: NCP (Network Control Protocol) configures parameters for each network layer protocol. IPCP (IP Control Protocol), for example, assigns IP addresses.
  4. Data transfer: network layer data is transferred normally
  5. Link termination: LCP terminates the link

The HDLC Protocol

HDLC is a bit-oriented data link layer protocol standardized by the ISO, and it is the basis for many other link layer protocols such as PPP, LAPB, and LAPD.

The HDLC Frame

HDLC Frame Structure

Flag1 byte
Address1 byte
Control1 byte
InfoVariable
FCS2 bytes
Flag1 byte

HDLC frame: the flag field is 0x7E (01111110), and bit stuffing keeps that pattern out of the data

  • Flag field: 0x7E (01111110), with bit stuffing guaranteeing that the pattern never appears in the data
  • Address field: identifies the secondary station (in multipoint connections); usually 0xFF in point-to-point links
  • Control field: identifies the frame type and the sequence numbers
  • FCS: 2 or 4 bytes, a CRC check

HDLC Frame Types

According to the format of the control field, HDLC frames fall into three categories:

  1. Information frames (I-frame, Information): the first bit of the control field is 0

    • carry user data
    • contain the send sequence number N(S) and the receive sequence number N(R)
    • can piggyback an acknowledgment (N(R) indicates the sequence number of the next frame expected)
  2. Supervisory frames (S-frame): the first two bits of the control field are 10

    • carry no data and are used for flow control and error control
    • four types: RR (receive ready, ACK), RNR (receive not ready), REJ (reject, GBN), SREJ (selective reject, SR)
  3. Unnumbered frames (U-frame): the first two bits of the control field are 11

    • contain no sequence numbers and are used for link management
    • such as SABM (set asynchronous balanced mode), UA (unnumbered acknowledgment), and DISC (disconnect)

HDLC Operating Modes

  • Normal Response Mode (NRM): a master/slave mode in which a secondary station may transmit only after being polled by the primary
  • Asynchronous Response Mode (ARM): a secondary station may transmit on its own initiative, but the primary still manages the link
  • Asynchronous Balanced Mode (ABM): a peer mode in which the two stations have equal standing and either may initiate a transmission. PPP uses a mode similar to ABM.

Bridge

  • Operates at the data link layer and forwards frames based on MAC addresses
  • Usually has only 2 ports, used to connect two LAN segments
  • Learns the MAC address table automatically and isolates collision domains
  • Uses store-and-forward, so it forwards more slowly

Switch

  • Operates at the data link layer (a layer 2 switch) and is essentially a multi-port bridge
  • Forwards frames based on MAC addresses, and each port is an independent collision domain
  • Supports both store-and-forward and cut-through forwarding
  • Supports advanced features such as VLANs, QoS, and port aggregation
  • Is the core device of a modern LAN

Worked Examples

Example 1: Ethernet Frame Padding

The data field of an Ethernet frame is only 20 bytes. How many bytes of padding are needed, and what is the total length of the frame?

EthernetFrame StructureMinimum Frame LengthPadding

Approach: compare the data field against the 46-byte minimum and add up header, data (with padding), and FCS.

Steps:

  1. The Ethernet data field must be at least 46 bytes (so that the minimum frame length is 64 bytes)
  2. The data is currently 20 bytes, so the padding needed is: 46−20=2646 - 20 = 26 bytes
  3. The Ethernet frame header (destination MAC + source MAC + type) = 6+6+2 = 14 bytes
  4. FCS = 4 bytes
  5. Total length = 14 (header) + 46 (data plus padding) + 4 (FCS) = 64 bytes

Note that the preamble (7 bytes) and the SFD (1 byte) are normally not counted in the frame length.

Answer: 26 bytes of padding are needed and the total frame length is 64 bytes (the minimum frame length).

Example 2: Analyzing the PPP Protocol

During the establishment of a PPP link, what is LCP responsible for and what is NCP responsible for? If a PPP connection carries only IPv4 data, which protocols are involved?

PPPLCPNCPIPCPLink Establishment

Approach: separate the responsibilities of LCP and NCP, then list the protocols needed for an IPv4-only connection.

Steps:

  1. LCP (Link Control Protocol) is responsible for data link layer parameter negotiation and link management, including:

    • maximum receive unit (MRU) negotiation
    • authentication protocol negotiation (PAP/CHAP)
    • compression protocol negotiation
    • link quality monitoring
    • link establishment and termination
  2. NCP (Network Control Protocol) is responsible for configuring network layer parameters, with one NCP per network layer protocol:

    • IPCP (IP Control Protocol): configures the IP address, DNS, and so on
    • IPXCP: configures the IPX protocol
    • IPv6CP: configures IPv6
  3. If only IPv4 is carried, the protocols needed are:

    • LCP: link layer parameter negotiation
    • an authentication protocol (optional): PAP or CHAP
    • IPCP: IP address assignment and configuration
    • IPv4: data transmission

Answer: LCP handles link layer parameter negotiation and NCP handles network layer parameter configuration. An IPv4-only connection needs LCP, an optional authentication protocol, IPCP, and IPv4.

Example 3: MAC Addresses and Broadcast

The destination MAC address of an Ethernet frame is FF:FF:FF:FF:FF:FF. What kind of address is this, and which stations receive the frame?

MAC AddressBroadcast AddressEthernetBroadcast Domain

Approach: identify the address pattern, then trace how the frame propagates in shared and switched Ethernet.

Steps:

  1. FF:FF:FF:FF:FF:FF is the broadcast address (all bits set to 1).
  2. A broadcast frame is received and processed by every station in the same broadcast domain.
  3. In traditional shared Ethernet (connected through hubs), all stations are in the same broadcast domain and the same collision domain.
  4. In switched Ethernet, the switch floods the broadcast frame out of every port except the one it arrived on, so every station attached to the same switch (or the same VLAN) receives it.
  5. Routers do not forward broadcast frames (a router isolates broadcast domains), so a broadcast never crosses a network segment boundary.

Answer: this is the broadcast address, and it is received by every station in the same broadcast domain. Because routers do not forward broadcast frames, broadcast traffic stays local to the segment.


Exercises

Exercise 1

Compare the PPP and HDLC protocols.

PPPHDLCProtocol ComparisonData Link Layer

Approach: list the shared properties first, then the seven points on which the two protocols differ.

Steps:

Shared properties:

  1. Both are data link layer protocols and both support point-to-point connections
  2. Both use 0x7E as the frame delimiter and use bit stuffing (PPP in asynchronous mode also supports character stuffing)
  3. Both provide error detection (FCS/CRC)
  4. Both have similar frame structures (flag, address, control, data, FCS)

Differences:

  1. Orientation: PPP is byte-oriented, HDLC is bit-oriented
  2. Complexity: PPP is simple and flexible, HDLC is more capable but more complex
  3. Connection types: PPP mainly supports point-to-point, HDLC supports both point-to-point and multipoint
  4. Authentication: PPP supports PAP/CHAP authentication, HDLC does not
  5. Multi-protocol support: PPP supports multiple network layer protocols through NCP, HDLC is independent of the network layer protocol
  6. Sequence numbers: HDLC has a complete sequence number and acknowledgment mechanism (I-frames and S-frames), whereas PPP provides no reliable transmission by default (a reliable transmission mode is optional)
  7. Applications: PPP is used for dial-up, DSL, and leased lines; HDLC was used in early leased-line networks and in the serial links of Cisco routers (Cisco HDLC)

Answer: both are data link layer protocols with similar framing and error detection, but PPP is byte-oriented, simpler, and adds authentication and NCP-based multi-protocol support, while HDLC is bit-oriented, more complex, and provides full sequence number and acknowledgment mechanisms.

Exercise 2

What are the main differences between an Ethernet switch and a hub, and why did the switch replace the hub?

SwitchHubCollision DomainFull DuplexLAN

Approach: compare the two devices on six properties, then list the five reasons the switch took over.

Steps:

Main differences:

  1. Layer: a hub operates at the physical layer, a switch operates at the data link layer
  2. Collision domains: all ports of a hub share one collision domain, while each port of a switch is an independent collision domain
  3. Duplex: a hub is half-duplex only, a switch supports full duplex
  4. Forwarding: a hub broadcasts the signal to all ports, while a switch forwards to the specific port found in its MAC address table
  5. Bandwidth: all ports of a hub share the total bandwidth, while each port of a switch has its own bandwidth
  6. Features: a hub only amplifies and repeats the signal, while a switch supports MAC address learning, VLANs, QoS, and so on

Why the switch replaced the hub:

  1. Higher performance: full duplex, independent collision domains, and parallel transmission greatly increase network throughput
  2. Fewer collisions: each port is an independent collision domain, which avoids the collision overhead of CSMA/CD
  3. Better security: unicast frames are forwarded only to the destination port, so other ports cannot eavesdrop
  4. Richer features: VLANs isolate broadcast domains, QoS provides priority, and port aggregation is supported
  5. Lower cost: as the technology matured, switch prices fell to an acceptable level

Answer: a switch forwards at layer 2 with per-port bandwidth and full duplex, while a hub simply repeats a layer 1 signal to every port sharing one collision domain; the switch’s throughput, isolation, and feature set made the hub obsolete.


Glossary

TermAbbreviationExplanation
Media Access Control AddressMACA 48-bit physical address
Ethernet-The most widely deployed LAN technology
Frame Check SequenceFCSThe CRC check field of a frame
Maximum Transmission UnitMTUThe maximum length of the data field
Virtual LANVLANA logical division of broadcast domains
Access PointAPThe central device of a wireless LAN
Point-to-Point ProtocolPPPA point-to-point link layer protocol
Link Control ProtocolLCPPPP link parameter negotiation
Network Control ProtocolNCPPPP network layer parameter negotiation
Challenge Handshake Auth ProtocolCHAPSecure authentication in PPP
High-level Data Link ControlHDLCA bit-oriented link layer protocol
Service Set IdentifierSSIDThe name of a Wi-Fi network
CSMA with Collision AvoidanceCSMA/CAThe MAC protocol of wireless LANs
Bridge-A two-port layer 2 forwarding device
Switch-A multi-port layer 2 forwarding device
Hub-A physical layer shared device
Preamble-The synchronization field of an Ethernet frame
Start Frame DelimiterSFDThe start-of-frame marker of an Ethernet frame

Found an issue with this content?

Tell us what could be improved.