I had to set up a single interface on a server with dual DHCP IP addresses that were obtained on the native untagged interface, along with a tagged interface enslaved to VLAN bridge in order to rollout Enomaly SpotCloud. Thus the primary interface obtains its IP address via DHCP along with the bridged interface on a VLAN. To set this up, start by switching to the Network Scripts directory:


cd /etc/sysconfig/network-scripts


Then open ifcfg-eth0 with the text editor of your choice. Edit the file so it looks like the following:


DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
HWADDR=f4:ce:46:82:55:f4 


Be sure to change your MAC address accordingly.


Then create your VLAN interface configuration. Open ifcfg-eth0.1051 with the text editor of your choice. Edit the file so it looks like the following:


DEVICE=eth0.1051
BOOTPROTO=dhcp
VLAN=yes
BRIDGE=virbr0
ONBOOT=yes


Then create your bridge interface configuration. Open ifcfg-virbr0 and edit the file so it looks like the following:


DEVICE=virbr0
TYPE=Bridge
ONBOOT=yes
DELAY=0
BOOTPROTO=dhcp


Note that TYPE must be Bridge with a capital B - otherwise it won't work. And there you have it - when the box boots it gets a DHCP lease on eth0 and on virbr0 which is on VLAN 1051.


Originally published 1 June 2013.