Community discussions

MikroTik App
 
Josephny
Long time Member
Long time Member
Topic Author
Posts: 665
Joined: Tue Sep 20, 2022 12:11 am

VLAN on ax3 (another attempt)

Mon Sep 02, 2024 6:57 pm

I failed and put on hold my attempts to understand and learn VLANS, but am now trying again.

Yes: I did read (about 100 times) @pcunite's wonderful thread.

I have an extra hapAx3 that I just set up, wired by ethernet to a minipc that is connected via wifi to my main network (so I have internet access while figuring this all out).

I took @pcunite's RouterSwitchAP.rsc example file, but things have changed substantially from them to ROS v15 and I needed to customized a little bit.

Could someone please look this over and let me know if it is done correctly?

The goal is to have 2 wifi networks (SSIDs):

GREEN: To provide only internet access
BLUE: That provides full access to the router and any other devices connected to it

Each (BLUE and GREEN) should offer both 2.4 and 5ghz access.

There is also a BASE_VLAN on ether5 for back-door/management.

Not yet tackled is being able to provide full access to the router and LAN via Wireguard, but without letting users connected via GREEN access to Wireguard-connected other sides.

Thank you.

Here's the export:
# 2024-09-02 19:35:34 by RouterOS 7.15.3
# software id = PTUN-M4Y8
#
# model = C53UiG+5HPaxD2HPaxD
# serial number = HEW09xxxx
/interface bridge
add admin-mac=78:9A:18:30:D6:EE auto-mac=no comment=defconf name=bridge \
    port-cost-mode=short vlan-filtering=yes
/interface wifi
set [ find default-name=wifi1 ] channel.band=5ghz-ax .skip-dfs-channels=\
    10min-cac .width=20/40/80mhz configuration.mode=ap .ssid=ax3 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=ax3 disabled=no \
    security.authentication-types=wpa2-psk,wpa3-psk
/interface wireguard
add listen-port=13231 mtu=1420 name=wireguard-ax3
/interface vlan
add comment=MANAGEMENT interface=bridge name=BASE_VLAN vlan-id=99
add comment=TRUSTED interface=bridge name=BLUE_VLAN vlan-id=10
add comment=GUESTS interface=bridge name=GREEN_VLAN vlan-id=20
/interface wifi
add configuration.mode=ap .ssid=BLUE disabled=no mac-address=\
    7A:9A:18:30:D6:F2 master-interface=wifi2 name=BLUE-2ghz \
    security.authentication-types=wpa2-psk
add configuration.mode=ap .ssid=BLUE disabled=no mac-address=\
    7A:9A:18:30:D6:F2 master-interface=wifi1 name=BLUE-5ghz \
    security.authentication-types=wpa2-psk
add configuration.mode=ap .ssid=GREEN disabled=no mac-address=\
    7A:9A:18:30:D6:F3 master-interface=wifi2 name=GREEN-2ghz \
    security.authentication-types=wpa2-psk
add configuration.mode=ap .ssid=GREEN disabled=no mac-address=\
    7A:9A:18:30:D6:F3 master-interface=wifi1 name=GREEN-5ghz \
    security.authentication-types=wpa2-psk
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
add name=BASE
add name=VLAN
add name=wireguard-list
/ip pool
add name=default-dhcp ranges=10.0.0.10-10.0.0.252
add name=BLUE_POOL ranges=10.0.10.2-10.0.10.252
add name=GREEN_POOL ranges=10.0.20.2-10.0.20.252
add name=BASE_POOL ranges=10.0.0.10-10.0.0.252
/interface bridge port
add bridge=bridge comment=defconf frame-types=\
    admit-only-untagged-and-priority-tagged interface=ether2 \
    internal-path-cost=10 path-cost=10
add bridge=bridge comment=defconf frame-types=\
    admit-only-untagged-and-priority-tagged interface=ether3 \
    internal-path-cost=10 path-cost=10
add bridge=bridge comment=defconf frame-types=\
    admit-only-untagged-and-priority-tagged interface=ether4 \
    internal-path-cost=10 path-cost=10
add bridge=bridge comment=defconf frame-types=\
    admit-only-untagged-and-priority-tagged interface=ether5 \
    internal-path-cost=10 path-cost=10 pvid=99
add bridge=bridge comment=defconf frame-types=\
    admit-only-untagged-and-priority-tagged interface=wifi1 \
    internal-path-cost=10 path-cost=10
add bridge=bridge comment=defconf frame-types=\
    admit-only-untagged-and-priority-tagged interface=wifi2 \
    internal-path-cost=10 path-cost=10
