Enabling VLAN Support for BCM4704

From DD-WRT Wiki

Revision as of 03:08, 18 December 2010 by Phuzi0n (Talk | contribs)
Jump to: navigation, search

Contents

Introduction

BCM4704 is a rather unique chipset compared to most Broadcom based hardware. It has separate internal interfaces for the WAN port and LAN switch whereas most other Broadcom hardware has a single interface which is then split into VLAN's. Hardware VLAN support can be enabled for the LAN switch of BCM4704 based devices. For whatever reason the devs don't enable VLAN support for BCM4704 based devices by default so this will explain how to enable it.

Note: Since the WAN port is a separate interface it will not be affected by this. The WAN port column will still show up on the VLAN GUI page simply because the GUI isn't coded to know any better. If you want to use the WAN port with VLAN's then you can use the Linux kernel's software VLAN tagging and bridging on the networking page but that's another topic.

Hidden Support

Eko has been kind enough to add hidden support for some BCM4704 models which can be enabled by setting an nvram variable via Telnet/SSH like so:

nvram set force_vlan_supp=enabled

As of revision 15925 the following BCM4704 models may use this method:

  • NETGEAR_WNDR3300
  • WRT160N
  • WRTSL54GS

Also these models may use this method but must also set the boardflags as described later:

  • NETGEAR_WNR834BV2
  • WRT150N


For reference, you can check which models support this method by looking at the source code in this file for two CASE statements that match your model name and have "force_vlan_supp" statements. One CASE configures the interfaces and the other CASE sets boardflags.

Very Hidden Support

The force_vlan_supp nvram variable just tells the firmware to change a few other nvram variables which you can do manually on any Broadcom based hardware to enable VLAN support.

Configure Boardflags

The boardflags nvram variables contains a hexadecimal number which tells what features the hardware is capable of based on which bits are set. If the 0x0100 bit is set then the hardware is capable of VLAN's. By default this bit is not set on BCM4704 devices so you must set it to enable VLAN support.

To do so, first check what the current boardflags are set to by running this command.

nvram get boardflags

There may be less than 4 hexadecimal digits in the nvram variable but that's not important. You just need to make sure to change it to have the 0x0100 bit set along with whatever other bits are already set. To do so use a hexadecimal capable calculator to perform a binary OR operation between the number currently in your boardflags variable and 0x100, leave off the 0x which just means it's a hexadecimal number.

For example if your boardflags are currently 0x10 then it would result in 0x10 OR 0x100 = 0x110. Another example using an extremely unlikely set of boardflags such as 0x7C9E would result in 0x7C9E OR 0x100 = 0x7D9E.

After you figure out the new value then you need to set your boardflags to the new value like this..

nvram set boardflags=0x110

Configure VLAN's

As explained more in depth on the Switched Ports page, nvram variables controlling which ports belong to which VLAN's need to be set. Run this to put all the LAN ports in VLAN 1 and clear out anything in VLAN 0 just in case the firmware set it. The firmware would normally use VLAN 0 but you should avoid VLAN 0 when possible due to the problem with trunking explained on the switched ports page.

nvram set vlan0ports=5
nvram set vlan1ports="0 1 2 3 5*"
nvram set vlan1hwname=et0

The VLAN GUI page may have the port numbering backwards from what is on your case. If so and you care about it then move all the ports back to only VLAN 1 and run this.

nvram set vlan1ports="3 2 1 0 5*"

Configure the LAN Bridge

By default the LAN switch interface is eth0 on BCM4704 based devices. DD-WRT puts the LAN switch interface in a bridge with the wireless interface(s). After VLAN's are enabled this interface won't be usable anymore and the VLAN interfaces will need to be put in the bridge instead. To do so you must first check what interfaces are in the LAN bridge using this command.

nvram get lan_ifnames

A list of interfaces will be output and you just need to change eth0 to vlan1 so that the vlan1 interface will be in the bridge instead of eth0. For instance if your lan_ifnames are "eth0 eth2 wl0.1" then you would set it like this.

nvram set lan_ifnames="vlan1 eth2 wl0.1"

Finish Configuration

After you've set all your nvram variables you need to commit them to the flash chip and reboot for it all to take effect.

nvram commit
reboot