Community discussions

MikroTik App
 
zaharmd
just joined
Topic Author
Posts: 6
Joined: Wed Oct 26, 2016 4:43 am

Subnet spread over virtual WLAN and VLAN coming from trunk

Wed Jan 18, 2023 5:17 am

Hello! I am looking for some wisdom from Mikrotik community.

My setup: hAP ax3 + L2 switch
hapax3.png
L2 switch has 3 VLANs defined (1, 30, 70) and is connected to hAP via trunk port for inter-VLAN routing (no firewall filter rules are defined at this moment, so traffic flows freely between all VLANs).

What I cannot achieve: expand VLAN 70 and corresponding 10.10.70.0/24 subnet to WLAN interface (virtual).

So far I ended up with a routing table where network 10.10.70.0/24 sits behind two interfaces (“bridge” and “vlan70-media” and it stops traffic flowing).
routing-table.png
Does it even make sense to spread VLAN subnet over to WLAN? Do I make some fundamental network design mistake?
# jan/17/2023 22:11:14 by RouterOS 7.7
# software id = xxx
#
# model = C53UiG+5HPaxD2HPaxD
# serial number = xxx
/interface bridge
add admin-mac=xxx auto-mac=no comment=defconf name=bridge \
    vlan-filtering=yes
/interface ethernet
set [ find default-name=ether1 ] name=ether1-wan
set [ find default-name=ether2 ] disabled=yes
set [ find default-name=ether3 ] disabled=yes
set [ find default-name=ether4 ] name=ether4-infra-media
set [ find default-name=ether5 ] name=ether5-console
/interface wifiwave2
set [ find default-name=wifi1 ] channel.band=5ghz-ax .skip-dfs-channels=\
    disabled .width=20/40/80mhz configuration.country=Canada .hide-ssid=yes \
    .mode=ap .ssid=WIFI24 disabled=no security.authentication-types=\
    wpa2-psk,wpa3-psk
set [ find default-name=wifi2 ] channel.band=2ghz-ax .skip-dfs-channels=\
    10min-cac .width=20/40mhz configuration.mode=ap .ssid=WIFI50 \
    security.authentication-types=wpa2-psk,wpa3-psk
add configuration.country=Canada .hide-ssid=no .mode=ap .ssid=MEDIA disabled=\
    no mac-address=xxx master-interface=wifi1 name=wifi70-media \
    security.authentication-types=wpa2-psk,wpa3-psk
/interface vlan
add interface=bridge name=vlan30-infra vlan-id=30
add interface=bridge name=vlan70-media vlan-id=70
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/ip pool
add name=pool1 ranges=10.10.70.139-10.10.70.149
/ip dhcp-server
add address-pool=pool1 interface=bridge name=server1
/port
set 0 name=serial0
/interface bridge port
add bridge=bridge comment=defconf interface=ether2
add bridge=bridge comment=defconf interface=ether3
add bridge=bridge comment=defconf interface=ether4-infra-media
add bridge=bridge comment=defconf interface=ether5-console
add bridge=bridge comment=defconf ingress-filtering=no interface=wifi1
add bridge=bridge comment=defconf interface=wifi2
add bridge=bridge ingress-filtering=no interface=wifi70-media
/interface bridge settings
set use-ip-firewall-for-vlan=yes
/ip neighbor discovery-settings
set discover-interface-list=LAN
/ipv6 settings
set disable-ipv6=yes forward=no
/interface bridge vlan
add bridge=bridge tagged=ether4-infra-media,bridge vlan-ids=30
add bridge=bridge tagged=ether4-infra-media,bridge untagged=wifi70-media \
    vlan-ids=70
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=ether1-wan list=WAN
/ip address
add address=10.10.1.1/24 comment="defconf, mgmt, VID=1" interface=bridge \
    network=10.10.1.0
add address=10.10.30.1/24 comment="infra, VID=30" interface=vlan30-infra \
    network=10.10.30.0
add address=10.10.70.1/24 comment="media, VID=70" interface=vlan70-media \
    network=10.10.70.0
add address=10.10.70.2/24 interface=bridge network=10.10.70.0
/ip dhcp-client
add comment=defconf interface=ether1-wan
/ip dhcp-server network
add address=10.10.70.0/24 dns-server=10.10.1.1 gateway=10.10.70.2
/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,new,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
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" \
    ipsec-policy=out,none log-prefix=MASQ out-interface-list=WAN
/system clock
set time-zone-name=America/Toronto
/system logging
add prefix="DHCP===" topics=dhcp
/system ntp client
set enabled=yes
/system ntp server
set enabled=yes
/system ntp client servers
add address=0.ca.pool.ntp.org
add address=1.ca.pool.ntp.org
add address=2.ca.pool.ntp.org
add address=3.ca.pool.ntp.org
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN
You do not have the required permissions to view the files attached to this post.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19099
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Subnet spread over virtual WLAN and VLAN coming from trunk  [SOLVED]

Wed Jan 18, 2023 1:57 pm

(1) Yes, there is no need to define vlan1 its assigned by the router on the bridge in the background and thus you have a trunk port to the switch.

(2) 10.10.1.0/24 seems to be your management or trusted subnet. It should be in a vlan

