Labels

Saturday, October 20, 2012

A Little Router Conversion


After diagramming what I wanted to do in the network, I decided to change out the second and third routers (both Linksys WRT54GLs) from OpenWRT to DD-WRT.  I did this in order to remain compatible across all routers that I had in the house.  Also I wanted to learn something about setting up a router for vlans and multiple wireless SSIDs.  The conversion from OpenWRT to DD-WRT is simple, you download the appropriate dd-wrt binary and update the flash rom from the OpenWRT menu, reboot, press the reset switch for about 15 seconds and let the router boot up.  When the router comes up it will be a http://192.168.1.1 with a default password; then you log in and reset the parameters to your liking.

My requirements for the first of these routers are simple but will require a number of changes to the normal setup; most of the instructions for these can be found in the tutorials at http://www.dd-wrt.com/wiki/index.php/Tutorials:

(1) I need port 1 to be a fall back in case I do something stupid, so no vlan
(2) I want port 2 to be the trunk port with vlans 5, 6, 8, and 9 tagged (802.1Q)
(3) I want port 3 to be vlan 6 with no tags [connect this to port 2]
(4) I want port 4 to be vlan 8 with no tags [connect this to port 2]
(5) I want vlan 5, 6, 8, and 9 to be separate from each other
(6) I want the wireless to come in on vlan 5 with no tags [connect this to port 2]
(7) Later on I want to have a separate wireless SSID on vlan 9 with no tags [connect to port 2]
(8) I will be using the router as a WAP, therefore the WAN port should be deactivated

First I activated the SSH server on the router and logged in as user.  I started off with setting up four new vlans numbered 5, 6, 8, and 9.  To do this you activate a hardware name:

root@DD-WRT:~# nvram show | grep vlan.*hwname
vlan1hwname=et0
size: 22970 bytes (9798 left)
vlan0hwname=et0
root@DD-WRT:~# nvram set vlan5hwname=et0
root@DD-WRT:~# nvram set vlan6hwname=et0
root@DD-WRT:~# nvram set vlan8hwname=et0
root@DD-WRT:~# nvram set vlan9hwname=et0
root@DD-WRT:~# nvram show | grep vlan.*hwname
vlan6hwname=et0
vlan9hwname=et0
vlan5hwname=et0
vlan1hwname=et0
vlan8hwname=et0
size: 23034 bytes (9734 left)
vlan0hwname=et0

Next, I change the port settings around so that ports are connected in a different arrangement.  The WRT54GL router has the ports numbered backwards according to the instructions on the DD-WRT site.  To start with, we associate ports with vlans:

root@DD-WRT:~# nvram show | grep vlan.*ports
vlan0ports=3 2 1 0 5*
vlan1ports=4 5
size: 23034 bytes (9734 left)
root@DD-WRT:~# nvram set vlan6ports="2t 1 5*"
root@DD-WRT:~# nvram set vlan8ports="2t 0 5*"
root@DD-WRT:~# nvram set vlan0ports="3 5*"
root@DD-WRT:~# nvram show | grep vlan.*ports
vlan6ports=2t 1 5*
vlan0ports=3 5*
vlan1ports=4 5
size: 23066 bytes (9702 left)
vlan8ports=2t 0 5*

Now we associate in the opposite direction to complete the setup:

root@DD-WRT:~# nvram show | grep port.*vlans
port5vlans=0 1 16
port3vlans=0 18 19
port1vlans=0 18 19
port4vlans=0 18 19
port2vlans=0 18 19
size: 23066 bytes (9702 left)
port0vlans=1 18 19
root@DD-WRT2:~# nvram set port5vlans="0 1 6 8 16"
root@DD-WRT2:~# nvram set port2vlans="6 8 16 18 19"
root@DD-WRT2:~# nvram set port3vlans="6 18 19"
root@DD-WRT2:~# nvram set port4vlans="8 18 19"
root@DD-WRT2:~# nvram show | grep port.*vlans
port5vlans=0 1 6 8 16
port3vlans=6 18 19
port1vlans=0 18 19
port4vlans=8 18 19
size: 23298 bytes (9470 left)
port2vlans=6 8 16 18 19
port0vlans=1 18 19

Lastly we do a commit and reboot the router.

root@DD-WRT:~# nvram commit
nvram_commit(): end
root@DD-WRT:~# reboot

At this point, we have the vlans on the correct ports but the connections are not correct to the trunk line.  A little more work is involved.

--LW