VLAN Isolation with IOT and Guest

Hi,

I bought a Mikrotik hap ax3 for my personal use. I’m an IT guy but not a network specialist and I struggle to end my network configuration. I spent a lot of time looking at different topics here and youtube videos but I can’t find a way to enable VLAN filtering on my bridge. As soon as I activate it, I’m kicked out of my network and I have to reset my router.

My use case is quite simple, I want to have 4 Vlans :

  • LAN with all my IT stuff and my PC (kind of admin network)
  • IOT
  • Camera
  • Guest

LAN can access to all networks but all other networks are isolated.

I think i did all the firewall setting correctly but I guess I have an issue with the LAN configuration as everything is blocked as soon as I active VLAN Filtering.

By the way, once it will work I will remove the two default wifi, wifi 1 and wifi 2

Here is my configuration, would you have any suggestions and recommendations to improve it ?

Many thanks

/interface bridge
add admin-mac=48:A9:8A:BD:F2:91 auto-mac=no comment=defconf name=bridge
/interface wifiwave2
set [ find default-name=wifi1 ] channel.band=5ghz-ax .skip-dfs-channels=\
    10min-cac .width=20/40/80mhz configuration.mode=ap .ssid=MikroTik-BDF295 \
    disabled=no security.authentication-types=wpa2-psk,wpa3-psk \
    .connect-priority=0
set [ find default-name=wifi2 ] channel.band=2ghz-ax .skip-dfs-channels=\
    10min-cac .width=20/40mhz configuration.mode=ap .ssid=MikroTik-BDF296 \
    disabled=no security.authentication-types=wpa2-psk,wpa3-psk
/interface vlan
add interface=bridge name=vlan-camera-30 vlan-id=30
add interface=bridge name=vlan-guest-90 vlan-id=90
add interface=bridge name=vlan-io-20 vlan-id=20
add interface=bridge name=vlan-lan vlan-id=1
/interface wifiwave2
add channel.band=5ghz-ax .skip-dfs-channels=10min-cac .width=20/40/80+80mhz \
    configuration.mode=ap .ssid=CCGuests datapath.vlan-id=90 disabled=no \
    mac-address=4A:A9:8A:BD:F2:98 master-interface=wifi1 name=CCGuest \
    security.authentication-types=wpa2-psk,wpa3-psk .connect-priority=0
add channel.band="(unknown)" .skip-dfs-channels=10min-cac .width="(unknown)" \
    configuration.mode=ap .ssid=CCHome disabled=no mac-address=\
    4A:A9:8A:BD:F2:95 master-interface=wifi1 name=CCHome \
    security.authentication-types=wpa2-psk,wpa3-psk .connect-priority=0
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/interface wifiwave2 security
add authentication-types=wpa2-psk,wpa3-psk comment="IO / Camera" \
    connect-priority=0 disabled=no name="IO / Camera"
/interface wifiwave2
add channel.band=5ghz-ax .skip-dfs-channels=10min-cac .width=20/40/80+80mhz \
    configuration.mode=ap .ssid=CCCa datapath.vlan-id=30 disabled=no \
    mac-address=4A:A9:8A:BD:F2:97 master-interface=wifi1 name=CCCamera \
    security="IO / Camera" security.connect-priority=0
add channel.band=2ghz-ax .skip-dfs-channels=10min-cac .width=20/40mhz \
    configuration.mode=ap .ssid=CCIO2G datapath.vlan-id=20 disabled=no \
    mac-address=4A:A9:8A:BD:F2:96 master-interface=wifi2 name=CCIO2G \
    security="IO / Camera" security.connect-priority=0
/ip pool
add name=default-dhcp ranges=192.168.88.10-192.168.88.254
add name=dhcp_pool_io ranges=192.168.20.2-192.168.20.254
add name=dhcp_pool_guest ranges=10.10.10.2-10.10.10.254
add name=dhcp_pool-camera ranges=192.168.30.2-192.168.30.254
/ip dhcp-server
add address-pool=default-dhcp interface=bridge lease-time=10m name=defconf
add address-pool=dhcp_pool_io interface=vlan-io-20 lease-time=10m name=\
    dhcp_io
add address-pool=dhcp_pool_guest interface=vlan-guest-90 lease-time=10m name=\
    dhcp-guest
add address-pool=dhcp_pool-camera interface=vlan-camera-30 lease-time=10m \
    name=dhcp1
