I have followed a tutorial to create a guest wifi network that is separated from the private network, using a VLAN. I’m not sure if I have done everything right, but this setup does work. I’m going to post the basic configuration below before I ask. My private network has two wireless radios and two wireless devices (lacinet_24 and lacinet_5).
; Add security profile
/interface wireless security-profiles
add authentication-types=wpa2-psk eap-methods="" management-protection=allowed \
mode=dynamic-keys name=lacinet_sec_guest \
supplicant-identity="" wpa2-pre-shared-key="******************"
; Add virtual wireless interfaces
/interface wireless
add disabled=no keepalive-frames=disabled master-interface=lacinet_5 \
name=lacinet_guest_5 security-profile=lacinet_sec_guest ssid=lacinet_guest_5 \
vlan-id=10 vlan-mode=use-tag \
wds-cost-range=0 wds-default-cost=0 wps-mode=disabled
add disabled=no keepalive-frames=disabled master-interface=lacinet_24 \
name=lacinet_guest_24 security-profile=lacinet_sec_guest ssid=lacinet_guest_24 \
vlan-id=10 vlan-mode=use-tag \
wds-cost-range=0 wds-default-cost=0 wps-mode=disabled
; Connect vlan with wireless interface
/interface vlan
add interface=lacinet_guest_24 name=vlan10_guest24 vlan-id=10
add interface=lacinet_guest_5 name=vlan10_guest5 vlan-id=10
; Create bridge for guest
/interface bridge
add name=bridge_guest
/interface bridge port
add bridge=bridge_guest interface=vlan10_guest5 comment="guest"
add bridge=bridge_guest interface=vlan10_guest24 comment="guest"
add bridge=bridge_guest interface=lacinet_guest_24 comment="guest"
add bridge=bridge_guest interface=lacinet_guest_5 comment="guest"
; Add guest to LAN so it can pass firewall and access internet
/interface list member
add interface=bridge_guest list=LAN comment="guest"
; Create DHCP server for guest network
/ip address
add address=10.10.10.1/24 interface=bridge_guest network=10.10.10.0 comment="guest"
/ip pool
add name=dhcp_guest ranges=10.10.10.2-10.10.10.254
/ip dhcp-server
add address-pool=dhcp_guest disabled=no interface=bridge_guest name=dhcp_guest
/ip dhcp-server network
; do not use our local DNS here, hide local static DNS names
add address=10.10.10.0/24 dns-server=8.8.8.8,8.8.4.4 gateway=10.10.10.1 comment="guest"
; Drop packets between guest and private networks (rules are moved to the right place )
/ip firewall filter
add action=drop chain=forward in-interface=bridge_guest out-interface=bridge \
comment="Prevent access from guest vlan to private lan"
add action=drop chain=forward in-interface=bridge out-interface=bridge_guest \
comment="Prevent access from private lan to guest vlan"
This setup works, and I think I understand most of it. But there is one part that I don’t understand about VLANs. There are three places where VLAN id needs to be used in this setup:
- When adding the virtual wireless interface ( /interface wireless ) I have used vlan-id=10 vlan-mode=use-tag
- When adding VLANs (/interface vlan add) a new vlan interface is created for each virtual wireless interface
- And finally, when adding ports to the bridge (/interface bridge port) the created vlan interfaces and the wireless virtual interfaces are added to the same bridge
I don’t understand why this has to be done at three different places.
-
When we create the wireless interface, then it is already assigned a vlan id.As far as I understand, this is used for tagging incoming packets (with vlan id=10) and prevent sending packets with vlan id other than 10. This (apparently) cannot be used to filter outgoing packets for multiple vlan ids. Despite the fact that VLAN is a Layer 2 method that allows multiple Virtual LANs on a single physical interface, I can only specify a single vlan id here.
-
I can see that it is possible to create a many-to-many connection between physical interfaces and vlan ids under /interface vlan add . As far as I understand, any packet that goes out through a VLAN interface, also gets tagged with the given vlan id.
-
And finally, I have added the vlan interfaces and the virtual wifi interfaces to a bridge.
I don’t see why I have to do all three.The VLAN interfaces already have a reference to the physical interface. Which interface will the bridge use to send out packets? Will it use the vlan interface (that has a single virtual wireless interface assigned)? Or will it use the virtual wireless interface directly? What is the difference between the vlan-id setting of the virtual wireless interface and the vlan-id setting of the vlan interface? Are they used differently? How?
Sorry for the many questions, I’m a beginner. ![]()