Skip to content

HotSpot Captive Portal

For the impatient: use the setup wizard.

# Interactive wizard creates everything
/ip hotspot setup

The wizard prompts for interface, IP address, pool, DNS, and creates a user.

Or manual quick setup:

# 1. Configure gateway IP
/ip address add address=192.168.88.1/24 interface=ether2
# 2. Create address pool
/ip pool add name=hs-pool ranges=192.168.88.10-192.168.88.100
# 3. Configure DHCP
/ip dhcp-server add name=hs-dhcp interface=ether2 address-pool=hs-pool
/ip dhcp-server network add address=192.168.88.0/24 gateway=192.168.88.1 dns-server=192.168.88.1
# 4. Create HotSpot
/ip hotspot add name=hotspot1 interface=ether2 address-pool=hs-pool
# 5. Create user
/ip hotspot user add name=guest password=guest123

Verify:

/ip hotspot active print

What this does: HotSpot is a captive portal that forces users to authenticate before accessing the network. It intercepts HTTP traffic and redirects unauthenticated users to a login page.

When to use this:

  • Guest WiFi networks
  • Public hotspots (hotels, cafes, airports)
  • User tracking and accounting
  • Bandwidth management per user

Components:

  • HotSpot server on interface
  • DHCP server for IP distribution
  • User database (local or RADIUS)
  • Login page (customizable HTML)

Prerequisites:

  • Dedicated interface for HotSpot (not a bridge port)
  • DHCP server configured
  • NAT for internet access

Device Mode

HotSpot can be blocked by device-mode. Check /system/device-mode before configuring.

/ip address add address=192.168.88.1/24 interface=ether2 comment="HotSpot Gateway"
/ip pool add name=hs-pool ranges=192.168.88.10-192.168.88.100
/ip dhcp-server add name=hs-dhcp interface=ether2 address-pool=hs-pool disabled=no
/ip dhcp-server network add address=192.168.88.0/24 gateway=192.168.88.1 dns-server=192.168.88.1
/ip hotspot add name=hotspot1 interface=ether2 address-pool=hs-pool profile=default disabled=no
/ip hotspot user add name=guest password=guest123 profile=default

Control bandwidth and session limits:

/ip hotspot user profile add name=basic \
rate-limit=2M/2M \
session-timeout=2h \
idle-timeout=15m \
shared-users=1
/ip hotspot user add name=basicuser password=pass123 profile=basic

Allow access to specific sites before login:

# Allow by hostname
/ip hotspot walled-garden add dst-host=*.google.com action=allow
# Allow by IP
/ip hotspot walled-garden ip add dst-address=8.8.8.8/32 action=accept

Modern devices check specific URLs to detect captive portals. Add these for reliable login page display:

/ip hotspot walled-garden
add dst-host=connectivitycheck.gstatic.com comment="Android"
add dst-host=www.gstatic.com comment="Android"
add dst-host=captive.apple.com comment="iOS/macOS"
add dst-host=www.apple.com comment="iOS/macOS"
add dst-host=detectportal.firefox.com comment="Firefox"
add dst-host=www.msftconnecttest.com comment="Windows"
add dst-host=www.msftncsi.com comment="Windows"

Bypass or block specific clients without authentication:

# Bypass client by MAC (no login required)
/ip hotspot ip-binding add mac-address=AA:BB:CC:DD:EE:FF type=bypassed
# Block client by MAC
/ip hotspot ip-binding add mac-address=11:22:33:44:55:66 type=blocked
# Bypass client by IP
/ip hotspot ip-binding add address=192.168.88.50 type=bypassed
TypeEffect
bypassedClient skips login, full access
blockedClient cannot connect
regularOne-to-One NAT translation
/ip hotspot profile set default \
login-by=cookie,http-chap,http-pap \
html-directory-override=hotspot \
use-radius=no
MethodDescription
http-papPlain text password (less secure)
http-chapMD5 hashed password (more secure)
cookieRemember login via browser cookie
macAuthenticate by MAC address
mac-cookieMAC + cookie combination
trialTime-limited trial access

Login pages are stored in the router’s Files menu under /hotspot/ directory:

# Set custom HTML directory
/ip hotspot profile set default html-directory-override=my-hotspot

Key files to customize:

  • login.html - Main login page
  • logout.html - Logout confirmation
  • status.html - Session status page
  • error.html - Error messages
  • alogin.html - Post-login redirect

Access via FTP to edit. Use variables like $(username), $(mac), $(link-login) for dynamic content.

For external authentication:

/radius add address=10.0.0.10 secret=radiussecret service=hotspot
/ip hotspot profile set default use-radius=yes
# HotSpot server status
/ip hotspot print
# Active sessions
/ip hotspot active print
# All connected hosts
/ip hotspot host print
# User database
/ip hotspot user print
SymptomCauseSolution
Login page not appearingDNS not redirected, HTTPS sitesVerify HotSpot enabled, add walled-garden detection domains
Users can’t authenticateUser not in database, RADIUS downCheck /ip hotspot user print, verify RADIUS
Frequent disconnectionsAggressive timeout settingsIncrease idle-timeout and session-timeout
HotSpot on bridge failsMust be routed interfaceUse dedicated interface or VLAN
Some sites don’t workMTU/MSS issuesAdd MSS clamping rule
IPv6 bypasses HotSpotHotSpot is IPv4 onlyBlock unauthenticated IPv6 with firewall
iOS shows login, Android doesn’tDifferent detection methodsAdd Android detection domains to walled garden
HotSpot blockedDevice-mode restrictionCheck /system/device-mode settings
Login popup auto-closesAndroid captive portal behaviorAdjust redirect URL in login template

Common Mistakes

  • Don’t put HotSpot on a bridge member port - use the bridge interface directly or a VLAN
  • Don’t forget to configure DNS server for clients
  • Don’t set idle-timeout too short - users will disconnect frequently
  • Don’t forget walled-garden entries for captive portal detection domains