The idea: a port that opens only after login

Anyone can walk into an office and plug a laptop into a wall socket. Without protection, that laptop gets an IP address and reaches the internal network at once. IEEE 802.1X (port-based network access control) closes the switch port until the device has logged in. The switch asks for credentials, passes them to a central RADIUS server, and opens the port only when the server says yes.

Left: the supplicant, alice-laptop. Middle: the authenticator, switch port Gi1/0/5, split into an uncontrolled port that passes only EAPOL and a controlled port that is closed. Right: the authentication server, RADIUS 10.0.0.10. EAP rides in EAPOL frames on the cable and in RADIUS Access-Request packets on UDP 1812.
The switch is a relay: EAP goes in EAPOL frames on the cable and inside RADIUS packets to the server.

There are three roles. The supplicant is the software on the device that logs in (for example wpa_supplicant). The authenticator is the switch: it controls the port. The authentication server is the RADIUS server: it holds the user database and decides. The switch is a RADIUS client and never checks a password itself.

The uncontrolled and the controlled port

802.1X splits one physical port into two logical halves.

  • The uncontrolled port always passes EAPOL frames (EAP over LAN, EtherType 0x888E), and nothing else. That is how the login itself gets through.
  • The controlled port passes all other traffic: DHCP, ARP, IP. It starts Unauthorized (closed) and becomes Authorized (open) only after an Access-Accept.

In Demo 1 the laptop is plugged in but has not logged in. Its DHCP Discover is dropped at the controlled port. No address, no ARP, no way in.

EAP inside EAPOL, EAP inside RADIUS

EAP (Extensible Authentication Protocol, RFC 3748) is a small request/response protocol: the server sends an EAP-Request, the device answers an EAP-Response, and the server ends with EAP-Success or EAP-Failure. Each EAP packet has an Identifier that pairs a response with its request. EAP itself does not say how to carry it, so 802.1X carries it twice:

  • on the cable, in EAPOL frames between the laptop and the switch;
  • on the network, in the EAP-Message attribute of RADIUS packets (RFC 3579) between the switch and the server, UDP port 1812.
A message ladder with three columns, laptop, switch and RADIUS server. EAPOL-Start; EAP-Request/Identity id 1; EAP-Response/Identity alice; Access-Request id 7; Access-Challenge id 7 with EAP-Request/MD5-Challenge; EAP-Request/MD5-Challenge id 2; EAP-Response/MD5-Challenge id 2; Access-Request id 8 with State; Access-Accept id 8 with EAP-Success and VLAN 10; EAP-Success; then the controlled port opens in VLAN 10.
Every EAP message crosses the switch twice: once in EAPOL, once in RADIUS. The switch only copies it.

