Dot1X (802.1X) Port-Based Network Access Control: A Complete Guide
Dot1X (802.1X) Port-Based Network Access Control: A Complete Guide
Section titled âDot1X (802.1X) Port-Based Network Access Control: A Complete GuideâRouterOS Version: 7.x+ Difficulty: Intermediate Estimated Time: 45 minutes
Overview
Section titled âOverviewâDot1X implements the IEEE 802.1X standard for port-based network access control. Before a device can send any traffic through a port, it must authenticate. This creates a powerful security boundaryâno authentication means no network access.
The system involves three components:
- Supplicant (Client): The device requesting network access
- Authenticator (Server): The MikroTik switch/router controlling port access
- Authentication Server: A RADIUS server that validates credentials
RouterOS can function as both a supplicant (connecting to protected networks) and an authenticator (protecting your network). With User Manager installed, RouterOS can also serve as the RADIUS authentication server, creating a complete solution.
Limitation: Dot1X is not supported on SMIPS devices (hAP lite, hAP lite TC, hAP mini).
How 802.1X Works: The Authentication Dance
Section titled âHow 802.1X Works: The Authentication Danceââââââââââââââââ âââââââââââââââââââ ââââââââââââââââââââ Supplicant â â Authenticator â â RADIUS Server ââ (Client) ââââââśâ (MikroTik) ââââââśâ (FreeRADIUS/ ââ â â â â User Manager) ââââââââââââââââ âââââââââââââââââââ âââââââââââââââââââ â â â â 1. EAPOL-Start â â âââââââââââââââââââââââśâ â â â â â 2. EAP-Request/ â â â Identity â â ââââââââââââââââââââââââ â â â â â 3. EAP-Response/ â â â Identity â â âââââââââââââââââââââââśâ â â â 4. Access-Request â â ââââââââââââââââââââââââśâ â â â â ... EAP method exchange ... â â â â â â 5. Access-Accept â â âââââââââââââââââââââââââ â 6. EAP-Success â â ââââââââââââââââââââââââ â â â â â Port is now open for traffic âKey insight: Until authentication succeeds, the port blocks ALL traffic except EAPOL (EAP over LAN) authentication packets. This means a malicious device canât even get an IP address via DHCP before proving its identity.
Supported EAP Methods
Section titled âSupported EAP Methodsâ| Method | Description | Certificate Required |
|---|---|---|
| EAP-TLS | Certificate-based mutual authentication | Yes (client + server) |
| EAP-TTLS | Tunneled authentication, flexible inner methods | Server only |
| EAP-MSCHAPv2 | Microsoft challenge-response, password-based | No |
| PEAPv0/EAP-MSCHAPv2 | Protected EAP with MSCHAPv2 inner method | Server only |
Recommendation: For enterprise deployments, use EAP-TLS for highest security. For simpler setups, PEAP with MSCHAPv2 provides good security with password-based authentication.
Server Configuration (Authenticator)
Section titled âServer Configuration (Authenticator)âMenu Path
Section titled âMenu Pathâ/interface dot1x server
Server Properties
Section titled âServer Propertiesâ| Property | Type | Default | Description |
|---|---|---|---|
interface | interface name | - | Interface to protect with 802.1X |
auth-types | dot1x, mac-auth | dot1x | Authentication method(s) |
auth-timeout | time | 1m | Total time allowed for authentication |
retrans-timeout | time | 30s | EAP retransmission interval |
reauth-timeout | time | - | Periodic re-authentication interval |
accounting | yes/no | yes | Send RADIUS accounting requests |
interim-update | time | - | RADIUS Interim-Update interval |
guest-vlan-id | integer | - | VLAN for devices without 802.1X support |
reject-vlan-id | integer | - | VLAN for failed authentication |
server-fail-vlan-id | integer | - | VLAN when RADIUS server unreachable |
mac-auth-mode | mac-as-username, mac-as-username-and-password | - | How MAC address is sent to RADIUS |
disabled | yes/no | no | Enable/disable server |
comment | string | - | Descriptive comment |
VLAN Assignment Options
Section titled âVLAN Assignment Optionsâ| VLAN Property | When Used |
|---|---|
guest-vlan-id | Device doesnât support 802.1X (no EAPOL response) |
reject-vlan-id | Authentication explicitly rejected by RADIUS |
server-fail-vlan-id | RADIUS server unreachable |
| Dynamic (RADIUS) | Successful authentication with VLAN attributes |
Client Configuration (Supplicant)
Section titled âClient Configuration (Supplicant)âMenu Path
Section titled âMenu Pathâ/interface dot1x client
Client Properties
Section titled âClient Propertiesâ| Property | Type | Default | Description |
|---|---|---|---|
interface | interface name | - | Interface to authenticate on |
eap-methods | list | eap-tls | Ordered list of authentication methods |
identity | string | - | Username/identity for authentication |
password | string | - | Password for authentication |
anon-identity | string | - | Outer identity for tunneled methods (TTLS/PEAP) |
client-certificate | certificate name | - | Certificate from /system certificates (for EAP-TLS) |
disabled | yes/no | no | Enable/disable client |
comment | string | - | Descriptive comment |
Client Status Values
Section titled âClient Status Valuesâ| Status | Meaning |
|---|---|
authenticated | Successfully authenticated, port open |
authenticating | Authentication in progress |
connecting | Attempting to connect |
rejected | Authentication rejected by server |
error | Authentication error occurred |
disabled | Client is disabled |
RADIUS Server Configuration
Section titled âRADIUS Server ConfigurationâBasic RADIUS Client Setup
Section titled âBasic RADIUS Client Setupâ/radius add address=10.1.2.3 secret=radiussecret service=dot1xRADIUS Properties for Dot1X
Section titled âRADIUS Properties for Dot1Xâ| Property | Description |
|---|---|
address | RADIUS server IP address |
secret | Shared secret (must match RADIUS server) |
service | Must include dot1x |
authentication-port | Default 1812 |
accounting-port | Default 1813 |
timeout | Request timeout |
domain | Domain suffix (leave empty if issues occur) |
Supported RADIUS Attributes
Section titled âSupported RADIUS Attributesâ| Attribute | Purpose |
|---|---|
Tunnel-Type | Must be VLAN (13) |
Tunnel-Medium-Type | Must be IEEE-802 (6) |
Tunnel-Private-Group-ID | VLAN ID to assign |
Mikrotik-Switching-Filter | Dynamic ACL rules |
Configuration Examples
Section titled âConfiguration ExamplesâExample 1: Basic Dot1X Server with RADIUS
Section titled âExample 1: Basic Dot1X Server with RADIUSâProtect switch ports using external RADIUS server:
Step 1: Configure RADIUS client
/radius add address=192.168.1.10 secret=MyRadiusSecret service=dot1xStep 2: Enable Dot1X on interface
/interface dot1x server add interface=ether2 comment="Protected Port"Step 3: Verify configuration
/interface dot1x server print/interface dot1x server active printExample 2: Dot1X with Guest VLAN
Section titled âExample 2: Dot1X with Guest VLANâAllow unauthenticated devices into a restricted guest network:
Step 1: Create bridge with VLAN filtering
/interface bridge add name=bridge1 vlan-filtering=yes/interface bridge port add bridge=bridge1 interface=ether2 pvid=100/interface bridge port add bridge=bridge1 interface=ether3 pvid=100/interface bridge vlan add bridge=bridge1 vlan-ids=100 tagged=bridge1 untagged=ether2,ether3/interface bridge vlan add bridge=bridge1 vlan-ids=999 tagged=bridge1 comment="Guest VLAN"Step 2: Configure RADIUS
/radius add address=192.168.1.10 secret=MyRadiusSecret service=dot1xStep 3: Enable Dot1X with guest VLAN
/interface dot1x server add interface=ether2 guest-vlan-id=999 \ reject-vlan-id=999 server-fail-vlan-id=999Now devices without 802.1X support land in VLAN 999 (guest network).
Example 3: Dot1X with Dynamic VLAN Assignment
Section titled âExample 3: Dot1X with Dynamic VLAN AssignmentâLet RADIUS server assign VLANs based on user credentials:
Step 1: Configure bridge with multiple VLANs
/interface bridge add name=bridge1 vlan-filtering=yes/interface bridge port add bridge=bridge1 interface=ether2 pvid=1/interface bridge port add bridge=bridge1 interface=ether-uplink pvid=1/interface bridge vlan add bridge=bridge1 vlan-ids=10 tagged=bridge1,ether-uplink comment="Staff VLAN"/interface bridge vlan add bridge=bridge1 vlan-ids=20 tagged=bridge1,ether-uplink comment="Guest VLAN"/interface bridge vlan add bridge=bridge1 vlan-ids=30 tagged=bridge1,ether-uplink comment="IoT VLAN"Step 2: Configure RADIUS (on FreeRADIUS server)
# users filestaffuser Cleartext-Password := "password" Tunnel-Type = VLAN, Tunnel-Medium-Type = IEEE-802, Tunnel-Private-Group-ID = 10
guestuser Cleartext-Password := "guestpass" Tunnel-Type = VLAN, Tunnel-Medium-Type = IEEE-802, Tunnel-Private-Group-ID = 20Step 3: Enable Dot1X on MikroTik
/radius add address=192.168.1.10 secret=MyRadiusSecret service=dot1x/interface dot1x server add interface=ether2When staffuser authenticates, theyâre placed in VLAN 10. When guestuser authenticates, theyâre placed in VLAN 20.
Example 4: MAC Authentication Bypass
Section titled âExample 4: MAC Authentication BypassâAllow devices without 802.1X capability (printers, IoT) via MAC authentication:
Step 1: Configure RADIUS with MAC entries
# FreeRADIUS users file (MAC as username, lowercase with colons)00:11:22:33:44:55 Cleartext-Password := "00:11:22:33:44:55" Tunnel-Type = VLAN, Tunnel-Medium-Type = IEEE-802, Tunnel-Private-Group-ID = 30Step 2: Enable Dot1X with MAC auth fallback
/interface dot1x server add interface=ether2 auth-types=dot1x,mac-auth \ mac-auth-mode=mac-as-username-and-passwordDevices first attempt 802.1X. If no response (no supplicant), MAC authentication is tried.
Example 5: Dot1X Client (Router as Supplicant)
Section titled âExample 5: Dot1X Client (Router as Supplicant)âConnect MikroTik to an 802.1X protected network:
Using EAP-PEAP/MSCHAPv2:
/interface dot1x client add interface=ether1 \ eap-methods=eap-peap identity=router01 password=MyPasswordUsing EAP-TLS (certificate-based):
# First import certificates/certificate import file-name=client.crt passphrase=""/certificate import file-name=client.key passphrase=""
# Configure client/interface dot1x client add interface=ether1 \ eap-methods=eap-tls identity=router01 client-certificate=client.crt_0Example 6: Re-authentication and Accounting
Section titled âExample 6: Re-authentication and AccountingâEnable periodic re-authentication and RADIUS accounting:
/interface dot1x server add interface=ether2 \ reauth-timeout=1h \ accounting=yes \ interim-update=5mThis re-authenticates clients every hour and sends accounting updates every 5 minutes.
Monitoring and Verification
Section titled âMonitoring and VerificationâView Active Sessions
Section titled âView Active Sessionsâ/interface dot1x server active printOutput shows:
client-mac: Authenticated device MACusername: Identity used for authenticationsession-id: Unique session identifierauth-info: EAP method usedvlan-id: Assigned VLAN (if dynamic)
View Server State
Section titled âView Server Stateâ/interface dot1x server state printStatus values:
authorized: Client authenticated successfullyun-authorized: No authenticated clientrejected-holding: Client rejected, in hold periodiface-down: Interface is down
View Client Status
Section titled âView Client Statusâ/interface dot1x client printCheck status field for current authentication state.
Debug Logging
Section titled âDebug Loggingâ/system logging add topics=dot1x,radius,debug action=memory/log print where topics~"dot1x"Common Problems and Solutions
Section titled âCommon Problems and SolutionsâProblem 1: âNo RADIUS server foundâ
Section titled âProblem 1: âNo RADIUS server foundââSymptoms: Log shows radius,debug no radius server found followed by timeout.
Causes:
- RADIUS server unreachable (firewall, routing)
- Wrong RADIUS server address
domainfield causing lookup issues
Solutions:
- Verify RADIUS server is reachable:
/ping 10.1.2.3 - Check firewall allows UDP 1812/1813 outbound
- Set
domain=""(empty):/radius set [find] domain="" - Verify shared secret matches exactly on both sides
Problem 2: Authentication Timeout
Section titled âProblem 2: Authentication TimeoutâSymptoms: FreeRADIUS shows Access-Accept, but client disconnects after 15-20 seconds.
Causes:
- EAP method mismatch
- Certificate issues
- RADIUS ports incorrect
Solutions:
- Verify RADIUS ports (1812 auth, 1813 accounting)
- Match EAP methods on client and server
- Check certificate chain is complete for TLS methods
- Increase
auth-timeoutif network latency is high
Problem 3: VLAN Assignment Not Working
Section titled âProblem 3: VLAN Assignment Not WorkingâSymptoms: User authenticates but doesnât get assigned to correct VLAN.
Causes:
- Bridge VLAN filtering not enabled
- VLAN not defined on bridge
- Missing RADIUS attributes
Solutions:
- Enable VLAN filtering:
/interface bridge set bridge1 vlan-filtering=yes - Add VLAN to bridge:
/interface bridge vlan add bridge=bridge1 vlan-ids=10 tagged=bridge1 - Verify RADIUS sends all three Tunnel attributes
- Check hardware offloading is enabled for switch chip rules
Problem 4: MAC Authentication Failing
Section titled âProblem 4: MAC Authentication FailingâSymptoms: Devices without 802.1X arenât authenticating via MAC.
Causes:
mac-authnot inauth-types- MAC format mismatch with RADIUS
- Wrong
mac-auth-mode
Solutions:
- Add MAC auth:
auth-types=dot1x,mac-auth - Match MAC format in RADIUS (typically lowercase with colons:
00:11:22:33:44:55) - Try both
mac-as-usernameandmac-as-username-and-passwordmodes
Problem 5: Client Canât Connect (EAP Method Issues)
Section titled âProblem 5: Client Canât Connect (EAP Method Issues)âSymptoms: Windows/macOS client fails to authenticate.
Causes:
- Unsupported EAP method
- Certificate not trusted
- Inner method mismatch
Solutions:
- Use PEAP with MSCHAPv2 for Windows/macOS compatibility
- Install RADIUS server certificate in client trust store
- Verify inner authentication method matches (MSCHAPv2 is most compatible)
Bridge Integration Requirements
Section titled âBridge Integration RequirementsâFor Dot1X server to work with VLAN assignment:
-
Interface must be bridge port:
/interface bridge port add bridge=bridge1 interface=ether2 -
Enable VLAN filtering:
/interface bridge set bridge1 vlan-filtering=yes -
Define VLANs:
/interface bridge vlan add bridge=bridge1 vlan-ids=10,20,30 tagged=bridge1 -
Use default protocol mode:
/interface bridge set bridge1 protocol-mode=rstp
Dynamic Switch Rules (Advanced)
Section titled âDynamic Switch Rules (Advanced)âRADIUS can send dynamic ACL rules via Mikrotik-Switching-Filter attribute:
RADIUS attribute format:
Mikrotik-Switching-Filter = "allow src-address=192.168.1.0/24, drop dst-port=445"Supported conditions:
mac-protocolsrc-mac-address,dst-mac-addresssrc-address,dst-addressprotocolsrc-port,dst-port
Actions: allow (default), drop
Hardware support: CRS3xx, CRS5xx, CCR2116, CCR2216, and devices with QCA8337, Atheros8327, Atheros8316 switch chips.
Security Best Practices
Section titled âSecurity Best Practicesâ- Use strong RADIUS secrets: At least 16 random characters
- Enable accounting: Track authentication events for auditing
- Implement re-authentication: Prevent session hijacking
- Use guest VLANs sparingly: Isolate untrusted devices
- Monitor active sessions: Watch for unauthorized access attempts
- Prefer EAP-TLS: Certificate-based authentication is strongest
- Protect RADIUS traffic: Use IPsec or isolated management VLAN
Related Features
Section titled âRelated Featuresâ- User Manager - Built-in RADIUS server for RouterOS
- Bridge VLAN Filtering - Required for dynamic VLAN assignment
- RADIUS Client - Connects to authentication servers
- Certificates - Required for EAP-TLS authentication
- Firewall - Additional security layer after authentication
Summary
Section titled âSummaryâDot1X provides enterprise-grade port security by requiring authentication before network access. Key points:
- Server mode protects your networkâblock until authenticated
- Client mode lets RouterOS connect to protected networks
- RADIUS integration enables centralized authentication and dynamic VLANs
- Guest/Reject VLANs handle edge cases gracefully
- MAC authentication supports legacy devices
Start with basic Dot1X authentication, then add dynamic VLANs and MAC fallback as needed.
Related Topics
Section titled âRelated TopicsâPrerequisites
Section titled âPrerequisitesâ- Bridge VLAN Filtering - required for dynamic VLAN assignment
- Certificates - required for EAP-TLS authentication
Authentication Infrastructure
Section titled âAuthentication Infrastructureâ- RADIUS Client - connects to authentication servers
- User Management - local user accounts for testing
Network Security
Section titled âNetwork Securityâ- Firewall Basics - additional security layer after authentication
- Wireless Security - WPA-Enterprise uses 802.1X
Related Topics
Section titled âRelated Topicsâ- Hotspot - alternative captive portal authentication
- Bridge Configuration - base switching configuration