Hotspot

MikroTik Hotspot Setup with a Custom Login Page (Step by Step)

Create a MikroTik Hotspot for a cafe, office or hostel: run the setup wizard, add users and speed limits, customize the login page and fix the problems users report most.

Commands in this article follow RouterOS v7 documentation but have not yet been marked as lab-tested on this site. Always test changes in a lab or maintenance window and keep a backup.

Problem

You want guests to log in before they can use the Wi-Fi or LAN, each with their own username, a time or speed limit, and a branded login page.

Symptoms (common after a first setup)

  • The login page does not appear on phones.
  • Users log in but have no internet.
  • An edited login page loses its style or stops logging users in.

Likely causes

  • HTTPS sites cannot be redirected, so the login page appears only for an http:// page or the phone's captive-portal check.
  • The client uses a hard-coded DNS server, or the hotspot DNS name does not resolve.
  • Required variables or form fields were removed from login.html.

Prerequisites

  • A separate interface or bridge for guests, for example bridge-guest, with no other DHCP server on it.
  • Internet already working on the router.

Solution (WinBox / CLI)

1. Run the setup wizard (IP > Hotspot > Hotspot Setup in WinBox):

RouterOS CLI
/ip hotspot setup

Answer the prompts: hotspot interface bridge-guest, local address 10.10.10.1/24, masquerade yes, address pool 10.10.10.2-10.10.10.254, certificate none, SMTP 0.0.0.0, DNS servers (for example 8.8.8.8), a DNS name under a domain you own (for example wifi.yourcompany.com), and the first user.

2. Add speed and time limits with user profiles:

RouterOS CLI
/ip hotspot user profile add name=2M rate-limit=2M/2M shared-users=1 session-timeout=1d
/ip hotspot user add name=guest01 password=Pass1234 profile=2M limit-uptime=1d

3. Allow some sites without login (walled garden), for example your website or a payment page:

RouterOS CLI
/ip hotspot walled-garden add dst-host=*.yourcompany.com

4. Customize the login page.

  1. In WinBox, open Files. The wizard created a folder named hotspot (on some devices flash/hotspot).
  2. Drag login.html to your PC, change the text, colours and logo, and drag it back. Keep images in the same folder and use relative paths.
  3. Keep the form and its variables, such as $(link-login-only), $(link-orig) and the username and password fields. Without them, login stops working.
  4. For a separate design, copy the folder to hotspot-custom and point the server profile to it:
RouterOS CLI
/ip hotspot profile set hsprof1 html-directory=hotspot-custom

Verification

RouterOS CLI
/ip hotspot active print
/ip hotspot host print

Connect a phone to the guest network. The login page should open by itself, and after login the user appears in active.

Common errors

  • Login page does not open: open an http:// site such as http://neverssl.com, and check that guest DHCP gives the router as the DNS server.
  • Logged in but no internet: the masquerade rule for the hotspot network is missing, or a firewall rule drops the guest subnet.
  • Users share one account: set shared-users=1 in the user profile.
  • Edited login.html stops working: a variable or the form action was removed. Restore the original file and edit again.

Rollback

RouterOS CLI
/ip hotspot disable [find]

Disabling the hotspot server returns the network to normal access without login. Remove it with /ip hotspot remove [find] when you no longer need it.

Watch the video (Bangla): Customize the MikroTik Hotspot login page

Go deeper in class

This topic is covered hands-on in MTCUME — MikroTik Certified User Management Engineer.

View MTCUME
WhatsApp