2

OS: OpenWRT, Chaos Calmer 15.05.1 (stable release with luci GUI) Router: Linksys WRT 1900ACS (2x1.6Ghz, 512MB of RAM)

Problem: I am trying to set up separate VLANs per LAN interfaces (LAN ports). Strange but I cannot see any switch options in "luci" --> Networks; menu doesn't exist.

I tried to modify /etc/config/network by adding config switch for switch0, but I am losing access to my router after every /etc/init.d/network reload.

What I am trying to achieve:

Lan Port 1 --> VLAN 1;
Lan Port 2 --> VLAN 2;
Lan Port 3 --> VLAN 3;
Lan Port 4 --> VLAN 3;
Wireless --> VLAN 4; 

Default /etc/config/network looks like below:

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 'fd61:03fe:3974::/48'

config interface 'lan'
    option ifname 'eth1'
    option force_link '1'
    option type 'bridge'
    option proto 'static'
    option ipaddr '192.168.1.1'
    option netmask '255.255.255.0'
    option ip6assign '60'

config interface 'wan'
    option ifname 'eth0'
    option proto 'dhcp'

I tried adding switch into configuration after reviewing OpenWRT wiki with no luck.

My switch device name:

root@OpenWrt:~# swconfig list
Found: switch0 - 10.mvsw61xx

I would appreciate any input.

2

Check out a solution and basic config example to get VLANs working on WRT1200AC using OpenWRT Chaos Calmer 15.05.1 here

BEWARE: The example is for WRT1200AC v1 / WRT1900AC v2 / WRT1900ACS v1.

For WRT1900AC v1 entries for eth0 and eth1 need to be SWAPPED.

See this to identify your router model.

As you noted, getting the config wrong leaves you highly likely to brick your router. So be careful! I made sure SSH login was possible via wireless before proceeding to change LAN port setup.

From the forum link:

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't1 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 interface). 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.

My working config, with WAN and each LAN port on its own VLAN (Ports labeled 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'
| improve this answer | |
  • Just an FYI for any that come across this answer: port 5t is CPU interface eth0 and is LAN, whereas port 6t is is CPU interface eth1 and is WAN. sw.port0 - sw.port3 (LAN 4 - 1) are the LAN ports and sw.port4 (Internet) is the WAN port. – JW0914 Oct 16 '19 at 11:02
0

FYI. I applied the same configuration as specified by @AdrianQ on my Linksys 1900AC v2 router running OpenWRT (18.06.02) and it also worked on this device.

This makes sense as both the WRT1900AC(v2) and WRT1900ACS routers use the same Marvell 88E6176 ethernet switch and so share the same switch port layout. See device VLAN switch port references:

| improve this answer | |
  • What are you saying?   You say you are “looking to implement a similar VLAN configuration”.   So, have you done it?   Did it work?   Did it fail (and are you asking for help)?   Or are you just suggesting something that you think might work, but you haven’t tried? – Scott Mar 2 '19 at 4:27
  • @Scott - I confirmed AdrianQ's VLAN configuration also worked on my WRT1900ACv2 and I ammended my post accordingly. – Michael Mar 2 '19 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.