WiFi not working with VLan

HI all!

I'm using openwrt for a long time, and now I need to implement VLans on my configs...

My openwrts are dumb switches/wifi AP. I have a opnsense router that provides DNS DHCP...

I configured the VLan 101 in the openwrt box, and I can connect to it via a untagged port, and my computer gets an IP from dhcp server(opnsense) from the vlan range and I can access my servers and the internet.

I created one wifi network and if i connect it to br-lan It work fine, but if i change the device to the vlan, it wont work...

I appreciate any help.

Heres my config:

/etc/config/network

config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fddd:b0a5:2bbe::/48'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'eth0.1'

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	option ipaddr '192.168.0.1'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option gateway '192.168.0.5'
	list dns '192.168.0.5'
	list dns_search 'myhome'

config switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option ports '0t 2 3 5 1'
	option vid '1'

config interface 'VLAN101'
	option proto 'static'
	option device 'eth0.101'
	option ipaddr '192.168.101.1'
	option netmask '255.255.255.0'
	option gateway '192.168.101.5'
	list dns '192.168.101.5'
	list dns_search 'myhome'
	option type 'bridge'

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option ports '0t 4 5t 1t'
	option vid '101'

/etc/config/wireless

config wifi-device 'radio0'
	option type 'mac80211'
	option path 'pci0000:00/0000:00:00.0'
	option channel 'auto'
	option band '5g'
	option htmode 'VHT80'
	option cell_density '0'

config wifi-iface 'default_radio0'
	option device 'radio0'
	option network 'lan'
	option mode 'ap'
	option ssid 'BRKWifi 5ghz'
	option encryption 'psk-mixed'
	option key 'XXXXXXXXXX'
	option ieee80211r '1'
	option mobility_domain '11AF'
	option ft_over_ds '0'
	option ft_psk_generate_local '1'

config wifi-device 'radio1'
	option type 'mac80211'
	option path 'platform/ahb/18100000.wmac'
	option channel 'auto'
	option band '2g'
	option htmode 'HT20'
	option cell_density '0'

config wifi-iface 'default_radio1'
	option device 'radio1'
	option network 'lan'
	option mode 'ap'
	option ssid 'PrtWifi'
	option encryption 'psk-mixed'
	option key 'XXXXXXXXXXXXXXX'
	option ieee80211r '1'
	option mobility_domain '12AF'
	option ft_over_ds '0'
	option ft_psk_generate_local '1'

config wifi-iface 'wifinet2'
	option device 'radio1'
	option mode 'ap'
	option ssid 'BRKWifi'
	option encryption 'psk-mixed'
	option key 'XXXXXXXXX'
	option network 'lan'

config wifi-iface 'wifinet3'
	option device 'radio0'
	option mode 'ap'
	option ssid 'KDTv5G'
	option encryption 'psk-mixed'
	option key 'XXXXXXXXXX'
	option short_preamble '0'
	option network 'VLAN101'

The bridge needs to be defined as a separate device... it cannot be part of the interface stanza.

Instead, it should look like this:

config device
	option name 'br-vlan101'
	option device 'eth0.101'
	option type 'bridge'

config interface 'VLAN101'
	option proto 'static'
	option device 'br-vlan101'
	option ipaddr '192.168.101.1'
	option netmask '255.255.255.0'
	option gateway '192.168.101.5'
	list dns '192.168.101.5'
	list dns_search 'myhome'

That said, if this is a dumb AP (and the VLAN itself is routed on a different device -- 192.168.101.5), you can (and probably should) further simplify the interface stanza as follows:

config interface 'VLAN101'
	option proto 'none'
	option device 'br-vlan101'
1 Like

Thanks, it solved the problem.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.