(3) You need full setups for each vlan pool, dhcp server, dhcp server-network, not just IP address

(4) Your ethernet ports 2,3 are disabled and yet they are on the bridge ????

(5) Unless you have a specific reason this is not used and the regular firewall rules suffice.
/interface bridge settings
set use-ip-firewall-for-vlan=yes


(6) You completely botch up the 70 network by assigning it both to the bridge and the vlan-media. So you have mess..........
The bridge requires NOTHING, it will only be bridging.......

FIXED FOR YA (only changes shown)

/interface vlan
add interface=bridge name=vlan10-trusted vlan-id=10
add interface=bridge name=vlan30-infra vlan-id=30
add interface=bridge name=vlan70-media vlan-id=70

/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
add name=MNGMT

/ip pool
add name=pool1 range=10.10.1.10-10.10.1.254
add name=pool30 ranges=10.10.30.10-10.10.30.254
add name=pool70 ranges=10.10.70.139-10.10.70.149
/ip dhcp-server
add address-pool=pool1 interface=vlan10-trusted name=server10
add address-pool=poo30 interface=vlan30-infra name=server30
add address-pool=pool70 interface=vlan70-media name=server70
/interface bridge port
add bridge=bridge comment=defconf interface=ether2 disabled=yes
add bridge=bridge comment=defconf interface=ether3 disabled=yes
add bridge=bridge comment=defconf interface=ether4-infra-media ingress-filtering=yes frame-types=admit-only-vlan-tagged
add bridge=bridge comment=defconf interface=ether5-console ingress-filtering=yes frame-types=admit-priority-and-untagged pvid=10
add bridge=bridge comment=defconf ingress-filtering=no interface=wifi1 ingress-filtering=yes frame-types=admit-priority-and-untagged pvid=10
add bridge=bridge comment=defconf interface=wifi2 ingress-filtering=yes frame-types=admit-priority-and-untagged pvid=10
add bridge=bridge ingress-filtering=no interface=wifi70-media ingress-filtering=yes frame-types=admit-priority-and-untagged pvid=70

/interface bridge settings { shown as being DELETED to be clear }
set use-ip-firewall-for-vlan=yes[/b]
/ip neighbor discovery-settings
set discover-interface-list=MNGMT[/b]
/interface bridge vlan
add bridge=bridge tagged=bridge,ether4-infra-media untagged=ether5-console,wifi1,wifi2 vlan-ids=10
add bridge=bridge tagged=bridge,ether4-infra-media vlan-ids=30
add bridge=bridge tagged=bridge,ether4-infra-media untagged=wifi70-media vlan-ids=70

/interface list member
add interface=vlan10-trusted list=LAN
add interface=vlan30-infra list=LAN
add interface=vlan70-media list=LAN

add comment=defconf interface=ether1-wan list=WAN
add interface=vlan10-trusted list=MNGMT

/ip address
add address=10.10.1.1/24 comment="defconf, mgmt," interface=vlan10-trusted \
network=10.10.1.0

add address=10.10.30.1/24 comment="infra, VID=30" interface=vlan30-infra \
network=10.10.30.0
add address=10.10.70.1/24 comment="media, VID=70" interface=vlan70-media \
network=10.10.70.0

/ip dhcp-server network
add address=10.10.1.0/24 dns-server=10.10.1.1 gateway=10.10.1.1
add address=10.10.30.0/24 dns-server=10.10.30.1 gateway=10.10.30.1
add address=10.10.70.0/24 dns-server=10.10.70.1 gateway=10.10.70.1

/tool mac-server
set allowed-interface-list=NONE
/tool mac-server mac-winbox
set allowed-interface-list=MNGMT


as for the firewall rules they are default and were fine until you had a trusted subnet and non-trusted subnets should modify as such......

/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=accept chain=input in-interface=vlan10-trusted
add action=accept chain=input in-interface-list=LAN dst-port=53,123 protocol=tcp
add action=accept chain=input in-interface-list=LAN dst-port=53 protocol=udp
add action=drop chain=input comment="drop all else"

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,new,untracked
add action=drop chain=forward comment="defconf: drop invalid" \
connection-state=invalid

add action=accept chain=forward comment="internet traffic" in-interface-list=LAN out-interface-list=WAN
add action=accept chain=forward comment="allow port forwarding" connection-nat-state=dstnat
add action=drop chain=forward comment="drop all else"
 
zaharmd
just joined
Topic Author
Posts: 6
Joined: Wed Oct 26, 2016 4:43 am

Re: Subnet spread over virtual WLAN and VLAN coming from trunk

Fri Jan 20, 2023 7:19 am

Thank you!

VLANs config works great!

It took me a while to fight for trusted VLAN 10, but eventually I had to rollback and use native VLAN 1 for management. The reason - my L2 switch cannot be managed from any VLAN other than VLAN ID=1. It is an HPE 1620-8G switch (for whose who want to avoid it). It is not fully managed L2 switch, but rather a "web-smart" one, where 99% of configuration is done in web UI, and it has this limitation: only one VLAN interface can be created (IP assigned) and it can can only be created within VLAN ID 1.

Who is online

Users browsing this forum: Bing [Bot], RobertsN, TheCat12 and 90 guests