/interface bridge port
add bridge=bridge comment=defconf interface=ether2
add bridge=bridge comment=defconf interface=ether3
add bridge=bridge comment=defconf interface=ether4
add bridge=bridge comment=defconf interface=ether5
add bridge=bridge comment=defconf interface=wifi1
add bridge=bridge comment=defconf interface=wifi2
add bridge=bridge interface=CCGuest pvid=90
add bridge=bridge interface=CCIO2G pvid=20
add bridge=bridge interface=CCCamera pvid=30
add bridge=bridge interface=CCHome pvid=10
/ip neighbor discovery-settings
set discover-interface-list=LAN
/interface bridge vlan
add bridge=bridge comment=VLAN_HOME_1 tagged=\
    bridge,CCHome,ether2,ether3,ether4,ether5 vlan-ids=1
add bridge=bridge comment=VLAN_IO_20 tagged=CCIO2G,bridge vlan-ids=20
add bridge=bridge comment=VLAN_CAMERA_30 tagged=CCCamera,bridge vlan-ids=30
add bridge=bridge comment=VLAN_GUEST_90 tagged=CCGuest,bridge vlan-ids=90
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=ether1 list=WAN
/ip address
add address=192.168.88.1/24 comment=defconf interface=bridge network=\
    192.168.88.0
add address=10.10.10.1/24 comment="GUEST IP" interface=vlan-guest-90 network=\
    10.10.10.0
add address=192.168.20.1/24 comment=vlan-io interface=vlan-io-20 network=\
    192.168.20.0
add address=192.168.30.1/24 comment=vlan-camera interface=vlan-camera-30 \
    network=192.168.30.0

/ip dhcp-client
add comment=defconf interface=ether1
/ip dhcp-server network
add address=10.10.10.0/24 gateway=10.10.10.1
add address=192.168.20.0/24 gateway=192.168.20.1
add address=192.168.30.0/24 gateway=192.168.30.1
add address=192.168.88.0/24 comment=defconf dns-server=192.168.88.1 gateway=\
    192.168.88.1
/ip dns
set allow-remote-requests=yes
/ip dns static
add address=192.168.88.1 comment=defconf name=router.lan
/ip firewall filter
add action=accept chain=input comment=\
    "defconf: accept established,related,untracked" connection-state=\
    established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=\
    invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment=\
    "defconf: accept to local loopback (for CAPsMAN)" dst-address=127.0.0.1
add action=drop chain=input comment="defconf: drop all not coming from LAN" \
    in-interface-list=!LAN
add action=accept chain=forward comment="defconf: accept in ipsec policy" \
    ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" \
    ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" \
    connection-state=established,related hw-offload=yes
add action=accept chain=forward comment=\
    "defconf: accept established,related, untracked" connection-state=\
    established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" \
    connection-state=invalid
add action=drop chain=forward comment=\
    "defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat \
    connection-state=new in-interface-list=WAN
add action=drop chain=forward comment="Drop Guest to Mgt" dst-address=\
    192.168.88.0/24 src-address=10.10.10.0/24
add action=drop chain=forward comment="Drop Guest to IO" dst-address=\
    192.168.20.0/24 src-address=10.10.10.0/24
add action=drop chain=forward comment="Drop Guest to Camera" dst-address=\
    192.168.30.0/24 src-address=10.10.10.0/24
add action=drop chain=input comment="Drop Guest Input" src-address=\
    10.10.10.0/24
add action=drop chain=forward comment="Drop IOT To Mgt" dst-address=\
    192.168.88.0/24 src-address=192.168.20.0/24
add action=drop chain=forward comment="Drop IOT to Camera" dst-address=\
    192.168.30.0/24 src-address=192.168.20.0/24
add action=drop chain=forward comment="Drop IOT to Guest" dst-address=\
    10.10.10.0/24 src-address=192.168.20.0/24
add action=drop chain=input comment="Drop IOT Input" src-address=\
    192.168.20.0/24
add action=drop chain=forward comment="Drop Camera to Mgt" dst-address=\
    192.168.88.0/24 src-address=192.168.30.0/24
add action=drop chain=forward comment="Drop Camera to IOT" dst-address=\
    192.168.20.0/24 src-address=192.168.30.0/24
add action=drop chain=forward comment="Drop Camera to Guest" dst-address=\
    10.10.10.0/24 src-address=192.168.30.0/24
add action=drop chain=input comment="Drop Camera Input" src-address=\
    192.168.30.0/24
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" \
    ipsec-policy=out,none out-interface-list=WAN
