So, I have finally got everything working as it should. Here is a brief HOWTO:
Create a bridge using your primary address and assign an alias to one of your secondary addresses. This is my resulting /etc/network/interfaces file:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
iface lo inet loopback
iface br0 inet static
post-up ifconfig br0 up promisc
post-up ifconfig br0:0 18.104.22.168 netmask 255.255.255.248 broadcast 22.214.171.124
If you notice, this is a strange way of editing the interfaces file. If I defined the alias br0:0
as a separate entry, networking would simply not work.
Setup libvirt / KVM and build your server using vmbuilder.
See the Server Guide for instructions:
In my case, I passed the following networking flags to vmbuilder:
--ip=126.96.36.199 --gw=188.8.131.52 --mask=255.255.255.248
I set the default gateway to the virtual machine's eth0 IP address, as it wouldn't be able to see the gateway provided by the datacenter otherwise.
Then, edit your virtual machine using virsh edit MachineName
Look for the line
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'/>
and replace 127.0.0.1
with your primary IP.
Use xvncviewer to connect to the virtual machine:
Then I added the following line to the VM's /etc/network/interfaces file:
post-up route add default gw 184.108.40.206
And voila! All my troubles have gone away.
Install SSHd, edit the XML file back to 127.0.0.1 (why have an unencrypted VNC session when SSH is faster and safer?) and carry on with your work.
It may not be a pretty solution, but it's the only one that worked for me and this problem drove me up the wall for a long time.