Skip to content

Walled Garden

The walled garden allows unauthenticated HotSpot clients to reach specific destinations without logging in. Typical uses include allowing access to the login page assets, payment gateways, social login providers, and OS captive portal detection endpoints.

RouterOS provides two independent walled garden rule sets:

Rule SetPathLayerUse Case
HTTP walled garden/ip hotspot walled-gardenL7 (HTTP inspection)Plain HTTP sites, by hostname and path
IP walled garden/ip hotspot walled-garden ipL3/L4 (IP/protocol/port)HTTPS sites, DNS servers, any protocol

The HTTP walled garden inspects plain HTTP requests and can match by hostname, URL path, HTTP method, and source address. It only applies to unencrypted HTTP traffic (port 80).

ParameterDescriptionDefault
actionallow or deny traffic matching this ruleallow
commentDescriptive label
dst-hostDestination hostname to match; supports wildcards (*.example.com)
dst-portDestination TCP port
methodHTTP method to match (GET, POST, etc.)— (any)
pathURL path prefix to match
serverLimit rule to a specific HotSpot server name— (all)
src-addressSource IP address or subnet

Rules are evaluated top-to-bottom; the first matching rule applies. Rules without a matching criterion apply to all traffic.

# Allow entire domain
/ip hotspot walled-garden
add dst-host=*.example.com action=allow comment="Company site"
# Allow a specific domain
/ip hotspot walled-garden
add dst-host=payment.stripe.com action=allow comment="Stripe payment"
# Allow a CDN path used by the login page
/ip hotspot walled-garden
add dst-host=cdnjs.cloudflare.com path=/ajax/libs/jquery/* action=allow
# Deny access to a competitor site even before login
/ip hotspot walled-garden
add dst-host=*.competitor.com action=deny comment="Block competitor"

The dst-host field uses glob-style wildcards:

  • *.example.com — matches any subdomain of example.com (e.g., www.example.com, cdn.example.com)
  • example.com — matches only example.com (not subdomains)
  • * — matches all hostnames

The IP walled garden operates at L3/L4, passing or blocking traffic based on IP address, protocol, and port. It applies to all traffic — including HTTPS — making it the only option for HTTPS destinations.

ParameterDescriptionDefault
actionaccept or dropaccept
commentDescriptive label
dst-addressDestination IP address or subnet
dst-portDestination port or range
protocolIP protocol (tcp, udp, icmp, etc.)— (any)
serverLimit rule to a specific HotSpot server name— (all)
src-addressSource IP address or subnet
src-portSource port or range
# Allow specific IP for HTTPS (e.g., payment gateway)
/ip hotspot walled-garden ip
add dst-address=203.0.113.50 action=accept comment="Payment gateway"
# Allow DNS to a specific server before login
/ip hotspot walled-garden ip
add dst-address=1.1.1.1 protocol=udp dst-port=53 action=accept comment="Cloudflare DNS"
# Allow all traffic to a subnet (e.g., local NAS for onboarding)
/ip hotspot walled-garden ip
add dst-address=192.168.10.0/24 action=accept comment="Onboarding resources"
# Allow ICMP (ping) to the router gateway
/ip hotspot walled-garden ip
add dst-address=10.5.50.1 protocol=icmp action=accept comment="Ping gateway"

HotSpot cannot inspect or redirect HTTPS traffic transparently. When an unauthenticated client visits an HTTPS URL, the router cannot intercept the TLS handshake — the connection either fails or bypasses the portal entirely.

To allow HTTPS destinations pre-login, you must:

  1. Resolve the destination IP addresses.
  2. Add those IPs to the IP walled garden.
# Step 1: resolve IPs for the destination (example: stripe.com)
# Do this from a workstation: dig +short stripe.com
# Step 2: add all returned IPs
/ip hotspot walled-garden ip
add dst-address=54.187.174.169 action=accept comment="stripe.com"
add dst-address=54.241.191.232 action=accept comment="stripe.com"

Modern operating systems send HTTP probes to known URLs to detect captive portals. If these probes succeed (return expected responses), the OS concludes there is no portal and suppresses the captive portal browser. If they fail or redirect, the OS pops up the mini-browser.

RouterOS HotSpot intercepts these HTTP probes and redirects them to the login page, which causes the OS to detect the portal correctly. However, the OS-specific URLs must be reachable via HTTP (not HTTPS) to work. Ensure no firewall rules block them before HotSpot processes them.

OSDomainNotes
iOS / macOScaptive.apple.comApple uses HTTPS for newer checks; the HTTP probe is http://captive.apple.com/hotspot-detect.html
Androidconnectivitycheck.gstatic.comAlso clients3.google.com, connectivitycheck.android.com
Windowswww.msftncsi.com, dns.msftncsi.comNCSI test fetches http://www.msftncsi.com/ncsi.txt
Windows 10+www.msftconnecttest.comFetches /connecttest.txt expecting Microsoft Connect Test

These domains are automatically intercepted by HotSpot’s HTTP redirect engine. No additional walled garden rules are needed for the HTTP probes themselves — the HotSpot login redirect counts as a valid captive portal response.

For iOS and Android, if you want the captive portal mini-browser to open immediately, ensure your login page responds quickly at the redirected URL.

Allow traffic to a payment provider before login (required for voucher-based portals):

# HTTP rules for payment provider
/ip hotspot walled-garden
add dst-host=checkout.stripe.com action=allow comment="Stripe checkout"
add dst-host=js.stripe.com action=allow comment="Stripe JS"
# IP rules for HTTPS (resolve stripe.com IPs first)
/ip hotspot walled-garden ip
add dst-address=54.187.174.169 action=accept comment="Stripe IP 1"
add dst-address=54.241.191.232 action=accept comment="Stripe IP 2"
# HTTP walled garden for OAuth endpoints
/ip hotspot walled-garden
add dst-host=*.facebook.com action=allow comment="Facebook login"
add dst-host=*.fbcdn.net action=allow comment="Facebook CDN"
add dst-host=accounts.google.com action=allow comment="Google login"
add dst-host=*.googleapis.com action=allow comment="Google APIs"
/ip hotspot walled-garden
add dst-host=*.microsoft.com action=allow comment="Microsoft services"
add dst-host=*.windowsupdate.com action=allow comment="Windows Update"
add dst-host=*.msftncsi.com action=allow comment="Windows NCSI"

Allow DNS queries before login so clients can resolve the login page hostname:

/ip hotspot walled-garden ip
add dst-address=10.5.50.1 protocol=udp dst-port=53 action=accept \
comment="DNS to gateway (login page resolution)"
add dst-address=1.1.1.1 protocol=udp dst-port=53 action=accept \
comment="Cloudflare DNS fallback"

When running multiple HotSpot servers, scope rules to a specific server using the server parameter:

/ip hotspot walled-garden
add dst-host=*.hotel-partners.com action=allow server=hs-lobby \
comment="Hotel partner sites (lobby only)"
/ip hotspot walled-garden ip
add dst-address=192.0.2.100 action=accept server=hs-conference \
comment="Conference AV system"

RADIUS can push per-session walled garden entries using MikroTik vendor-specific attributes (VSAs). This allows different users to have different walled garden rules without static configuration.

RADIUS AttributeFormatDescription
Mikrotik-Walled-Garden-FqdnhostnameDomain to allow (HTTP walled garden)
Mikrotik-Walled-Gardenaction:src-addr:dst-addr:proto:src-port:dst-portIP walled garden rule

Example FreeRADIUS user definition:

premium-user Cleartext-Password := "secret"
Mikrotik-Walled-Garden-Fqdn := "*.streaming.example.com",
Mikrotik-Walled-Garden := "accept:0.0.0.0/0:192.0.2.0/24:6:0:443"

Walled garden rule not working for HTTPS

  • HTTP walled garden rules cannot match HTTPS traffic. Add equivalent IP walled garden rules for HTTPS destinations.

Login page assets not loading

  • If the login page references external CSS/JS (e.g., from a CDN), add those CDN hostnames to the HTTP walled garden.

OS shows “no internet” but portal exists

  • The OS captive portal probe was blocked before HotSpot could intercept it. Check for firewall rules running before HotSpot’s redirect that might be dropping traffic.

HTTPS site unreachable before login despite IP rule

  • Verify the destination IP is correct and hasn’t changed (CDNs rotate IPs). Re-resolve and update the entry.
  • Confirm action=accept (not action=allow — IP walled garden uses accept/drop).

View active walled garden rules

# HTTP rules
/ip hotspot walled-garden print
# IP rules
/ip hotspot walled-garden ip print
# Active sessions with walled garden bypass
/ip hotspot host print where bypassed=yes