[Solved] Struggling with VLAN configuration on Xiaomi AX3200

Hello all,

I am using OpenWRT for the first time. I have just installed it on a Xiaomi AX3200/Redmi AX6S. No problem there. It all works well with basic config.

I want to create 3 VLANs (Main, IoT, Guest), with the VLANs split out via different ports and SSIDs. I have been trying all day to get the VLANs to work but I am not having any luck. It seems the device should use DSA, so I have been trying to set it up according to the guidelines. I found this guide based on a YouTube video and it seems simple enough, but as soon as I try to configure the VLAN filtering on the bridge device "br-lan", the router becomes unreachable. I can only get it back by waiting for the rollback and then restarting the router. (Yes, I have been making sure I am connected via an appropriate port - Untagged, primary). I have been following that guide exactly and trying to make sense of the issue.

Any help would be appreciated!

uci show network (before attempted implementation):

root@OpenWrt:~# uci show network
network.loopback=interface
network.loopback.device='lo'
network.loopback.proto='static'
network.loopback.ipaddr='127.0.0.1'
network.loopback.netmask='255.0.0.0'
network.globals=globals
network.globals.ula_prefix='fdc6:68ca:1aed::/48'
network.@device[0]=device
network.@device[0].name='br-lan'
network.@device[0].type='bridge'
network.@device[0].ports='lan1' 'lan2' 'lan3'
network.lan=interface
network.lan.device='br-lan'
network.lan.proto='static'
network.lan.ipaddr='192.168.1.1'
network.lan.netmask='255.255.255.0'
network.lan.ip6assign='60'
network.@device[1]=device
network.@device[1].name='wan'
network.@device[1].macaddr='3c:cd:57:22:00:70'
network.wan=interface
network.wan.device='wan'
network.wan.proto='dhcp'
network.wan6=interface
network.wan6.device='wan'
network.wan6.proto='dhcpv6'

When I try to make the changes according to the guide, I ended up with the following changes to commit:

It is at this point the router becomes unresponsive.

Can anybody see what I am doing wrong here?

Thanks in advance!

EDIT: Replaced incorrect uci show network output

These are not necessary and can be deleted.

take a look at the DSA mini tutorial...

specifically, you'll create new VLANs like this (just a quick example):

config bridge-vlan
	option device 'br-lan'
	option vlan '2'
	list ports 'lan3:t'

Thank you for the reply. Sorry, the uci show network output I included in the original post was the wrong entry (I was still fiddling around with it while writing the post). I have updated it now to show what my clean starting point is.

Thanks for the tutorial, I have been using that too but I haven't made any progress. It looks like I am working towards scenario 4 in the tutorial. But whenever I change the device in the LAN bridge interface to the new VLAN "br-lan.99", the router becomes unreachable. My computer loses its IP address and eventually self assigns one, but the router remains unreachable via the web interface and SSH.

I have been making changes via the GUI but it looks like I am applying the same approach via the GUI as in your quick example. Is that correct?

Thank you once again! I really appreciate the help.

If i get it right, you following tutorial as you linked

now, i look at this tuto and first, i don't see anywhere DHCP server
but maybe i am wrong

in this tutorial, OpenWRT address is 192.168.2.1/24
do you tried to set static address, 192.168.2.100 for example for your PC and this way connect to LAN2 port ?

Please copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

cat /etc/config/network
cat /etc/config/wireless
cat /etc/config/dhcp
cat /etc/config/firewall

my main reason for asking him about static address is:

OpenWRT default is DHCP + 192.168.1.1

this tutorial clearly set the LAN interface to 192.168.2.1 and make untagged (access) vlan LAN2 port

so, there is no DHCP, and address is no more 1.1, it is 2.1

edit: maybe this is the reason why hi could not access Luci anymore after apply bridge vlan filtering

Thank you. I am following the tutorial but I am leaving all original settings the same. Since I was following only section 4 of the tutorial, I didn't make any changes to DHCP or the router address. I was thinking the issue could be a DHCP issue, since my computer does not get an IP address after the changes, but I am a beginner so it was just a guess!

My original question was about tutorial you linked

as you say, when you apply these settings, there is no more access to Luci

one of the reason why you could not access Luci is that after press apply , Router address will be changed, and you need to specify static address on your PC
this is the tutorial which you linked originaly

For this article, we have our OpenWrt router LAN at 192.168.2.1 (default from factory would be 192.168.1.1), with its upstream WAN interface on the 192.168.1.0/24 network.

