Topic: VLANs numbering conventions?

Can I define----say----VLANs 0, 1, 2, 3, and 8, leaving out 4 thru 7? Of so, will this just setup 5 VLANs as intended or will VLANs 4 thru 7 be initialized "silently", eating up memory? If applicable, what is the highest "naming number" one can use? And what's the highest number of VLANs that can be run simultaneously?

I'm asking because I have a number of VLANs for my LAN and WLAN that will almost certainly increase in the future. So I'd like to get the WAN VLAN out of the way by giving it a higher number. This would allow me to keep VLANs for LAN and WLAN in one block without having to renumber the one for WAN every time I add or delete a VLAN to/from that block----leaving firewall rules etcetera intact. I'd also like to keep my main LAN on VLAN 0 to stay closer to a standard setup.

Right now I'm still using White Russian on Broadcom hardware, but I'm planning to make the switch to Backfire on Atheros some time soon. I wasn't able to find any information covering these questions in the docs, nor on this forum. So, any help would be appreciated. Thanks!

Re: VLANs numbering conventions?

I was able to find a partial answer within X-WRT's webif shell script:

    # toggles and default settings
    ALLOW_VLAN_NUMBERING_GAPS=0 # toggle alowance of gaps, i.e. vlan0, vlan1, vlan5 are defined
                    # note: allowing gaps makes for a much slower loading page since
                    #  we have to search through MAX_VLANS instead of stopping at first
                    #  unset vlan variable.
    PORT_BASE=0        # base number of the ports
    PORT_COUNT=6        # number of ports (todo: should determine dynamically)
    MAX_PORT=5        # maximum port number (todo: should determine dynamically)
    MAX_VLANS=16        # limit the switch can handle on the bcm947xx (todo: dynamically determine)
    MAX_VLANS_INDEX=15    # like MAX_VLANS, except starts at 0 instead of 1

So gaps within VLAN namings seem to be OK but slow down webif processing. No word on OpenWRT processing time and memory usage though. 16 seems to be the maximum number of allowed VLANs because of Broadcom's limitation in hardware VLAN handling.

Re: VLANs numbering conventions?

VLANs are created on Layer 2 switches to control broadcasts and enforce the use of a Layer 3 device for communications. Each VLAN is created in the local switch's database for use. If a VLAN is not known to a switch, that switch cannot transfer traffic across any of its ports for that VLAN. VLANs are created by number, and there are two ranges of usable VLAN numbers..

Re: VLANs numbering conventions?

Thanks for your answer! I'm not sure, however, what the two ranges of usable VLAN numbers might be. Please elaborate just a bit more.

Maybe my wording on "naming" vs. "numbering" was misleading. I know we're always talking about numerical values here. But numbers can either be used as free "labels" or consecutively in an enumerating fashion. From those shell script comments above I guess we're talking about mere labels, so I could use whichever numbers I please as identifiers. But now you mentioned "two ranges of usable VLAN numbers" which has me confused again.

I know that OpenWRT's VLAN implementation is based on IEEE 802.1Q which theoretically offers 12bits for its VLAN identifiers. But can all of them actually be used? For instance, according to those shell script comments above my Broadcom switch is probably limited to 4 bits (I'm still using a Linksys WRT54GS v1.1) and other devices may have even stricter limits. So maybe OpenWRT is limited to some sub-12bit number to preserve compatibility? But then again this wouldn't be true IEEE 802.1Q compliance anymore, so I doubt it. I also know that OpenWRT offers VLAN support in software for switch chips without hardware VLAN capabilities. So maybe OpenWRT would switch over to its software implementation if I went beyond those 4bits supported on my Broadcom switch?

BTW: I'm using VLANs for a bunch of access points connected by trunk lines to a central router. Each of these access points offers the same set of (multiple) SSIDs belonging to different subnets, offering different levels of services and privileges.

Re: VLANs numbering conventions?

Broadcom switches are limited to 4 bit VLAN IDs (you can in theory specify one 8 bit prefix for all 16 VLANs, but this isn't supported in Openwrt and is therefore "hardwired" to 0), but Realtek and Atheros switches can use the whole 12 bit VID range.

Some Atheros switches can only support up to 16 VLAN definitions, but may use any VID for these VLANs, in that case there is an extra VLAN numbering (as the index into the 16 entry VLAN table).

penkert wrote:

So maybe OpenWRT would switch over to its software implementation if I went beyond those 4bits supported on my Broadcom switch?

This is impossible since you can't specify to which port(s) a frame should go, except by using a VID with appropriate port membership. Also (at least the smaller) broadcom switches do not support Q-in-Q tagging, so you can't use tagged VLANs with this. Also this would bring a serious performancy panalty, because the CPU now has to do any switching.


Re: VLANs numbering conventions?

Great, got it. And thank you very much for your help!