The switch adds its own attributes to each Access-Request: User-Name, NAS-Port, Calling-Station-Id (the device's MAC address) and a Message-Authenticator, a keyed hash made with the secret the switch shares with the server. The server ignores requests from switches that do not know the secret.

The page uses the simplest EAP method, EAP-MD5-Challenge, because it needs only one round: the server sends a random challenge, and the laptop answers with a hash of the Identifier, the password and the challenge. The values on the canvas are toy values. Real networks use EAP-TLS (certificates on both sides) or PEAP (a password inside a TLS tunnel). Those take several Access-Challenge rounds, but the switch relays them in exactly the same way (Demo 2).

Accept, Challenge, Reject and the VLAN

RADIUS replyWhat it meansWhat the switch does
Access-Challenge"one more round": it carries the next EAP-Request and a State attributerelays the EAP-Request to the laptop in EAPOL
Access-Acceptlogged in; carries EAP-Success and optional authorization attributesrelays EAP-Success, opens the controlled port, sets the VLAN
Access-Rejectnot logged in; carries EAP-Failurerelays EAP-Failure, keeps the port closed, waits quiet-period (60 s)

A reply always carries the Identifier of the request it answers: Access-Request id 8 gets Access-Accept id 8. The Accept can also say where the device goes. Three attributes from RFC 3580 do it: Tunnel-Type = VLAN (13), Tunnel-Medium-Type = IEEE-802 (6) and Tunnel-Private-Group-ID = 10. The switch makes the port an access port in VLAN 10. This is dynamic VLAN assignment: the VLAN follows the user, not the socket. alice lands in the staff VLAN wherever she plugs in, a printer lands in the printers VLAN.

In Demo 3 the password is wrong. The server's own computation gives 7b1e09aa, the laptop sent c04d5e11, so the answer is Access-Reject. The port stays closed, and the switch does not try again for quiet-period (60 s), which slows down guessing. In Demo 4 the switch has an on-reject policy: a rejected device is put in a restricted VLAN (VLAN 30, internet only). The server still said no; it is the switch that decides to give the device a fenced corner rather than nothing.

No supplicant: timeouts and MAB

Printers, cameras and badge readers often have no 802.1X supplicant. They never answer EAPOL. The switch sends EAP-Request/Identity, waits tx-period (30 s), tries again, and gives up after 1 + max-reauth-req (2) = 3 tries, at t = 90 s.

Then it falls back to MAB (MAC Authentication Bypass). The switch has seen the device's MAC address in the frames it dropped, and sends an Access-Request whose User-Name is that MAC, with no EAP inside. If the MAC is on the server's list, the answer is Access-Accept, here for VLAN 20 (Demo 5). A MAC address is not a secret: anyone can copy it. So MAB devices should only get a narrow VLAN that reaches what they need.

Accounting

RADIUS also keeps a record. When the port opens, the switch sends an Accounting-Request with Acct-Status-Type = Start to UDP 1813 (RFC 2866); the server answers Accounting-Response. When the link goes down, a Stop follows with Acct-Session-Time and Acct-Terminate-Cause = Lost-Carrier. In Demo 6 alice works for 3600 s and pulls the cable: the Stop says 3600, and the port is closed again, so the next device must log in on its own.

Why it helps, and where it stops

  • An unknown device gets nothing: not even a DHCP address.
  • Users and devices are managed in one place. Disabling an account closes every port it could use.
  • The VLAN comes from the server, so policy follows the identity.
  • It checks who connects, not what they do afterwards: firewalls between VLANs still matter.
  • Weak spots: MAB (copyable MACs), EAP methods without server certificate checks, and a hub or switch placed behind an authorized port (stricter host modes limit how many MACs a port accepts).

See also VLANs: One Switch, Several Networks for access ports and 802.1Q tags, How Ethernet Switches Forward Frames for what the switch does once the port is open, How a Device Gets an IP Address for the Discover that the closed port drops, TLS Certificate Chain and Revocation for what EAP-TLS checks, and How Kerberos Works for another way a central server vouches for a user.

See also Rapid Spanning Tree vs Classic STP for how switch ports decide whether to forward once loops are taken into account.

What the page leaves out

  • The inside of EAP-TLS, PEAP and EAP-TTLS (the TLS handshake and its many Access-Challenge rounds), and the keys they derive. EAP-MD5 is shown only because it is short; it has no mutual authentication and should not be used.
  • Wi-Fi: WPA2/WPA3-Enterprise uses the same 802.1X and RADIUS exchange, then derives encryption keys from it.
  • MACsec (802.1AE) encryption of the wired link after login.
  • Reauthentication timers, RADIUS server timeouts and failover, critical VLANs when no server answers, Change of Authorization (RFC 5176), and downloadable ACLs.
  • Multi-host and multi-auth host modes, phones on a voice VLAN, and vendors' counts of failures before a restricted VLAN; vendors also differ in what they tell the supplicant there.

On the mind map

Open the Networking mind mapNetworkingLayers & links: frames on one local networkLayers & linksIP & routing: packets hop between networksIP & routingCore services: address, name and timeCore servicesTCP, UDP & sockets: end to end between two portsTCP, UDP & socketsHTTP & TLS: what a browser does per requestHTTP & TLSAPIs & push: how apps talk to serversAPIs & pushProxies & edge: boxes in the middle of the pathProxies & edgeContainers: virtual networks from Linux partsContainersReal-time media: voice and video over UDPReal-time mediaSecurity at the edge: filter traffic at the borderSecurity at the edgeProtocol layersProtocol layerseach layer wraps the one above in a headerHub vs switch vs routerHub vs switch vs routerL1 repeats, L2 learns MACs, L3 routes IPIGMP multicastIGMP multicastsnooping sends a group only to membersRapid Spanning TreeRapid Spanning TreeAlternate port takes over at onceLACP Link AggregationLACP Link AggregationOne flow rides one link, never moreVLANsVLANs802.1Q tag splits one switch into LANs802.1X and RADIUSPort stays closed until Access-AcceptARPARPbroadcast who-has IP, reply with the MACCRCCRCXOR division remainder catches bit errorsInternet ChecksumInternet ChecksumSum + NOT sum = 0xFFFF; blind to swapsWi-Fi CSMA/CAWi-Fi CSMA/CAlisten, random backoff, wait for the ACKBluetooth LE and GATTBluetooth LE and GATTWrite CCCD 0x0001, then values get pushedALOHA and CSMA/CDALOHA and CSMA/CDFrame must last 2τ to hear a collisionLoRaWAN class ALoRaWAN class ASend any time, listen only at RX1/RX2Cellular Reuse and HandoverCellular Reuse and HandoverMargin + timer: no ping-pong, no dropDigital modulation (QAM)Digital modulation (QAM)More bits per symbol needs more SNROpen the Networking mind mapNetworkingframes on one local networkLayers & linksProtocol layersProtocol layerseach layer wraps the one above in a headerHub vs switch vs routerHub vs switch vs routerL1 repeats, L2 learns MACs, L3 routes IPIGMP multicastIGMP multicastsnooping sends a group only to membersRapid Spanning TreeRapid Spanning TreeAlternate port takes over at onceLACP Link AggregationLACP Link AggregationOne flow rides one link, never moreVLANsVLANs802.1Q tag splits one switch into LANs802.1X and RADIUSPort stays closed until Access-AcceptARPARPbroadcast who-has IP, reply with the MACCRCCRCXOR division remainder catches bit errorsInternet ChecksumInternet ChecksumSum + NOT sum = 0xFFFF; blind to swapsWi-Fi CSMA/CAWi-Fi CSMA/CAlisten, random backoff, wait for the ACKBluetooth LE and GATTBluetooth LE and GATTWrite CCCD 0x0001, then values get pushedALOHA and CSMA/CDALOHA and CSMA/CDFrame must last 2τ to hear a collisionLoRaWAN class ALoRaWAN class ASend any time, listen only at RX1/RX2Cellular Reuse and HandoverCellular Reuse and HandoverMargin + timer: no ping-pong, no dropDigital modulation (QAM)Digital modulation (QAM)More bits per symbol needs more SNR
This page on the Networking mind map · 83 pages in 10 branches · open it to see the whole map and test yourself in recall mode.