Thank you for being so helpful! The output is below:

/etc/config/network

root@OpenWrt:~# cat /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 'fdc6:68ca:1aed::/48'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'lan1'
	list ports 'lan2'
	list ports 'lan3'

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '60'

config device
	option name 'wan'
	option macaddr '3c:cd:57:22:00:70'

config interface 'wan'
	option device 'wan'
	option proto 'dhcp'

config interface 'wan6'
	option device 'wan'
	option proto 'dhcpv6'

/etc/config/wireless

config wifi-device 'radio0'
	option type 'mac80211'
	option path 'platform/18000000.wmac'
	option channel '1'
	option band '2g'
	option htmode 'HT20'
	option disabled '1'

config wifi-iface 'default_radio0'
	option device 'radio0'
	option network 'lan'
	option mode 'ap'
	option ssid 'OpenWrt'
	option encryption 'none'

config wifi-device 'radio1'
	option type 'mac80211'
	option path '1a143000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0'
	option channel '36'
	option band '5g'
	option htmode 'HE80'
	option disabled '1'

config wifi-iface 'default_radio1'
	option device 'radio1'
	option network 'lan'
	option mode 'ap'
	option ssid 'OpenWrt'
	option encryption 'none'

/etc/config/dhcp

root@OpenWrt:~# cat /etc/config/dhcp

config dnsmasq
	option domainneeded '1'
	option boguspriv '1'
	option filterwin2k '0'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option nonegcache '0'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	option nonwildcard '1'
	option localservice '1'
	option ednspacket_max '1232'

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'
	option dhcpv6 'server'
	option ra 'server'
	option ra_slaac '1'
	list ra_flags 'managed-config'
	list ra_flags 'other-config'

config dhcp 'wan'
	option interface 'wan'
	option ignore '1'

config odhcpd 'odhcpd'
	option maindhcp '0'
	option leasefile '/tmp/hosts/odhcpd'
	option leasetrigger '/usr/sbin/odhcpd-update'
	option loglevel '4'

/etc/config/firewall

root@OpenWrt:~# cat /etc/config/firewall
config defaults
	option syn_flood	1
	option input		ACCEPT
	option output		ACCEPT
	option forward		REJECT
# Uncomment this line to disable ipv6 rules
#	option disable_ipv6	1

config zone
	option name		lan
	list   network		'lan'
	option input		ACCEPT
	option output		ACCEPT
	option forward		ACCEPT

config zone
	option name		wan
	list   network		'wan'
	list   network		'wan6'
	option input		REJECT
	option output		ACCEPT
	option forward		REJECT
	option masq		1
	option mtu_fix		1

config forwarding
	option src		lan
	option dest		wan

# We need to accept udp packets on port 68,
# see https://dev.openwrt.org/ticket/4108
config rule
	option name		Allow-DHCP-Renew
	option src		wan
	option proto		udp
	option dest_port	68
	option target		ACCEPT
	option family		ipv4

# Allow IPv4 ping
config rule
	option name		Allow-Ping
	option src		wan
	option proto		icmp
	option icmp_type	echo-request
	option family		ipv4
	option target		ACCEPT

config rule
	option name		Allow-IGMP
	option src		wan
	option proto		igmp
	option family		ipv4
	option target		ACCEPT

# Allow DHCPv6 replies
# see https://github.com/openwrt/openwrt/issues/5066
config rule
	option name		Allow-DHCPv6
	option src		wan
	option proto		udp
	option dest_port	546
	option family		ipv6
	option target		ACCEPT

config rule
	option name		Allow-MLD
	option src		wan
	option proto		icmp
	option src_ip		fe80::/10
	list icmp_type		'130/0'
	list icmp_type		'131/0'
	list icmp_type		'132/0'
	list icmp_type		'143/0'
	option family		ipv6
	option target		ACCEPT

# Allow essential incoming IPv6 ICMP traffic
config rule
	option name		Allow-ICMPv6-Input
	option src		wan
	option proto	icmp
	list icmp_type		echo-request
	list icmp_type		echo-reply
	list icmp_type		destination-unreachable
	list icmp_type		packet-too-big
	list icmp_type		time-exceeded
	list icmp_type		bad-header
	list icmp_type		unknown-header-type
	list icmp_type		router-solicitation
	list icmp_type		neighbour-solicitation
	list icmp_type		router-advertisement
	list icmp_type		neighbour-advertisement
	option limit		1000/sec
	option family		ipv6
	option target		ACCEPT

