Xen Cloud Platform (XCP) – Setting Up A VLAN
One very useful feature of XCP is the ability to setup VLAN networks for your virtual machines to use. This gives an administrator fine grained control on what network a machine belongs on. This will work as long as the network interface that is assigned to your VM’s is plugged into a trunked port on a switch that has been setup with VLAN tags.
In order to start assigning VLAN’s to a physical interface or pif in Xen terms do the following:
Get a list of the physical network interfaces and their corresponding UUID’s:
xe pif-list
This should return something similar to this:
uuid ( RO): 3ebae448-8520-1d92-32b8-322be6018909 device ( RO): eth0 currently-attached ( RO): true VLAN ( RO): -1 network-uuid ( RO): 0eb1efb3-60c4-f754-ccee-607ea7419524 uuid ( RO): e602777f-b4e9-e231-7858-81189c47c434 device ( RO): eth1 currently-attached ( RO): true VLAN ( RO): -1 network-uuid ( RO): df87728a-e4a7-a16e-9f8c-c4c4c26dc35f
This shows us the 2 network interfaces that are installed in the server. ETH0 is assigned as the management interface and ETH1 is assigned to the virtual machines.
Now we need to create a new network for our VLAN:
xe network-create name-label=network201
This creates a new network named network201 that corresponds to the VLAN tag 201 on the switch. When running this command you will get a uuid as output.
d14427c2-4940-0db1-7d96-f55434af319e
Now we need to assign the VLAN tag 201 to this network, and bind it to a physical interface (eth1 in this case):
xe vlan-create network-uuid=85a9aba5-73ea-4008-0a28-395c96be30fd \ pif-uuid=e602777f-b4e9-e231-7858-81189c47c434 vlan=201
Thats it the new VLAN201 is created and can be selected for use by your virtual machines. You can confirm it’s presence by doing:
xe pif-list
Which now will display your 2 physical interfaces as well as the new VLAN201 interface:
uuid ( RO): d14427c2-4940-0db1-7d96-f55434af319e device ( RO): eth1 currently-attached ( RO): true VLAN ( RO): 201 network-uuid ( RO): 85a9aba5-73ea-4008-0a28-395c96be30fd