I finally got VLANs working on WRT1200AC with OpenWRT 15.05.1 by following this advice https://forum.openwrt.org/viewtopic.php … 51#p327851
As they found, you can easily brick your router if you don't set the interfaces exactly right, and it's not intuitive. You MUST set WAN port to use "eth0.(vlan_number)" eg: "eth0.100" and the other external ports to use "eth1.(vlan_number)" eg: "eth1.2", even though WAN and LAN ports share the same switch and same VLAN config.
You must use the "t" tagged flag for the ports which the CPU connects to (5 on eth0 and 6 on eth1). So take careful note of the "5t" and "6t" in my example config below. Advice that is missing the essential "t" beside those entries did not work for me.
Also for some reason I found WAN had to use a specially set VID of 100 (or any number that isn't 1, and doesn't conflict with your other vlan numbers), while the VLAN itself must still be set to 1. See the example below.
Lastly, do NOT use Luci to configure the switch (eg: Network > Switch in the Luci inteface). You must edit /etc/config/network by hand to change the switch and VLAN definition. Luci will make a mess of switch and VLAN config. It autodetects the VLANs incorrectly when defining interface physical connections. It will try to call them all "eth0.1, eth0.2, eth0.3.." and so on, when in fact you must use "eth1.X" for all LAN ports and "eth0.X" for the WAN port. Using Luci's Network > Interface > (Interface Name) > Physical Settings config page is fine as long as you ignore the VLANs that Luci autodetects and type the correct ones using the "Custom Interface" box to define them the first time.
If I failed to do any one of these things, all the ports became unusable. I found that as long as I had SSH access set up to be accessible via the wifi connection, I was able to recover from mistakes easily enough.
BEWARE: The example should work for WRT1200AC v1 / WRT1900AC v2 / WRT1900ACS v1.
For WRT1900AC v1 entries for "eth0" and "eth1" need to be SWAPPED as you can see in https://wiki.openwrt.org/toh/linksys/wr … tch_layout
My working config, with WAN and each LAN port on its own VLAN (Ports labelled as 3 and 4 on the back of the device are defined here but currently unassigned to any network):
/etc/config/network:
config switch
option name 'switch0'
option reset '1'
option enable_vlan '1'
#wan port
config switch_vlan
option device 'switch0'
option vlan '1'
option vid '100'
option ports '4 5t'
#port 1
config switch_vlan
option device 'switch0'
option vlan '2'
option vid '2'
option ports '3 6t'
#port 2
config switch_vlan
option device 'switch0'
option vlan '3'
option vid '3'
option ports '2 6t'
#port 3
config switch_vlan
option device 'switch0'
option vlan '4'
option vid '4'
option ports '1 6t'
#port 4
config switch_vlan
option device 'switch0'
option vlan '5'
option vid '5'
option ports '0 6t'
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix ' ( ...whatever your prefix is... ) '
#Lan on switch port 1
config interface 'lan'
option force_link '1'
option proto 'static'
option netmask '255.255.255.0'
option ipaddr '192.168.0.1'
option ifname 'eth1.2'
#Another local network on switch port 2
config interface 'someothernetwork'
option proto 'static'
option ifname 'eth1.3'
option ipaddr '192.168.8.1'
option netmask '255.255.255.0'
#WAN on the wan port
config interface 'wan'
option ifname 'eth0.100'
option proto 'dhcp'
#Wireless
config interface 'wi'
option type 'bridge'
option _orig_ifname 'wlan0 wlan1'
option _orig_bridge 'true'
option proto 'static'
option ipaddr '192.168.6.1'
option netmask '255.255.255.0'
(Last edited by rtsm on 18 Jul 2016, 05:57)