add bridge=bridge interface=BLUE-5ghz internal-path-cost=10 path-cost=10 \
    pvid=10
add bridge=bridge interface=GREEN-5ghz internal-path-cost=10 path-cost=10 \
    pvid=20
add bridge=bridge interface=BLUE-2ghz pvid=10
add bridge=bridge interface=GREEN-2ghz pvid=20
/ip firewall connection tracking
set udp-timeout=10s
/ip neighbor discovery-settings
set discover-interface-list=LAN
/ipv6 settings
set disable-ipv6=yes forward=no
/interface bridge vlan
add bridge=bridge tagged=bridge vlan-ids=10
add bridge=bridge tagged=bridge vlan-ids=20
add bridge=bridge tagged=bridge vlan-ids=99
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=ether1 list=WAN
add interface=BASE_VLAN list=LAN
add interface=BASE_VLAN list=VLAN
add interface=BLUE_VLAN list=VLAN
add interface=GREEN_VLAN list=VLAN
add interface=BASE_VLAN list=BASE
add interface=bridge list=BASE
add interface=wireguard-ax3 list=wireguard-list
add interface=wireguard-ax3 list=LAN
/ip address
add address=192.168.88.1/24 comment=defconf disabled=yes interface=bridge \
    network=192.168.88.0
add address=10.0.0.1/24 interface=BASE_VLAN network=10.0.0.0
add address=10.0.10.1/24 interface=BLUE_VLAN network=10.0.10.0
add address=10.0.20.1/24 interface=GREEN_VLAN network=10.0.20.0
add address=10.0.0.1/24 interface=ether5 network=10.0.0.0
add address=10.10.100.15/24 interface=wireguard-ax3 network=10.10.100.0
/ip dhcp-client
add comment=defconf interface=ether1
/ip dhcp-server
add address-pool=BASE_POOL disabled=yes interface=bridge lease-time=10m name=\
    defconf
add address-pool=GREEN_POOL interface=GREEN_VLAN lease-time=10m name=\
    GREEN_DHCP
add address-pool=BASE_POOL interface=BASE_VLAN lease-time=10m name=BASE_DHCP
add address-pool=BLUE_POOL interface=BLUE_VLAN lease-time=10m name=BLUE_DHCP
/ip dhcp-server network
add address=10.0.0.0/24 dns-server=10.0.0.1 gateway=10.0.0.1
add address=10.0.10.0/24 dns-server=10.0.0.1 gateway=10.0.10.1
add address=10.0.20.0/24 dns-server=10.0.0.1 gateway=10.0.20.1
/ip dns
set allow-remote-requests=yes servers=9.9.9.9
/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 log=yes
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment="Allow BASE_VLAN Full Access" \
    in-interface=BASE_VLAN
add action=accept chain=input comment="Allow BLUE_VLAN " in-interface=\
    BLUE_VLAN
add action=drop chain=input comment="Drop GREEN_VLAN" in-interface=GREEN_VLAN
add action=accept chain=input comment="WG handshake" dst-port=13231 protocol=\
    udp
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=accept chain=forward comment="VLAN Internet Access Only" \
    connection-state=new in-interface-list=VLAN out-interface-list=WAN
add action=accept chain=forward comment=\
    "supports local LAN users to access remote LAN subnets" dst-address=\
    192.168.0.0/16 out-interface=wireguard-ax3 src-address=192.168.0.0/16
add action=accept chain=forward comment="Supports road warrior coming in direc\
    tly and relay back thru tunnel to other WG" in-interface=wireguard-ax3 \
    out-interface=bridge
add action=accept chain=forward comment=\
    "supports local LAN users to access remote LAN subnets" dst-address=\
    192.168.0.0/16 out-interface=wireguard-ax3 src-address=10.0.0.0/16
add action=accept chain=forward comment=\
    "allows wg traffic to exit WAN for UDM subnets or internet" \
    in-interface-list=LAN out-interface-list=WAN
add action=accept chain=forward comment="supports inter-WG traffic" \
    dst-address=10.10.0.0/16 out-interface=wireguard-ax3 src-address=\
    10.10.0.0/16
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 out-interface-list=WAN
/ip route
add disabled=no distance=1 dst-address=192.168.2.0/24 gateway=wireguard-ax3 \
    routing-table=main scope=30 suppress-hw-offload=no target-scope=10
/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=America/New_York
/system identity
set name=JRS-Router-SwitchAP
/system logging
add disabled=yes topics=debug
/system note
set show-at-login=no

Edited with wireguard additions and other tweaks/corrections.

Who is online

Users browsing this forum: No registered users and 28 guests