/ipv6 firewall address-list
add address=::/128 comment="defconf: unspecified address" list=bad_ipv6
add address=::1/128 comment="defconf: lo" list=bad_ipv6
add address=fec0::/10 comment="defconf: site-local" list=bad_ipv6
add address=::ffff:0.0.0.0/96 comment="defconf: ipv4-mapped" list=bad_ipv6
add address=::/96 comment="defconf: ipv4 compat" list=bad_ipv6
add address=100::/64 comment="defconf: discard only " list=bad_ipv6
add address=2001:db8::/32 comment="defconf: documentation" list=bad_ipv6
add address=2001:10::/28 comment="defconf: ORCHID" list=bad_ipv6
add address=3ffe::/16 comment="defconf: 6bone" list=bad_ipv6
/ipv6 firewall filter
add action=accept chain=input comment=\
    "defconf: accept established,related,untracked" connection-state=\
    established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=\
    invalid
add action=accept chain=input comment="defconf: accept ICMPv6" protocol=\
    icmpv6
add action=accept chain=input comment="defconf: accept UDP traceroute" port=\
    33434-33534 protocol=udp
add action=accept chain=input comment=\
    "defconf: accept DHCPv6-Client prefix delegation." dst-port=546 protocol=\
    udp src-address=fe80::/10
add action=accept chain=input comment="defconf: accept IKE" dst-port=500,4500 \
    protocol=udp
add action=accept chain=input comment="defconf: accept ipsec AH" protocol=\
    ipsec-ah
add action=accept chain=input comment="defconf: accept ipsec ESP" protocol=\
    ipsec-esp
add action=accept chain=input comment=\
    "defconf: accept all that matches ipsec policy" ipsec-policy=in,ipsec
add action=drop chain=input comment=\
    "defconf: drop everything else not coming from LAN" in-interface-list=\
    !LAN
add action=accept chain=forward comment=\
    "defconf: accept established,related,untracked" connection-state=\
    established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" \
    connection-state=invalid
add action=drop chain=forward comment=\
    "defconf: drop packets with bad src ipv6" src-address-list=bad_ipv6
add action=drop chain=forward comment=\
    "defconf: drop packets with bad dst ipv6" dst-address-list=bad_ipv6
add action=drop chain=forward comment="defconf: rfc4890 drop hop-limit=1" \
    hop-limit=equal:1 protocol=icmpv6
add action=accept chain=forward comment="defconf: accept ICMPv6" protocol=\
    icmpv6
add action=accept chain=forward comment="defconf: accept HIP" protocol=139
add action=accept chain=forward comment="defconf: accept IKE" dst-port=\
    500,4500 protocol=udp
add action=accept chain=forward comment="defconf: accept ipsec AH" protocol=\
    ipsec-ah
add action=accept chain=forward comment="defconf: accept ipsec ESP" protocol=\
    ipsec-esp
add action=accept chain=forward comment=\
    "defconf: accept all that matches ipsec policy" ipsec-policy=in,ipsec
add action=drop chain=forward comment=\
    "defconf: drop everything else not coming from LAN" in-interface-list=\
    !LAN
/system clock
set time-zone-name=Europe/Paris
/system note
set show-at-login=no
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN

THe easiest thing to do when initially setting up the bridge and vlans is to take one port OFF the bridge and do all the configuring from that port.
https://forum.mikrotik.com/viewtopic.php?t=181718

Turn on bridge vlan-filtering from off bridge port access!!

You need to get rid of vlan1 and make it vlan10. The router as most switches do, use vlan1 in the background and it should not be used for data vlan

Since you use vlans in datapath cant help you with the rest…

Thank you anav for your quick answer !

THe easiest thing to do when initially setting up the bridge and vlans is to take one port OFF the bridge and do all the configuring from that port.

Unfortunately my laptop haven’t got any ethernet port, may be i can do this with one of the default wifi ?

You need to get rid of vlan1 and make it vlan10. The router as most switches do, use vlan1 in the background and it should not be used for data vlan

I did it at fist with a “Home” Lan with id 10 but I was struggling to integrate it with the bridge

Since you use vlans in datapath cant help you with the rest…

Is there any other way to implement VLAN for wifi without datapath ?

Many thanks (and happy new year :slight_smile: )

https://www.amazon.ca/TP-Link-USB-Ethernet-Adapter-UE306/dp/B09GRL3VCN/ref=sr_1_5?crid=3NF5I9WBVYVOM&keywords=usb+to+ethernet+adapter&qid=1704243565&sprefix=usb+to+ethernet+adapter%2Caps%2C87&sr=8-5