XCP-ng: Evolution of Lab V2.0 - Network configuration of the pool and VM migration
- Objective: A consistent network logic to prepare for high availability of the pool.
- Configuration of multiple VLANs and parameterization of the PIFs on the second card (eth1).
- Checks and tests of VM migration between nodes, including "Warm migration".
- Limitations observed when moving between local SRs.
Introduction
Now it's time to get down to business.
If we take a quick look at the steps:
- We have installed XCP-ng on three physical servers
- We have configured each server with local storage dedicated to VMs
- We have deployed via CLI on the first server (prdxcpsrv001) a Rocky Linux 10 VM
- We have installed Xen Orchestra on this VM from source
- From Xen Orchestra (XO), we created a pool xcp-pool in which we registered the three servers
We now have an excellent foundation for designing a HA architecture as we aspired to in the introduction of this tutorial.
The logical next step is to focus on the network, because, for everything to work correctly, we need an appropriate and consistent network logic.
Target
As a reminder, each server has a 1G card, already in operation and used for access to the various servers (and mapped to the Xen Orchestra VM). Each server has an IP address in 192.168.10.0/24 associated with this card and uses this subnet to communicate with each other. This interface is also used for SSH access.
In XCP, this corresponds in the Network section of a node in Xen Orchestra to: Pool-wide network associated with eth0.
Click the image to enlarge.
In XCP terminology, we talk about PIFs for Physical Interface. You can see the small star icon indicating that it is the default interface of the node. We are therefore using the PIF eth0.
The idea is not to use this one for VM data (except for XO) and data replication between nodes, but rather to rely on the 10G interface, which is much more suitable and performant. This is the PIF eth1.
We will associate several VLANs with this interface:
- LAN: The default VLAN (so no tagging is required) provides access to my base subnet 192.168.10.0. While it's the same as the network used for server administration, it's dedicated to virtual machines. (We could have assigned a so-called out of band subnet for eth0 to separate the administrative network, but I opted for a simpler solution that meets my needs.)
- VLAN_WEB: VLAN with ID 6, dedicated to VMs exposed to the internet (subnet 192.168.5.0/24).
- VLAN_DMZ_FIRST: VLAN with ID 10, dedicated to communication with the WEB router, which has a connection to the internet service provider (subnet 192.168.8.0/24).
- VLAN_STORAGE: VLAN with ID 12, dedicated to storage replication between nodes (subnet 192.168.12.0/24); this is an unrouted network (without a gateway).
In summary, we get the following diagram:
Click the image to enlarge.
Configuration
Switch
The purpose here isn't to go into detail about the configuration of the switch I'm using, which is a MikroTik CRS309-1G-8S+IN with eight 10G interfaces. It runs RouterOS by default, an extremely comprehensive system with many options and capabilities.
I'll just briefly describe the commands I've used and the overall logic. Feel free to adapt it based on your hardware.
Although RouterOS has a complete GUI, I'll prefer using the CLI via SSH access to the device.
Click the image to enlarge.
I'll skip over the initial setup of the hardware and the configuration of its administrative IP address (192.168.10.241). Keep in mind that, since I didn't know RouterOS at all, AI helped me a lot (but be careful, regarding the pure network configuration, I sometimes had surprises, and not in a good way).
By default, the router comes with a preconfigured bridge, which you can think of as a kind of virtual switch within the device. We start by removing the administrative interface (the only one with 1G) from this bridge to make it autonomous and reapply its IP address:
/interface/bridge/port remove [find interface=ether1]
/ip/address add address=192.168.10.241/24 interface=ether1
Click the image to enlarge.
Now, let's handle the DNS and gateway settings:
/IP/route add dst-address=0.0.0.0/0 gateway=192.168.10.253
/IP/dns set servers=192.168.10.30
Click the image to enlarge.
Then, we remove the default bridge:
/IP/address remove [find interface=bridge]
/interface/bridge/port remove [find bridge=bridge]
Next, we create a new bridge named bridge1, with an MTU (Maximum Transmission Unit) of 9000. This is crucial for optimizing storage replication performance. For now, we configure the vlan-filtering option to no. This means that the "virtual" switch will behave like a simple hub, ignoring internal VLAN tables (in other words, all packets are transmitted to all ports, regardless of VLANs):
/interface/bridge add name=bridge1 mtu=9000 protocol-mode=none vlan-filtering=no
Click the image to enlarge.
We add the first three 10G interfaces to this new bridge:
/interface/bridge/port add bridge=bridge1 interface=sfp-sfpplus1 pvid=1 hw=yes
/interface/bridge/port add bridge=bridge1 interface=sfp-sfpplus2 pvid=1 hw=yes
/interface/bridge/port add bridge=bridge1 interface=sfp-sfpplus3 pvid=1 hw=yes
Click the image to enlarge.
The hw=yes option is important. It enables Hardware Offloading to take advantage of the hardware acceleration available in the router.
Now, let's move on to declaring the VLANs:
# VLAN 1 (Admin/LAN) — géré nativement, mais il faut le déclarer
/interface/bridge/vlan add bridge=bridge1 vlan-ids=1 tagged=bridge1 untagged=sfp-sfpplus1,sfp-sfpplus2,sfp-sfpplus3
# VLAN 6 (WEB) — tagged sur les 3 serveurs
/interface/bridge/vlan add bridge=bridge1 vlan-ids=6 tagged=sfp-sfpplus1,sfp-sfpplus2,sfp-sfpplus3
# VLAN 10 (DMZ_FIRST) — tagged sur les 3 serveurs
/interface/bridge/vlan add bridge=bridge1 vlan-ids=10 tagged=sfp-sfpplus1,sfp-sfpplus2,sfp-sfpplus3
# VLAN 12 (STOCKAGE) — tagged sur les 3 serveurs
/interface/bridge/vlan add bridge=bridge1 vlan-ids=12 tagged=sfp-sfpplus1,sfp-sfpplus2,sfp-sfpplus3
Click the image to enlarge.
For my needs, I also add the last 10G interface (port 8) to bridge1. This is my interconnection link with my current lab. It's a trunk that we need to allow all VLANs to pass through.
We associate port 8 with bridge1 (pvid=1: traffic arriving on this port without a tag will be placed in VLAN 1):
/interface/bridge/port add bridge=bridge1 interface=sfp-sfpplus8 pvid=1 hw=yes
Click the image to enlarge.
Next, we proceed with the commands that define how 802.1Q tags are processed:
# --- VLAN 1 (Management / Natif) ---
/interface bridge vlan
set [find vlan-ids=1] tagged=bridge1 untagged=sfp-sfpplus8
# --- VLAN 10 (DMZ_FIRST) ---
/interface bridge vlan
set [find vlan-ids=10] tagged=bridge1 untagged=sfp-sfpplus8
# --- VLAN 6 (DMZ_web) ---
/interface bridge vlan
set [find vlan-ids=6] tagged=bridge1 untagged=sfp-sfpplus8
Click the image to enlarge.
We define VLAN 1 as "Access/Native" on all these ports. Traffic will exit untagged to connected devices:
/interface/bridge/vlan
set 0 tagged=bridge1 untagged=sfp-sfpplus1,sfp-sfpplus2,sfp-sfpplus3,sfp-sfpplus8
We define VLAN 10 as "Tagged" on all these ports, ensuring that none of them allow VLAN 10 to exit without a tag:
/interface/bridge/vlan
set 2 tagged=sfp-sfpplus1,sfp-sfpplus2,sfp-sfpplus3,sfp-sfpplus8 untagged=""
The same applies to VLAN 6:
/interface/bridge/vlan
set 1 tagged=sfp-sfpplus1,sfp-sfpplus2,sfp-sfpplus3,sfp-sfpplus8 untagged=""
(set 2 corresponds to VLAN ID 10, set 1 to VLAN ID 6, and set 0 to VLAN ID 1. This is the index of the VLAN in the switch configuration, and the correlation is visible with the command /interface/bridge/vlan print.)
There's no need to put VLAN 12 in the trunk; it's local to the switch between the XCP-ng nodes.
Finally, we enable the MTU of 9000 on all 10G interfaces (we have already enabled it at the global level and for bridge1, but it also needs to be done on the ports). This can be a bit confusing: you need to enter 9100 to be above 9000:
/interface ethernet set [find where name~ "sfp-sfpplus"] mtu=9100
Finally, we enable vlan-filtering to make our virtual bridge1 switch intelligent:
/interface bridge set bridge1 vlan-filtering=yes
To control everything, you can use the following command. The HW field must be set to yes everywhere.
/interface bridge port print
Click the image to enlarge.
Note that, of course, I have configured a compatible configuration on the other switch in my lab (the ZYXEL XGS1210-12) so that the trunk works.
XCP-ng/XO
We can now return to the Xen Orchestra interface, where we will configure the network settings for the pool. To do this, we need to switch back to version 5 of the XO GUI.
Removing the default eth1 configuration
First, let's remove the default configuration that was applied to eth1. To do this, go to the network settings for each server, select the eth1 interface, and then click Remove.
Next, at the pool level, we will rename the eth1 interface to eth1-10G for better readability. We'll also take this opportunity to change the interface's MTU to 9000
Go back to each server's configuration, in the network settings, to refresh the interfaces
When the interface appears, click Connected
Creating VLANs
We will use the New menu and then select Network, choosing our pool. For each VLAN, we will add an interface based on the eth1 interface (the name of the XCP-ng server is the name of your pool's master). The idea is to do this for each VLAN, specifying its ID and MTU: 1500 by default, and 9000 for the storage VLAN.
Click the image to enlarge.
Click the image to enlarge.
Click the image to enlarge.
Click the image to enlarge.
Click the image to enlarge.
In the end, we get this result (feel free to fill in the description field).
Click the image to enlarge.
For those who are trying to relate this to the VMware world, let's say that we have just configured port groups for VM traffic, excluding the storage VLAN.
In fact, we still need a final configuration for the VLAN dedicated to storage. Unlike other VLANs attached to VMs, VLAN 12 will be used by the XCP-ng servers themselves. These servers must have an IP address on this VLAN (at least the Dom0). To do this, switch to CLI mode via SSH on the pool master, and then run the following commands:
xe pif-reconfigure-ip uuid=$(xe pif-list device=eth1 VLAN=12 host-uuid=$(xe host-list name-label=prdxcpsrv003 --minimal) --minimal) mode=static IP=192.168.12.3 netmask=255.255.255.0
xe pif-reconfigure-ip uuid=$(xe pif-list device=eth1 VLAN=12 host-uuid=$(xe host-list name-label=prdxcpsrv002 --minimal) --minimal) mode=static IP=192.168.12.2 netmask=255.255.255.0
xe pif-reconfigure-ip uuid=$(xe pif-list device=eth1 VLAN=12 host-uuid=$(xe host-list name-label=prdxcpsrv001 --minimal) --minimal) mode=static IP=192.168.12.1 netmask=255.255.255.0
Click the image to enlarge.
In this way, each VM in the Dom0 of the XCP-ng servers will have an IP address in the 192.168.12.0 range assigned to the eth1 interface with a tag on VLAN 12.
We can check everything by connecting via SSH to the different nodes and using the ping command to the IP addresses of VLAN 12. By adding the -s 8972 option, we force the packet size to be greater than 1500, which also allows us to verify that the MTU is OK:
ping -s 8972 -M do 192.168.12.2
ping -s 8972 -M do 192.168.12.3
Click the image to enlarge.
Checks
VM Migration
To validate the proper functioning of everything, let's start a VM directly from Xen Orchestra (GUI v5.0). We will play with the network interfaces while moving the VM from one server to another, just to see if everything is working correctly.
Creating the witness VM
To do this, we will start with an operating system that I am increasingly fond of: Zorin OS. At the time of writing this article, I no longer understand what Microsoft is doing with Windows 11, especially in a professional environment. The operating system is becoming more and more bloated and imposes restrictions on web access, even for professional use. Until now, I had found an alternative with Tiny11, a script that allows you to offer a version of Windows 11 free from all unnecessary features, but now, I prefer Zorin OS.
I am taking this opportunity to briefly discuss this operating system based on Ubuntu, which in my opinion offers one of the best possible Linux integrations for UI-based work. I encourage you to try it out.
Click the image to enlarge.
To deploy our test VM, simply click on New VM. Zorin OS is not listed in the available templates, but version 18 of this operating system, which I will be using, is based on Ubuntu 24.04, so we can use this template.
Click the image to enlarge.
Click the image to enlarge.
Next, configure the hardware settings: here, 2 vCPUs and 3 GB of RAM. Then, connect the ISO image of the operating system hosted on the NFS storage repository that was set up in a previous step. Connect the network interface to the LAN label. Finally, select the local storage repository of the server prdxcpsrv001, configuring a disk size of 30 GB (ZorinOS 18 requires a minimum of 14 GB).
Click the image to enlarge.
We validate our configuration and are immediately taken to the VM page, where we will go to the console to monitor the OS boot process. We then enter a standard operating system installation process. The ZorinOS installation is very simple to follow and implement.
Click the image to enlarge.
Click the image to enlarge.
Click the image to enlarge.
Click the image to enlarge.
And to demonstrate ZorinOS's ability to integrate into an AD environment, I am even going to register the VM on my domain. Good news: packages are downloaded during the installation, which is a good sign for network access.
Click the image to enlarge.
Click the image to enlarge.
Click the image to enlarge.
Once finished, you can remove the ISO image from the VM. On the first boot, other updates are found, which confirms our internet access. In fact, a simple ip addr command shows that the VM has an IP address on the subnet 192.168.10.0, as expected.
Click the image to enlarge.
Click the image to enlarge.
Click the image to enlarge.
To complete the installation, you can mount the ISO dedicated to XCP tools, similar to VMware Tools. You can try running the installation script included with the binaries, but it doesn't recognize ZorinOS. This isn't a problem; simply use the .deb package available with the following command:
dpkg -i <package.deb>
Click the image to enlarge.
Click the image to enlarge.
Click the image to enlarge.
Next, verify that the xe-linux-distribution service is running and enabled at startup. If everything is OK, you should normally see the agent version displayed in the VM's general information. You can then eject the tools ISO.
Click the image to enlarge.
VM Migration
Now that we know the LAN network is working correctly, we will test moving a VM while it's running. The VM is currently running on the first server prdxcpsrv001, as it's hosted on the server's local disk (the SR). We will try to move the VM to prdxcpsrv002, moving both the VM context and its data.
Currently, if you attempt this, the 1G link will be used, which is a shame since we have a 10G card with an additional network dedicated to storage between the nodes. Even though we haven't configured any block replication solutions yet, we could at least use it to move VMs.
To do this, connect via SSH to the master of the pool (in the screenshots, I am on prdxcpsrv002 because in the meantime, I performed tests that caused the master to switch to the second server, but this isn't a problem).
List the networks:
xe network-list params=uuid,name-label,bridge
List the UUIDs of the hosts:
xe host-list params=uuid,name-label
Click the image to enlarge.
Associate the VLAN storage UUID (e140fba2-482f-66bc-1869-c80d2f1cf674) with each host's UUID to indicate that we will use it as the migration network:
xe host-param-set uuid=503e202a-7ad2-4dbf-a575-ed81df29e89d other-config:migration_network_uuid=e140fba2-482f-66bc-1869-c80d2f1cf674
xe host-param-set uuid=0b1350b3-0e6a-4343-a51b-321740185b24 other-config:migration_network_uuid=e140fba2-482f-66bc-1869-c80d2f1cf674
xe host-param-set uuid=3e0daa17-41a7-45a8-b2fb-bef287aa11e6 other-config:migration_network_uuid=e140fba2-482f-66bc-1869-c80d2f1cf674
Click the image to enlarge.
Everything is ready for our test. We will run a continuous ping between the VM and my fixed PC, which is on the same subnet, to monitor for potential interruptions.
Click the image to enlarge.
In the Advanced options of the VM, click on Warm migration, making sure to select the options to delete from the source and start automatically at the destination. Select the local SR of prdxcpsrv002 and start.
Click the image to enlarge.
Click the image to enlarge.
This will immediately trigger tasks that are visible in the XO GUI. The data will therefore be copied from one SR to another, which will then allow the VM to resume on prdxcpsrv002. Next, we will start the VM context on prdxcpsrv002 and clean up any remaining files on prdxcpsrv001.
Click the image to enlarge.
We are not performing this operation with zero downtime. Once the data is copied to the storage repository prdxcpsrv002, the VM is disconnected from prdxcpsrv001 and restarted in the state of the snapshot that was taken at the time of migration initiation on the destination node, where the data has just been placed. We experienced a clear interruption for 2 minutes 51 seconds during our test.
Click the image to enlarge.
The VM is also restarted, but the test is successful. It's important to remember that, for now, we do not have shared storage for running VMs between nodes in the pool. We have successfully moved a VM from one local storage location to another between two servers.
One last small thing to do: rename the VM correctly on prdxcpsrv002, since XO by default gives it a very long name.
Click the image to enlarge.
Click the image to enlarge.
Network change
Now that the VM has been moved, let's try changing its network. To do this, it's quite simple: go to the VM settings and then the network tab, and change the label associated with the VIF (Virtual Interface). For example, place it on the VLAN_WEB.
Click the image to enlarge.
Click the image to enlarge.
Click the image to enlarge.
A quick disconnect/reconnect on the VM at the ZorinOS level, and it now has an IP address in the 192.168.5.0 range.
Click the image to enlarge.
Conclusion
We now have a functional network configuration that is shared within the xcp pool. We are already able to move VMs from one server to another, although with an interruption, but each server can resume the VM from another server via a manual operation.
We don't yet have the equivalent of vMotion, at least for moving a VM from one local storage repository to another (if a server had multiple local storage repositories, we could move a VM between them while staying on the same server and without interruption). The ergonomics of "Warm migration" are also a bit peculiar (if you don't check the boxes for stopping at the source and restarting at the destination, you will end up with an error message). We look forward to the complete transition to the XO 6 GUI
Nevertheless, the foundation is there, and all that remains is to configure a shared storage space to offer a complete HA experience. But that's in the next article.