My network in my house has a few VLAN’s to help devide the traffic up into logical segments. I have a Voice VLAN that is used for VoIP so I can apply QoS to the VoIP traffic. This makes sure that regular traffic doesn’t affect the telephone traffic. The VLAN ID I use for Voice is 20. You can pick any number for a VLAN ID from 2 to 4095 (Check your switch to see how many VLANs are supported).
Trixbox is build on CentOS (Red Hat based) so this howto will also apply to any Red Hat based Linux. Plase also not the following:
- Not all network drivers support VLANs but most do.
- Do not use VLAN 1 as this is usually refered to as the “default” VLAN and is most likly already used.
Your existing ethernet card configuration is stored in /etc/sysconfig/network-scripts/cfg-eth0. The easiest way to create a VLAN is just to copy that file (adding the VLAN ID onto the end of the name) and then edit it.
# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0.20
Now edit the file your just created.
- Find the DEVICE=eth0 variable and change it to DEVICE=eth0.20
- Append the variable VLAN=yes to the end of the file.
- Change the IPADDR, NETMASK, and BROADCAST variables to what your require on the new VLAN.
This is what my finished file looks like:
When you are done then restart the networking with the following command (or just reboot)
# /etc/init.d/network restart