Configure DD-WRT v23sp2 VOIP for seperate vLAN on port 4 with seperate DHCP
This HOWTO explains how to setup 2 vLAN subnets on Linksys WRT54G routers with DD-WRT v23sp2 firmware. Systems or Networks connected to Port 4 on the router will be able to access the Internet but will not be able to access ports 1-3. Switch Ports 1-3 will be able to access the Internet as well as port4.
Additionally, a DHCP server will be setup for each subnet. Ports 1-3 vLAN is on the 192.168.57.x subnet. Port 4 vLAN is on the 192.168.58.x subnet.
1. Login to the router's web interface, click the vLAN tab under Setup, uncheck Port 4 from vLAN 0 and check it to vLAN 2.
2. Click the Administration tab, then click Commands and copy the following lines into the box and hit Run Commands
- nvram set vlan0ports="1 2 3 5*"
- nvram set vlan2hwname=et0
- nvram set vlan2ports="4 5"
3. Type the following into the Commands box then hit Save Startup
- ifconfig vlan2 192.168.58.1 netmask 255.255.255.0
- Note that this IP address is the one for Port 4, in this example 192.168.58.1
4. Now, per the same page above, we're going to modify the iptables to properly route everything. Type the following lines into the same box on the Commands page and click Save Firewall
- iptables -I FORWARD -i vlan1 -o vlan2 -j ACCEPT
- iptables -I FORWARD -i vlan2 -o vlan1 -j ACCEPT
- iptables -I INPUT -i vlan2 -j ACCEPT
- iptables -I INPUT -i vlan1 -j ACCEPT
Now you've just finished the vLAN section, we need to set up DHCP to work properly. If you stop here your DHCP will work on your first vLAN (192.168.57.1) but you'll have to use static addresses on the second vLAN on port 4.
Setting up DHCP:
5. Now under the Administration tab again on your router, go to the Services tab. Find DNS Masq. Make sure DNS Masq, and Local DNS are both checked. Copy the following lines into the Additional DNS options box:
The first address is the beginning DHCP range, the second is the end of the range for that VLAN. You won't be using your DHCP settings in the GUI on the front page after this, you'll need to edit it here if you want to make changes in the future.
Click on Save Changes
6. Lastly, go to the Setup tab for your router, and under Basic Setup. Under DHCP Server set this to disable.
7. Reboot the router and test each port.