basforge

Search titles, text and the “If it doesn’t work” cases.

    RU

    A guest Wi-Fi network on MikroTik: a separate bridge, its own DHCP and three firewall rules

    Guests and smart plugs get their own network, 192.168.89.0/24: internet yes, computers, the NAS and the router itself no. On a single router without access points this needs no VLANs: virtual Wi-Fi networks on both radios, a separate bridge and three firewall rules. Make the changes in Safe Mode.

    What you end up with

    home    bridge        192.168.88.0/24   ether2…5, wifi1, wifi2      list LAN
    guests  bridge-guest  192.168.89.0/24   wifi1-guest, wifi2-guest    list GUEST
    
    guest → internet                     allowed
    guest → router DNS and DHCP          allowed
    guest → home, router, another guest  denied
    home → guest                         allowed (to set up a plug, a printer)

    A virtual Wi-Fi network runs on the same radio and channel as the home one. With several access points, or when guests need to go over cable, VLANs and CAPsMAN give the same result (Wired on MikroTik, Wi-Fi on MikroTik).

    Steps

    1. Turn on Safe Mode

      In the terminal press Ctrl+X, and <SAFE> appears in the prompt. In Winbox, the Safe Mode button at the top left. If a change cuts you off from the router, it rolls back everything done in this mode (Safe Mode).

      [netadmin@MikroTik] <SAFE>
    2. Create a bridge and a list for guests

      /interface bridge add name=bridge-guest comment="guest network"
      /interface list add name=GUEST
      /interface list member add list=GUEST interface=bridge-guest

      Don’t add the bridge to LAN: to the factory firewall, guests stay outsiders — no Winbox, no neighbor discovery, no MAC login.

    3. Assign an address and a pool

      /ip address add address=192.168.89.1/24 interface=bridge-guest
      /ip pool add name=pool-guest ranges=192.168.89.10-192.168.89.254
    4. Start DHCP

      /ip dhcp-server add name=dhcp-guest interface=bridge-guest address-pool=pool-guest \
          lease-time=2h disabled=no
      /ip dhcp-server network add address=192.168.89.0/24 gateway=192.168.89.1 \
          dns-server=192.168.89.1

      A 2-hour lease instead of the factory 30 minutes — guests come and go, and a pool of 245 addresses won’t fill up. DNS is the router itself: allow-remote-requests=yes is already on in the factory config, and the firewall closes it from outside (Router DNS from outside).

    5. Add Wi-Fi networks on both radios

      /interface wifi add name=wifi1-guest master-interface=wifi1 configuration.mode=ap \
          configuration.ssid=home-guest security.authentication-types=wpa2-psk,wpa3-psk \
          security.passphrase="guest password" datapath.bridge=bridge-guest \
          datapath.client-isolation=yes disabled=no
      /interface wifi add name=wifi2-guest master-interface=wifi2 configuration.mode=ap \
          configuration.ssid=home-guest security.authentication-types=wpa2-psk,wpa3-psk \
          security.passphrase="guest password" datapath.bridge=bridge-guest \
          datapath.client-isolation=yes disabled=no

      datapath.bridge puts the interface into bridge-guest itself — no separate /interface bridge port line needed. client-isolation=yes — guests can’t see each other: a guest’s infected laptop can’t reach another guest’s phone. Channel and power come from wifi1 and wifi2. For smart plugs that don’t need 5 GHz and trip over 802.11r, you can add a third network on wifi2 only, without ft.

    6. Open DNS and DHCP to guests

      /ip firewall filter
      add chain=input in-interface-list=GUEST protocol=udp dst-port=53,67 action=accept \
          comment="guest: DNS, DHCP" \
          place-before=[find comment="defconf: drop all not coming from LAN"]
      add chain=input in-interface-list=GUEST protocol=tcp dst-port=53 action=accept \
          comment="guest: DNS tcp" \
          place-before=[find comment="defconf: drop all not coming from LAN"]

      Both rules go above “drop all not coming from LAN”: at the end of the chain nothing would reach them (MikroTik firewall). Everything else on the router — Winbox, SSH, web — stays closed to guests by that same factory deny.

    7. Block the home network for guests

      /ip firewall filter add chain=forward in-interface-list=GUEST out-interface-list=!WAN \
          action=drop comment="guest: only internet"

      A new connection from the guest network to anywhere but the internet is dropped. The rule can go at the end: higher up in forward there are no allows for new connections, only for established ones. Replies from home devices to guests — also established — pass: home can still reach guests.

    8. Leave Safe Mode, keeping the changes

      Press Ctrl+X again, or the Safe Mode button in Winbox. While the mode is on, changes are temporary: close the window without leaving the mode and the router rolls them back.

    If it doesn’t work

    The phone joins the guest network and hangs at “Obtaining IP address”

    Cause
    The DHCP server is disabled: dhcp-guest has the X flag in /ip dhcp-server print. Or the virtual Wi-Fi network didn’t land in bridge-guest, and the request goes nowhere.
    Fix
    /ip dhcp-server print — dhcp-guest must not have the X flag; /interface bridge port print where bridge=bridge-guest — both wifi*-guest are there.

    An address is assigned, sites don’t open by name, but 1.1.1.1 pings

    Cause
    The router’s DNS is closed to guests: the port 53 rule landed after “drop all not coming from LAN”.
    Fix
    /ip firewall filter print where chain=input — the guest: rules must sit above defconf: drop all not coming from LAN. Move them with move or recreate them with place-before.

    The NAS and the router’s web UI open from the guest network

    Cause
    There’s no forward deny toward the home network, or bridge-guest was added to the LAN list — then the firewall treats guests as insiders.
    Fix
    /interface list member print — bridge-guest is only in GUEST. The guest: only internet rule is there and enabled.

    Limited guests’ speed with a Simple Queue, and they download at full speed

    Cause
    Their connections went into fasttrack — queues don’t see its traffic.
    Fix
    Exclude guests from fasttrack (Fasttrack and queues).

    The guest network exists only on 2.4 GHz or only on 5

    Cause
    The virtual interface was created on one radio: on the hAP ax², wifi1 is 5 GHz and wifi2 is 2.4 GHz.
    Fix
    Repeat step 5 for the second master-interface.

    How to check

    From a phone connected to home-guest:

    address in the Wi-Fi settings            192.168.89.x, gateway 192.168.89.1
    any website                              opens
    http://192.168.88.1                      doesn't open — timeout
    NAS or a home computer, 192.168.88.x     doesn't open, doesn't ping
    ping 192.168.89.1                        answers — the factory firewall allows ICMP

    Meanwhile, on the router you can see the rules firing:

    /ip firewall filter print stats where comment~"guest"
    # #  CHAIN    ACTION  BYTES  PACKETS
    # 13 input    accept  6 512  96         guest: DNS, DHCP
    # 15 forward  drop    1 920  32         guest: only internet — attempts into the home network

    Not verified yet

    1. the guest network on a hAP ax² step by step — from the bridge to the check from a phone ↑