Networking

Configure VLAN’s in Trixbox

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.

  1. Find the DEVICE=eth0 variable and change it to DEVICE=eth0.20
  2. Append the variable VLAN=yes to the end of the file.
  3. Change the IPADDR, NETMASK, and BROADCAST variables to what your require on the new VLAN.

 This is what my finished file looks like:

DEVICE=eth0.20
BOOTPROTO=static
DHCPCLASS=
HWADDR=00:D0:87:BA:8E:B8
ONBOOT=yes
TYPE=Ethernet
IPADDR=192.75.200.10
NETMASK=255.255.255.0
BROADCAST=192.75.200.255
NETWORK=192.75.200.0
NOZEROCONF=yes
VLAN=yes

When you are done then restart the networking with the following command (or just reboot)

# /etc/init.d/network restart

Leave a Comment

Your email address will not be published. Required fields are marked *