A great feature of Linux and Xen is the ability to run DomU’s on multiple networks. To do this we first need to set up the VLAN’s on a switch and then set the port the Dom0 is connected to allow for 802.1q traffic. On a Cisco switch, log into the IOS and change the interface that the server is sitting on and type:
switch(config-if) switchport trunk encapsulation dot1q
switch(config-if) switchport mode trunk
Once this is done we can then configure Dom0 to communicate to these networks. In CentOS, you need to change directories to /etc/sysconfig/network-scripts.
First copy the ifcfg-eth0 file to make a back up then edit the file as follows:
Next we create four new files which will define our VLAN and non-VLAN traffic. The first two files will define which VLANs the server should listen on:
Create the file: /etc/sysconfig/network-scripts/ifcfg-eth0.17. This will define VLAN 17.
Then enter in the following:
Make a secondary file which will sit on VLAN 192, VLAN 192 is where the IP of the Dom0 will reside.
The next two files will define the bridged interfaces. These are necessary to strip the 802.1q header so the server and DomU’s can communicate across the network. The first file will be for the publicly routable network:
The next file will be for the internal network.
After that reboot the server.
Next create a virtual instance with virt-install and run it as follows:
virt-install –name test –ram 1024 –location ‘centos mirror’ -f /dev/lvm/test -b xenbr17 -p
The ‘-b’ is important as it will define the bridge the new server will sit on.