Working with VLANs in Linux

I was recently working with a Dell PowerEdge M610 blade server that had a processor problem. During troubleshooting steps, Dell requested a DSET report from my ESXi host. I knew this wouldn’t be a problem as I could use the live boot CD (described here).

After I booted the live CD I was able to run the requested DSET report. However, once I had the report I needed network connectivity to get it out of the live CD environment. The problem is that my network adapters only have 802.1Q VLAN tagged interfaces. To access the network I needed to specify the VLAN ID. This is a very common configuration for ESX/ESXi hosts, but I wasn’t sure how to make it work in the live CD Linux. This wouldn’t be a very complicated configuration for a Linux guy, but as a Windows admin it took me a few minutes to figure out. After some googling, I came up with the following:

vconfig add eth0 55
ifconfig eth0.55 10.55.0.20 netmask 255.255.255.0 broadcast 10.55.0.255 up
route add default gw 10.55.0.1 eth0.55

(Assuming that my interface is eth0, the VLAN ID is 55, the subnet is 10.55.0.0/24, I wish to assign the address 10.55.0.20 and the default gateway is 10.55.0.1)

This entry was posted in Virtualization. Bookmark the permalink.

2 Responses to Working with VLANs in Linux

  1. Nice post. If you’re wanting to make permanently add a 802.1q interface on a Linux server (that will persist after reboot), you can create a file in /etc/sysconfig/network-scripts (at least in Red Hat based distros). For instance to create a permanent 802.1q interface for VLAN 55 on eth0, the file would be named ifcfg-eth0.55

    You can just copy the normal interface file and change the addresses specified as needed. Then, instance of DEVICE=eth0, you would just put DEVICE=eth0.55

  2. Avi Wollman says:

    Thank you, this was EXACTLY what I needed. May God bless you.

Leave a Reply

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

*

Notify me of followup comments via e-mail. You can also subscribe without commenting.