HotSpot Captive Portal Setup
HotSpot Captive Portal Setup
Section titled âHotSpot Captive Portal SetupâRouterOS Version: 7.x+ Difficulty: Intermediate Estimated Time: 30 minutes
TL;DR (Quick Start)
Section titled âTL;DR (Quick Start)âFor the impatient: hereâs the 30-second version.
# Minimal HotSpot on ether2/ip address add address=192.168.88.1/24 interface=ether2/ip pool add name=hs-pool-1 ranges=192.168.88.10-192.168.88.100/ip dhcp-server add name=hs-dhcp-1 interface=ether2 address-pool=hs-pool-1 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-1 profile=default disabled=no/ip hotspot user add name=guest password=guest123 profile=defaultOverview
Section titled âOverviewâHotSpot is MikroTikâs captive portal solution that forces users to authenticate before accessing the network. Unlike simple access control, HotSpot creates a transparent authentication layer that intercepts HTTP traffic and redirects unauthenticated users to a login page, making it ideal for guest networks, public WiFi, and controlled access scenarios.
This guide explains the underlying mechanisms, proper configuration, and common pitfalls that can make the difference between a seamless user experience and a troubleshooting nightmare.
Understanding Captive Portal Architecture
Section titled âUnderstanding Captive Portal ArchitectureâThe Authentication Flow
Section titled âThe Authentication FlowâWhen a device connects to a HotSpot-enabled network, this is what happens:
1. Device connects â Gets IP via DHCP2. Device tries HTTP request â Intercepted by HotSpot3. User redirected to login page â Enters credentials4. Authentication succeeds â Traffic flows normally5. Session timeout/logout â Returns to step 2The Technical Implementation
Section titled âThe Technical ImplementationâHotSpot works by creating a transparent proxy layer using these components:
Critical insight: HotSpot only works with IPv4 and relies heavily on NAT rules. It cannot function with IPv6 or in pure bridging scenarios.
Network Topology Requirements
Section titled âNetwork Topology RequirementsâHotSpot requires a routed interface - it cannot work on bridge ports directly. The typical setup:
Prerequisites
Section titled âPrerequisitesâ- RouterOS 7.x+ with device-mode supporting HotSpot (check
/system device-mode) - At least two interfaces (WAN and LAN/HotSpot interface)
- Basic understanding of DHCP and NAT
- For HTTPS login: Valid SSL certificate and DNS name
The HotSpot Setup Wizard
Section titled âThe HotSpot Setup WizardâMikroTik provides a setup wizard that configures all necessary components. Understanding what it creates helps you troubleshoot and customize later.
What the Wizard Creates
Section titled âWhat the Wizard CreatesâWhen you run /ip hotspot setup, it automatically configures:
- IP Pool - Range of addresses for HotSpot clients
- DHCP Server - Assigns IPs to connecting devices
- HotSpot Server - The captive portal instance
- HotSpot Profile - Authentication and session settings
- Firewall NAT Rules - Traffic redirection and masquerading
- DNS Configuration - Redirects DNS queries to HotSpot
- Default User - Initial login credentials
Manual vs. Wizard Configuration
Section titled âManual vs. Wizard ConfigurationâUse the wizard when:
- Setting up a basic guest network
- Learning HotSpot concepts
- Creating a quick proof-of-concept
Configure manually when:
- Integrating with existing network infrastructure
- Requiring custom authentication (RADIUS)
- Needing advanced walled garden rules
- Setting up multiple HotSpot servers
Configuration Steps
Section titled âConfiguration StepsâThis minimal example creates a working HotSpot on ether2 for testing the core concepts.
Note: While RouterOS provides
/ip hotspot setupwizard for interactive configuration, the steps below use discrete commands that work with automation and validation tools.
Step 1: Configure HotSpot Gateway Interface
Section titled âStep 1: Configure HotSpot Gateway InterfaceâAdd an IP address to the interface that will serve HotSpot clients:
/ip address add address=192.168.88.1/24 interface=ether2 comment="HotSpot Gateway"Step 2: Create Address Pool
Section titled âStep 2: Create Address PoolâCreate an IP pool for HotSpot clients:
/ip pool add name=hs-pool-1 ranges=192.168.88.10-192.168.88.100Step 3: Configure DHCP Server
Section titled âStep 3: Configure DHCP ServerâSet up DHCP to assign addresses from the pool:
/ip dhcp-server add name=hs-dhcp-1 interface=ether2 address-pool=hs-pool-1 disabled=no/ip dhcp-server network add address=192.168.88.0/24 gateway=192.168.88.1 dns-server=192.168.88.1Step 4: Create HotSpot Server
Section titled âStep 4: Create HotSpot ServerâCreate the HotSpot server on the interface:
/ip hotspot add name=hotspot1 interface=ether2 address-pool=hs-pool-1 profile=default disabled=noStep 5: Create Test User
Section titled âStep 5: Create Test UserâCreate a simple user account for testing:
/ip hotspot user add name=guest password=guest123 profile=defaultVerification
Section titled âVerificationâConfirm the HotSpot server is running and properly configured:
Check 1: HotSpot Server Status
Section titled âCheck 1: HotSpot Server Statusâ/ip hotspot printExpected Output:
# NAME INTERFACE ADDRESS-POOL PROFILE IDLE-TIMEOUT0 hotspot1 ether2 hs-pool-1 default 5mCheck 2: DHCP Server Configuration
Section titled âCheck 2: DHCP Server Configurationâ/ip dhcp-server printExpected Output:
Flags: X - disabled, I - invalid# NAME INTERFACE RELAY ADDRESS-POOL LEASE-TIME ADD-ARP0 dhcp1 ether2 hs-pool-2 1hCheck 3: User Database
Section titled âCheck 3: User Databaseâ/ip hotspot user printExpected Output:
# NAME SERVER PROFILE PASSWORD0 guest all default guest123Advanced Configuration
Section titled âAdvanced ConfigurationâCustom Login Pages
Section titled âCustom Login PagesâHotSpot uses HTML templates stored in the routerâs file system. To customize:
- Access the files via FTP or Files menu in WinBox
- Copy the hotspot directory to create a custom version
- Modify HTML files (login.html, status.html, etc.)
- Point the profile to your custom directory
/ip hotspot profile set hsprof1 html-directory-override=custom-hotspotWalled Garden Configuration
Section titled âWalled Garden ConfigurationâAllow access to specific sites without authentication:
# Allow access to company website/ip hotspot walled-garden add dst-host=*.company.com action=allow
# Allow access to specific IP range (e.g., local services)/ip hotspot walled-garden ip add dst-address=10.0.0.0/24 action=allowRADIUS Integration
Section titled âRADIUS IntegrationâFor enterprise authentication, integrate with a RADIUS server:
# Configure RADIUS client/radius add service=hotspot address=10.0.0.100 secret=radiussecret
# Enable RADIUS in HotSpot profile/ip hotspot profile set hsprof1 use-radius=yesSession Management
Section titled âSession ManagementâControl user session behavior:
/ip hotspot profile set hsprof1 \ session-timeout=1h \ idle-timeout=15m \ keepalive-timeout=2m \ on-login="log info \"User $user logged in from $address\"" \ on-logout="log info \"User $user logged out\""Security Considerations
Section titled âSecurity ConsiderationsâHTTPS Login
Section titled âHTTPS LoginâEnable secure authentication to protect credentials:
- Import SSL certificate:
/certificate import file-name=server.crt/certificate import file-name=server.key- Configure DNS name:
/ip dns set allow-remote-requests=yes/ip dns static add name=hotspot.local address=192.168.88.1- Enable HTTPS in profile:
/ip hotspot profile set hsprof1 login-by=httpsNetwork Isolation
Section titled âNetwork IsolationâPrevent HotSpot users from accessing internal networks:
# Block access to RFC1918 private networks/ip firewall filter add chain=forward src-address=192.168.88.0/24 \ dst-address=192.168.0.0/16 action=drop comment="Block HotSpot to internal"/ip firewall filter add chain=forward src-address=192.168.88.0/24 \ dst-address=10.0.0.0/8 action=drop/ip firewall filter add chain=forward src-address=192.168.88.0/24 \ dst-address=172.16.0.0/12 action=dropRate Limiting
Section titled âRate LimitingâControl bandwidth per user:
/ip hotspot user profile add name=limited rate-limit=2M/1M/ip hotspot user set guest profile=limitedTroubleshooting
Section titled âTroubleshootingâProblem: Login page doesnât appear
Section titled âProblem: Login page doesnât appearâSymptoms: Users get internet access immediately or see âpage not foundâ
Causes & Solutions:
-
HotSpot not enabled on interface
/ip hotspot print# Ensure interface is listed and not disabled -
DNS not redirected properly
/ip firewall nat print# Look for DNS redirect rules (port 53) -
Device using HTTPS-only sites
- Modern devices often use HTTPS by default
- Configure HTTPS login or add HTTP sites to walled garden
Problem: Users canât authenticate
Section titled âProblem: Users canât authenticateâSymptoms: Login page appears but credentials are rejected
Causes & Solutions:
-
User database issues
/ip hotspot user print# Verify user exists and password is correct -
RADIUS server unreachable (if using RADIUS)
/radius monitor 0# Check RADIUS server status -
Profile misconfiguration
/ip hotspot profile print detail# Verify authentication methods are enabled
Problem: Authenticated users lose connection
Section titled âProblem: Authenticated users lose connectionâSymptoms: Users must re-authenticate frequently
Causes & Solutions:
-
Aggressive timeout settings
/ip hotspot profile print# Check idle-timeout and session-timeout values -
IP address conflicts
/ip hotspot host print# Look for duplicate MAC addresses -
NAT table overflow
/ip firewall connection print count-only# Monitor connection table usage
Problem: Some websites donât work
Section titled âProblem: Some websites donât workâSymptoms: Authenticated users canât access specific sites
Causes & Solutions:
-
Walled garden blocking legitimate traffic
/ip hotspot walled-garden print# Review allow/deny rules -
DNS resolution issues
/ip dns cache print# Check if DNS queries are being resolved -
MTU/MSS issues with transparent proxy
/ip firewall mangle add chain=forward protocol=tcp tcp-flags=syn \action=change-mss new-mss=clamp-to-pmtu
Useful Debug Commands
Section titled âUseful Debug Commandsâ# Monitor active HotSpot sessions/ip hotspot active print
# Check HotSpot host table/ip hotspot host print
# View HotSpot cookies (for cookie-based auth)/ip hotspot cookie print
# Monitor firewall rules created by HotSpot/ip firewall nat print dynamic
# Check connection tracking/ip firewall connection print where connection-state=establishedCommon Use Cases
Section titled âCommon Use CasesâGuest Network with Time Limits
Section titled âGuest Network with Time Limitsâ# Create time-limited profile/ip hotspot user profile add name=guest-1hour session-timeout=1h
# Create daily guest accounts/ip hotspot user add name=guest-$(date) password=daily123 profile=guest-1hourVoucher-Based Access
Section titled âVoucher-Based Accessâ# Create voucher profile with data limits/ip hotspot user profile add name=voucher limit-bytes-total=500M
# Generate voucher codes:for i from=1 to=10 do={ /ip hotspot user add name=("voucher" . $i) password=("pass" . $i) profile=voucher}Corporate Guest Portal
Section titled âCorporate Guest Portalâ# Configure RADIUS authentication/radius add service=hotspot address=10.0.0.100 secret=corporate-secret
# Set up corporate profile/ip hotspot profile add name=corporate \ use-radius=yes \ login-by=http-chap \ html-directory-override=corporate-portalIntegration with VLANs
Section titled âIntegration with VLANsâHotSpot can work with VLANs for network segmentation:
# Create VLAN interface for guest network/interface vlan add name=vlan-guest vlan-id=100 interface=ether2
# Configure HotSpot on VLAN interface/ip hotspot add name=guest-hotspot interface=vlan-guest \ address-pool=guest-pool profile=guest-profile
# Isolate guest VLAN from internal networks/ip firewall filter add chain=forward in-interface=vlan-guest \ dst-address=192.168.1.0/24 action=dropPerformance Considerations
Section titled âPerformance ConsiderationsâHardware Requirements
Section titled âHardware RequirementsâHotSpot performance depends on:
- CPU power - All traffic passes through the CPU
- RAM - Session state and connection tracking
- Flash storage - Log files and user database
Optimization Tips
Section titled âOptimization Tipsâ-
Use hardware with sufficient CPU
- Avoid ARM-based devices for high-traffic scenarios
- Consider x86 devices for 100+ concurrent users
-
Optimize session timeouts
# Reduce idle timeout to free resources faster/ip hotspot profile set default idle-timeout=5m -
Limit concurrent sessions
# Prevent resource exhaustion/ip hotspot profile set default address-pool=limited-pool -
Monitor resource usage
/system resource print/system resource cpu print
Related Topics
Section titled âRelated TopicsâPrerequisites
Section titled âPrerequisitesâ- IP Address Configuration - hotspot interface addressing
- IP Pool - address pool for hotspot clients
- DHCP Server - DHCP for hotspot clients
- DNS Server - DNS for captive portal redirect
Authentication
Section titled âAuthenticationâ- RADIUS - external authentication server
- User Management - local user accounts
Bandwidth Control
Section titled âBandwidth Controlâ- Simple Queues - per-user bandwidth
- Firewall Mangle - traffic classification
Network Segmentation
Section titled âNetwork Segmentationâ- VLAN Configuration - isolate hotspot network
- Firewall Basics - inter-VLAN access control