Linux KVM VMs on Debian SoYouStart Hosts

These notes are more for my own memory, but feel free to copy and credit.

Heavily inspired by https://binaryimpulse.com/2014/08/ovh-ip-failover-vm-configuration/

First off, using a KVM VM on SoYouStart servers isn’t quite the same as you would would normally do on a Linux host. They don’t permit network traffic to be switched via a Linux bridge, such as a br0 interface, or anything displayed by brctl show.

On the real, physical, SoYouStart server, configure /etc/network/interfaces appropriately.
Obviously, my SYS server IPv4 address is 37.187.57.69, and IPv6 address is 2001:41d0:b:545::

# 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
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 37.187.57.69
netmask 255.255.255.0
network 37.187.57.0
broadcast 37.187.57.255
gateway 37.187.57.254

iface eth0 inet6 static
address 2001:41D0:B:0545::
netmask 64
post-up /sbin/ip -family inet6 route add 2001:41D0:B:05ff:ff:ff:ff:ff dev eth0
post-up /sbin/ip -family inet6 route add default via 2001:41D0:B:05ff:ff:ff:ff:ff
pre-down /sbin/ip -family inet6 route del default via 2001:41D0:B:05ff:ff:ff:ff:ff
pre-down /sbin/ip -family inet6 route del 2001:41D0:B:05ff:ff:ff:ff:ff dev eth0

That’s the physical server networking out of the way.

Log in to the SYS control panel and use the Manage IPs feature to add a Virtual MAC. Select the ‘ovh’ option from the drop down, and give it a name for your own reference. OVH will now generate a MAC address that can be used.

Create a virtual machine using KVM, and ensure that the NIC has the following options set.

<interface type=’direct’>
<mac address=’02:00:00:b4:96:05’/>
<source dev=’eth0′ mode=’bridge’/>
<model type=’rtl8139’/>
<address type=’pci’ domain=’0x0000′ bus=’0x00′ slot=’0x09′ function=’0x0’/>
</interface>

This shows up in virt-manager as…

Network source : Host device eth0: macvtap
Source mode : Bridge
Device model : rtl8139
MAC address : 02:00:00:b4:96:05

The MAC address *MUST* match what was generated in the SoYouStart control panel.

Now install the guest machine from source media in whatever way you prefer.

Once the machine is booted, edit /etc/network/interfaces such that it looks like this

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 151.80.85.160
netmask 255.255.255.255
broadcast 151.80.85.160
post-up route add 37.187.57.254 dev eth0
post-up route add default gw 37.187.57.254
post-down route del default gw 37.187.57.254
post-down route del 37.187.57.254 dev eth0

It is supposed to be vital that the SYS server default gateway (ie, 37.187.57.254) is put in as a device route and then the default route, but I have found that using the SYS server IP (ie, 37.187.57.69) also worked, with and without IP forwarding enabled.

Once complete, a simple case of ifdown eth0 ; ifup eth0 should have the guest online.