正确构建的 MikroTik 热点桥接模式部署应对网络不可见,对用户却一目了然。
运行一个 MikroTik 热点 在桥接模式下 让您将一台 RouterOS 设备直接放入现有的二层网络,而无需重新编号任何子网。若正确配置,它对网络不可见,对用户却一目了然。若配置错误,一半的客户端根本看不到登录页,另一半则直接跳过。
这就是我在咖啡馆、旅馆以及小型 ISP 热点区域实际部署的完整配置,同时列出了让我收到最多求助的错误。
当桥接模式是正确选择时
在以下情况下使用桥接模式:
- 网关和 DHCP 已经存在且无法更改(酒店、校园、共享建筑)。
- 您需要热点可拆卸——拔掉设备后网络仍能正常工作。
- 多个接入点已经共享同一平面 VLAN,且不考虑重新分配地址。
如果您拥有整个边缘网络,请改用路由模式。路由更易于理解,所有"客户端不可见"的工单都会消失。

最小可用的 MikroTik 热点桥接模式配置
\/interface bridge add name=bridge-hotspot protocol-mode=none \/interface bridge settings set use-ip-firewall=yes \/interface bridge port add bridge=bridge-hotspot interface=ether2 add bridge=bridge-hotspot interface=ether3 \/ip pool add name=hs-pool ranges=10.20.0.10-10.20.0.254 \/ip dhcp-server add address-pool=hs-pool interface=bridge-hotspot name=hs-dhcp disabled=no \/ip hotspot profile set [find default=yes] use-radius=yes login-by=http-chap,mac-cookie html-directory=hotspot \/ip hotspot add address-pool=hs-pool interface=bridge-hotspot name=hotspot1 profile=default 最关键的一行是 use-ip-firewall=yes. 如果没有它,桥接帧永远不会进入 IP 防火墙——而热点的重定向规则位于 IP 防火墙中。即使其他配置完美,客户端仍会直接跳过登录页面。
值得了解的权衡:
use-ip-firewall会将桥接流量推送通过防火墙路径,这会在低端硬件上提升 CPU 负载。在 hEX 或 hAP ac² 上,大约 150–200 个并发用户后即可感受到。需要时请规划使用 CCR 或 RB5009。
DHCP 服务器应放置的位置
这是第二常见的故障。热点只有在学习到客户端的 IP 与 MAC 绑定后才会将其视为"活跃"。如果上游路由器分配地址,RouterOS 只会看到没有租约的 MAC 地址,导致会话表为空。
两种可行方案:
- 将 DHCP 移至 RouterOS 设备(如上所示)——最简单、最可靠。
- 保留上游 DHCP 并添加
\/ip dhcp-relay到桥接上,使租约能够通过 RouterOS 传递。
捕获门户(Walled garden)要点
现代设备会探测已知 URL 来判断是否处于强制门户后。若阻止该探测,即使登录成功,用户仍会看到"已连接,无互联网"。
| 主机 | 为何重要 |
|---|---|
connectivitycheck.gstatic.com | Android 与 ChromeOS 门户检测 |
captive.apple.com | iOS 与 macOS 门户检测 |
www.msftconnecttest.com | Windows 10/11 门户检测 |
| Your payment gateway domain | Paid vouchers must load before auth |
/ip hotspot walled-garden add dst-host=connectivitycheck.gstatic.com add dst-host=captive.apple.com add dst-host=*.msftconnecttest.com Add DNS to the IP-level walled garden too, otherwise name resolution for those hosts fails before HTTP is ever attempted:
/ip hotspot walled-garden ip add action=accept dst-address=8.8.8.8 protocol=udp dst-port=53 Bandwidth limits without a RADIUS server
For a single-site deployment that does not justify RADIUS yet, per-user rate limiting lives directly in the hotspot user profile – no separate queue configuration needed:
/ip hotspot user profile add name=guest-tier rate-limit=2M/8M shared-users=1 /ip hotspot user add name=guest01 password=<voucher-code> profile=guest-tier The rate-limit syntax here is rx/tx from the client’s perspective, which is the opposite convention from the Mikrotik-Rate-Limit RADIUS attribute discussed in the PPPoE/FreeRADIUS setup – worth double-checking if you run both hotspot and PPPoE on the same network, since mixing up the two conventions is an easy mistake. shared-users=1 stops one voucher code being pasted into three phones in the same café – raise it deliberately for a family-plan style voucher, never leave it unset by accident.
Branding the login page without breaking portal detection
The files under RouterOS’s 热点 HTML directory (referenced in the profile config above) are plain HTML/CSS, editable via Winbox’s file manager or SFTP. Two things break more login pages than anything else:
- Loading external assets (fonts, images, scripts) from the open internet before authentication. The walled garden blocks exactly this by design, so a login page referencing
fonts.googleapis.comrenders broken until every such host is added to the walled garden – or, simpler, host logo and font files locally inside the hotspot directory itself. - A login form that does not match the variable names RouterOS expects (
username,password, the hiddendstfield for post-login redirect). Start from the defaultlogin.htmltemplate and restyle it rather than rebuilding the form from scratch – the variable names are what actually authenticates the session, not the visual design around them.
Closing the common bypasses
MAC cloning. A user copies the MAC of an authorised device and inherits the session. Bind sessions to MAC 以及 IP, and keep mac-cookie lifetimes short (a working day, not a month):
/ip hotspot profile set [find default=yes] mac-cookie-timeout=1d Static IP self-assignment. A user sets a manual address in your subnet and skips DHCP. Drop unauthenticated forwarding at the firewall:
/ip firewall filter add chain=forward src-address=10.20.0.0/24 hotspot=!auth action=drop \ comment="Block non-authenticated hotspot subnet" DNS tunnelling. Restrict outbound port 53 to the router itself and force clients through it:
/ip firewall nat add chain=dstnat protocol=udp dst-port=53 action=redirect to-ports=53 \ in-interface=bridge-hotspot Verifying the deployment
Work down this list before you leave site:
/ip hotspot active print— a freshly logged-in client shows MAC 以及 IP. IP missing means DHCP placement is wrong./ip hotspot host print— unauthenticated devices should appear here. Empty table meansuse-ip-firewallis off.- Connect an iPhone and an Android handset. Both should auto-open the portal. Only one working means a walled-garden entry is missing.
- Set a manual IP on a laptop. It must have no internet.
/tool profileunder load — if the firewall process is pegged, the hardware is undersized for bridge mode.
RADIUS: when to add it
For a single site, local hotspot users are fine. Move to RADIUS the moment you have more than one site, need per-plan bandwidth profiles, or want usage accounting for billing. FreeRADIUS with a MySQL or PostgreSQL backend handles thousands of concurrent sessions on modest hardware, and rate limits arrive as a Mikrotik-Rate-Limit attribute rather than being hard-coded per router.
That is exactly the layer NexaLink automates — plans, vouchers, and per-user rate limits pushed to every RouterOS box from one panel.
Troubleshooting: portal loads but login fails
This specific symptom – the splash page itself renders, but submitting credentials does nothing or errors – has a short, ordered list of real causes:
- Clock skew between RouterOS and the browser’s device. Hotspot authentication is time-sensitive (the MD5-CHAP challenge has a short validity window); a RouterOS clock that drifted because NTP is misconfigured causes logins to silently fail. Check
/system clock printand confirm NTP client is enabled. - A stale session for the same MAC still active. Check
/ip hotspot active printfor a zombie session from a previous disconnect that never cleaned up – remove it manually and retry. - HTTPS redirect loop on modern phones. iOS and Android both now prefer HTTPS by default, and a captive portal cannot terminate HTTPS for domains it does not hold certificates for. Confirm
/ip hotspot profilehaslogin-by=http-chap,mac-cookie(not HTTPS-only) and that the walled garden entries use plain HTTP where the OS portal-detection probe expects it.
Field checklist
-
use-ip-firewall=yeson bridge settings - DHCP on the RouterOS box or relayed through it
- Walled garden covers Android, iOS, Windows, DNS, payment gateway
- Forward drop rule for
hotspot=!auth - 门户已在两种手机平台和一台笔记本电脑上完成测试
- 配置已导出并存储在设备外
只要选对这六项,热点就会停止生成工单。
