Community discussions

MikroTik App
just joined
Topic Author
Posts: 15
Joined: Sat Nov 03, 2018 5:32 am

Mikrotik VLAN & WiFi Configuration

Tue Jan 12, 2021 5:40 am

I have a simple configuration that is not working (export below). I have created two VLANs (Private = 192.168.20.x & Public = 192.168.21.x) with two DHCP servers. As soon as I add the VLAN tagging
vlan-id=21 vlan-mode=use-tag
to the appropriate WLAN interface, I can no longer successfully connect wirelessly. Without this VLAN tag in the WLAN interface, I can connect to the SSID without any issues. Any ideas? Full export is below.
# jan/02/1970 00:22:59 by RouterOS 6.43.7
# software id = JVFK-X1M2
# model = RouterBOARD 962UiGS-5HacT2HnT
# serial number = 8A7D08DEEF06
/interface bridge
add admin-mac=CC:2D:E0:E0:8D:3B auto-mac=no name=bridge vlan-filtering=yes
/interface ethernet
set [ find default-name=ether1 ] name=ether1-WAN/Internet
/interface wireless
set [ find default-name=wlan1 ] band=2ghz-b/g/n channel-width=20/40mhz-XX \
    disabled=no distance=indoors frequency=auto mode=ap-bridge name=\
    wlan-private-2ghz ssid=PrivateSSID wireless-protocol=802.11
set [ find default-name=wlan2 ] band=5ghz-a/n/ac channel-width=\
    20/40/80mhz-XXXX disabled=no distance=indoors frequency=auto mode=\
    ap-bridge name=wlan-private-5ghz ssid=PrivateSSID wireless-protocol=\
/interface vlan
add interface=bridge name=vlan-20-private vlan-id=20
add interface=bridge name=vlan-21-public vlan-id=21
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/interface wireless security-profiles
set [ find default=yes ] authentication-types=wpa-psk,wpa2-psk mode=\
    dynamic-keys supplicant-identity=MikroTik
add authentication-types=wpa-psk,wpa2-psk mode=dynamic-keys name=profile \
/interface wireless
add disabled=no mac-address=CE:2D:E0:E0:8D:41 master-interface=\
    wlan-private-2ghz name=wlan-public-2ghz security-profile=profile ssid=\
    PublicSSID vlan-id=21 vlan-mode=use-tag
add disabled=no mac-address=CE:2D:E0:E0:8D:40 master-interface=\
    wlan-private-5ghz name=wlan-public-5ghz security-profile=profile ssid=\
    PublicSSID vlan-id=21 vlan-mode=use-tag
/ip pool
add name=dhcp-pool-20-private ranges=
add name=dhcp-pool-21-public ranges=
/ip dhcp-server
add address-pool=dhcp-pool-20-private disabled=no interface=vlan-20-private \
add address-pool=dhcp-pool-21-public disabled=no interface=vlan-21-public \
/interface bridge filter
add action=drop chain=forward in-interface=wlan-public-5ghz
add action=drop chain=forward out-interface=wlan-public-5ghz
add action=drop chain=forward in-interface=wlan-public-2ghz
add action=drop chain=forward out-interface=wlan-public-2ghz
/interface bridge port
add bridge=bridge interface=ether2
add bridge=bridge interface=ether3
add bridge=bridge interface=ether4
add bridge=bridge interface=ether5
add bridge=bridge interface=sfp1
add bridge=bridge interface=wlan-private-2ghz
add bridge=bridge interface=wlan-private-5ghz
add bridge=bridge interface=wlan-public-5ghz
add bridge=bridge interface=wlan-public-2ghz
/ip neighbor discovery-settings
set discover-interface-list=LAN
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=ether1-WAN/Internet list=WAN
/ip address
add address= interface=vlan-20-private network=
add address= interface=vlan-21-public network=
/ip dhcp-client
add comment=defconf dhcp-options=hostname,clientid disabled=no interface=\
/ip dhcp-server network
add address= gateway= netmask=24
add address= gateway= netmask=24
/ip dns
set allow-remote-requests=yes
/ip dns static
add address= name=router.lan
/ip firewall filter
add action=accept chain=input comment=\
    "defconf: accept established,related,untracked" connection-state=\
add action=drop chain=input comment="defconf: drop invalid" connection-state=\
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=drop chain=input comment="defconf: drop all not coming from LAN" \
add action=accept chain=forward comment="defconf: accept in ipsec policy" \
add action=accept chain=forward comment="defconf: accept out ipsec policy" \
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" \
add action=accept chain=forward comment=\
    "defconf: accept established,related, untracked" connection-state=\
add action=drop chain=forward comment="defconf: drop 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
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" \
    ipsec-policy=out,none out-interface-list=WAN
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN
Forum Guru
Forum Guru
Posts: 6484
Joined: Mon Apr 20, 2009 9:11 pm

Re: Mikrotik VLAN & WiFi Configuration  [SOLVED]

Tue Jan 12, 2021 6:32 am

You need to either:
a) Use "/interface bridge vlan" and tell router that wlan-public-2ghz and wlan-public-5ghz contain tagged vlan 21.
b) Remove tagging from wlan-public-2ghz and wlan-public-5ghz and set pvid 21 for them as bridge ports.

In both cases you need vlan 21 tagged on bridge (in "/interface bridge vlan").
Excessive quoting is useless and annoying. If you use it, please consider if you could do without it.
just joined
Topic Author
Posts: 15
Joined: Sat Nov 03, 2018 5:32 am

Re: Mikrotik VLAN & WiFi Configuration

Tue Jan 12, 2021 7:22 am

Thank You! That solved it!

Who is online

Users browsing this forum: Baidu [Spider], kalto and 166 guests