# Allow essential forwarded IPv6 ICMP traffic
config rule
	option name		Allow-ICMPv6-Forward
	option src		wan
	option dest		*
	option proto		icmp
	list icmp_type		echo-request
	list icmp_type		echo-reply
	list icmp_type		destination-unreachable
	list icmp_type		packet-too-big
	list icmp_type		time-exceeded
	list icmp_type		bad-header
	list icmp_type		unknown-header-type
	option limit		1000/sec
	option family		ipv6
	option target		ACCEPT

config rule
	option name		Allow-IPSec-ESP
	option src		wan
	option dest		lan
	option proto		esp
	option target		ACCEPT

config rule
	option name		Allow-ISAKMP
	option src		wan
	option dest		lan
	option dest_port	500
	option proto		udp
	option target		ACCEPT


### EXAMPLE CONFIG SECTIONS
# do not allow a specific ip to access wan
#config rule
#	option src		lan
#	option src_ip	192.168.45.2
#	option dest		wan
#	option proto	tcp
#	option target	REJECT

# block a specific mac on wan
#config rule
#	option dest		wan
#	option src_mac	00:11:22:33:44:66
#	option target	REJECT

# block incoming ICMP traffic on a zone
#config rule
#	option src		lan
#	option proto	ICMP
#	option target	DROP

# port redirect port coming in on wan to lan
#config redirect
#	option src			wan
#	option src_dport	80
#	option dest			lan
#	option dest_ip		192.168.16.235
#	option dest_port	80
#	option proto		tcp

# port redirect of remapped ssh port (22001) on wan
#config redirect
#	option src		wan
#	option src_dport	22001
#	option dest		lan
#	option dest_port	22
#	option proto		tcp

### FULL CONFIG SECTIONS
#config rule
#	option src		lan
#	option src_ip	192.168.45.2
#	option src_mac	00:11:22:33:44:55
#	option src_port	80
#	option dest		wan
#	option dest_ip	194.25.2.129
#	option dest_port	120
#	option proto	tcp
#	option target	REJECT

#config redirect
#	option src		lan
#	option src_ip	192.168.45.2
#	option src_mac	00:11:22:33:44:55
#	option src_port		1024
#	option src_dport	80
#	option dest_ip	194.25.2.129
#	option dest_port	120
#	option proto	tcp

All of these are taken during the clean config state after I reset to defaults.

as i said
you originaly have your PC set to DHCP in 192.168.1.x/24 network and accessing Luci on 192.168.1.1

when you press apply, router IP will be changed to 192.168.2.1

Sorry, I thought you meant the DSA tutorial. When following Fabian Lee's tutorial, I did not change the IP address, I left it as 192.168.1.1, to match my original configuration. Is there any reason it would be necessary to change it? My WAN port is connected to an upstream router at 192.168.1.254

ok, in your Original Post, you linked this tuto

and there is clearly state:

For this article, we have our OpenWrt router LAN at 192.168.2.1

so, when you apply Fabian settings, router will change IP address

This means that your upstream router's lan and the OpenWrt lan are on the same subnet (192.168.1.0/24). You must change one subnet or the other.

As @NPeca75 has stated, change your OpenWrt router's lan to 192.168.2.1 and it should work.

There may be more to do later, but the first thing is to prevent an overlap of subnets.

I left that step out of my process. He suggested:

For this article, we have our OpenWrt router LAN at 192.168.2.1 (default from factory would be 192.168.1.1), with its upstream WAN interface on the 192.168.1.0/24 network.

If you want to set the LAN of your OpenWrt router to the 192.168.2.0/24 CIDR block to match, the command below will change it.

But I did not do this step, and where in future steps he had 192.168.2.xxx I retained 192.168.1.xxx

Am I correct to think this should not make a difference?

sed -i 's/192.168.1.1/192.168.2.1/' /etc/config/network
reboot -d 0

but i recomend to change IP from Luci
find the LAN interface in Luci
change IP to 192.168.2.1
reboot router !!!!!

command above is intended to be executed from SSH
as you wish ...

Your upstream network will conflict with the OpenWrt lan, and that will break routing. That is why it is imperative that you have different subnets.

Got it! Thank you both, sorry I was one reply behind you both. I am making the changes now!

1 Like

That works! Thank you so both very much. You are both very kind.

It's pretty embarrassing that it was something as simple as that, and I really should have known that. I really appreciate you both being so patient!

if your problem is solved, please mark the proper reply as solution

1 Like

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