There are many ways you can utilise VLANs in OpenWRT. This documents particularly how to configure a TP-Link WDR4300 running OpenWRT 12.09 to conform to an existing VLAN topology, where VLAN 1 is for data and VLAN 2 is for VOIP (voice) traffic.
By default OpenWRT comes with VLANs disabled and when enabled, there are two VLANs. VLAN 1 is for the lan interface and VLAN 2 is for the wan interface. Here we have to enable VLANs, create a third VLAN and swap configurations between VLAN 2 and 3:
Now we need to tell the WAN interface to use VLAN 3 instead of VLAN 2:
It can take about a minute for services to return after this reboot.
Welcome back! Hopefully you didn't make any typos and haven't had to factory reset the box once or twice to get here. Now we're going to create the interface for voice traffic:
You will now be taken to the page titled Interfaces - Voice.
Here we set the basic IPv4 configuration for this interface (did I mention I'm assuming IPv4?).
After clicking on the Firewall Settings tab, we will assign the Voice interface to the lan firewall zone:
I required a DHCP server for the VOIP handsets, so here's what we set:
That's it. Everything else is automatically determined by the IPv4 address you set in Common Configuration. I set the limit 100 as that is the dedicated DHCP range for VOIP handsets on that LAN. You could probably safely leave it at 150 (the default) or set it to the range appropriate for your network.
Now we need to tell the OpenWRT switch which ports will be active on the Voice VLAN. In this example I select all 4 LAN ports on the WDR4300:
This picture illustrates the connection between switch ports in OpentWRT and the physical ports on the WDR4300, as well as the final switch configuration:
Okay, let's roill the dice and hope it comes back up:
If you've not made any typos, it should all came back up and you'll have a working VLAN 2 for voice. If you can't access the box, you've made typo. Factory reset and try again. Happy VLAN-ing!