This article specifies a calculation method for assignment of VLAN numbers.
The objective is to correlate vlan numbers with any given subnet. Typically, the vlan number matches the third octet of the subnet used inside the vlan. However, this only works out when using full class C subnet allocations. If subnetting is used to further shrink the network allocation size (ex. using a /25,/26,/27,/28 bit mask) – correlating an associated vlan number is a little harder. In order to resolve this, a calculation can be used to assign all vlan numbers.
| 1st Octet | 2nd Octet | 3rd Octet | 4th Octet |
| 10 | 1 | 10 | 0 |
Using the example above, to assign the associated vlan number, use the following formula:
(256*(Subnet - 1) + thirdOctet)
Where Subnet = the iteration being used
Explanation:
If a class C mask (/24) is used then Subnet is 1
If the mask is greater than 24, then start by calculating how many subnets can be contained inside the class C. Once the network is subnettted, use the subnet number of the network being used.
Exceptions:
If the thirdOctet is zero, then use 255 as the 3rd Octet number
The numbering plan assumes the second octet will always be the same. Since this particular scheme only calculates using the third octet, it would produce duplicate vlan numbers, For Example: 10.1.10.0 & 10.2.10.0 This wouldn’t be a problem if we were using the two subnets on two totally different local area networks (ex: different offices, etc.) because you can reuse vlan numbers that are on separate switch domains.
Example:
10.1.10.0 will be further sub-netted using a /28 mask. For this example, the table shows the number of subnets available. With using the /28 or 255.255.255.240 mask, there are 16 available subnets available.
| Iteration | Network | Iteration | Network | Iteration | Network |
| 1 | 10.1.10.0 | 8 | 10.1.10.112 | 15 | 10.1.10.224 |
| 2 | 10.1.10.16 | 9 | 10.1.10.128 | 16 | 10.1.10.240 |
| 3 | 10.1.10.32 | 10 | 10.1.10.144 | ||
| 4 | 10.1.10.48 | 11 | 10.1.10.160 | ||
| 5 | 10.1.10.64 | 12 | 10.1.10.176 | ||
| 6 | 10.1.10.80 | 13 | 10.1.10.192 | ||
| 7 | 10.1.10.96 | 14 | 10.1.10.208 | ||
If we were using the 10.1.10.0 network then Subnet = 1
If we were using the 10.1.10.32 network then Subnet = 3
If we were using the 10.1.10.240 network then Subnet = 16
Final VLAN numbers for the three examples above:
10.1.10.0 = Vlan 10
(256 * (1-1) + 10) = 10
10.1.10.32 = Vlan 522
(256 * (3-1) + 10) = 522
10.1.10.240 = Vlan 3850
(256 * (16-1) + 10) = 3850


Print This Post