[Pkg-xen-devel] Bug#682216: Bug #682216 document about VLAN configuration on dom0

Aron Xu happyaron.xu at gmail.com
Thu Aug 2 18:18:03 UTC 2012


Hi,

After reading XenServer documents and debugging, I found the previous
configuration is correct, here is the one I've configured to work:

In XCP, as in XenServer, system's network configuration doesn't really
matter, it only make sense before XCP starts and handles the network
settings. So there is no need to configure VLAN on host machine, and
you only need a minimal one active interface configured in
/etc/network/interfaces to let you be able to install software and
configure the system before XCP has been set up.

First, you'll need to configure your physical switch to use trunk
mode, with a default VLAN ID, but make sure PVID feature is disabled.
This makes all untagged network traffic being tagged as the default
VLAN ID, and other tagged ones being kept untouched. If you have PVID
enabled, then all other VLANs except the default one will not work,
because it makes the switch tag all traffic as the one specified as
the PVID value. In my example, the default VLAN is configured to 100,
so make sure the physical switch has enabled VLAN Tagging, default
VLAN ID 100, and disabled PVID.

Now, the dom0's default network can be configured as if VLAN doesn't
exist. We have 192.168.1.0/25 on VLAN 100, so lets configure eth0 in
/etc/network/interfaces like this:
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.1.120
        netmask 255.255.255.128
        gateway 192.168.1.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 8.8.8.8
        dns-search example.com

Then run the command:
# ip link set eth0 up

Now dom0 should have internet connectivity available. We should
continue install xcp-xapi packages, as well as vconfig packages. We
won'd use vconfig directly, but XCP will need it:
# apt-get install xcp-xapi vconfig

During the installation, debconf will prompt about whether to use
"bridge" or "openvswitch", choose "openvswitch" which is the default.
Next, we'll hand over the control of NICs to XCP:

# PIF_UUID=`xe pif-list device=eth0 --minimal`
# xe pif-reconfigure-ip uuid=$PIF_UUID mode=static \
     IP=192.168.1.120 netmask=255.255.255.128 gateway=192.168.1.1

Then a short outage of network (several seconds, as it reconfigures
the network) is expected, and it should be back very soon. If not,
you'll need to attach it manually by hand or using remote console:
# PIF_UUID=`xe pif-list device=eth0 --minimal`
# xe pif-attach uuid=$PIF_UUID

Then you can do the same to eth1 using xe command, there is no need to
configure it in /etc/network/interfaces if you don't think it
necessary (for the time XCP might fail to start). XCP will recognize
eth0 (bridged to xenbr0 in XCP) as the management interface by
default, and eth1 (xenbr1) as the operational interface. dom0's
default gateway will be changed to xenbr1 unless you change it
manually. You can view it using `ip route` command. Till here we have
configured dom0 side successfully.

Moving to domU side, I found it easy to configure VLAN using graphic
tools like OpenXenManager or the proprietary XenCenter (which is free
to download and use AFAIK). You can create a network and with VLAN
then, and attach to a VM. The VM will be able to have network as if
there is no VLAN in the network because XCP will handle VLAN tagging
for outbound traffic and untagging for inbound traffic. If you use xe
command line, then you need to create network, vlan and so on, I can
cook out a series of commands if you think necessary (I managed to do
that, but forgot the command right now).



-- 
Regards,
Aron Xu



More information about the Pkg-xen-devel mailing list