0

Have gotten a server from SoYouStart (cheap OVH) that was planning on setting up a few KVM guests.

Installed Debian Jessie and the required packages qemu-kvm libvirt-bin virtinst.

Acquired additional IPs from SYS, now the fun part.

Using Xen terminology the IPs are:

  • DomU: 94.xx.xx.20
  • Dom0: 145.xx.xx.35
  • Dom1: 188.xx.xx.47

SYS suggests the additional IPs are configured as IP Aliases (and in their control panel wants virtual Mac addresses assigned to these).

Original /etc/network/interfaces

auto eth0
iface eth0 inet static
    address 94.xx.xx.20
    netmask 255.255.255.0
    broadcast 94.xx.xx.255
    gateway 94.xx.xx.254

Adding the entry to /etc/network/interfaces

auto eth0:0
iface eth0:0 inet static
    address 145.xx.xx.35
    netmask 255.255.255.255
    post-up /sbin/ifconfig eth0:0 145.xx.xx.35 netmask 255.255.255.255 broadcast 145.xx.xx.35
    pre-down /sbin/ifconfig eth0:0 down

assigns this as expected. (If no MAC configured in SYS panel this is pingable, otherwise it is not).

Using the suggested iproute2:

ip link add name br0 type bridge
ip link set br0 up
ip link set eth0 up
ip link set eth0 master br0

prevents access to the host (DomU) as does attempting to use eth0:0

How do I keep 94.xx.xx.20 accessible for administering the host whist also making 145.xx.xx.35 and 188.xx.xx.47 accessible from the outside world to a KVM guest for services like apache?

I will be installing the KVM guest via virt-install specifying the MAC assigned via the control panel using the --mac argument.

Alasdair
  • 1
  • 1
  • 1
    >>(If no MAC configured in SYS panel this is pingable, otherwise it is not). If you want to use additional ips on guests then generate mac from SYS panel. Then edit the vms interface and use the same mac as generated on panel for guest interface. If you want to use the additional ips on server itself then you will have to use it as alias and no need to generate mac from system panel. – errorfetch Aug 11 '17 at 12:56

1 Answers1

0

Assign the bridge your IP address, not eth0:
/etc/network/interfaces:

auto lo br0
iface lo inet loopback

iface eth0 inet manual

auto br0
iface br0 inet static
    bridge_ports eth0
    address 145.xx.xx.35
    netmask 255.255.255.255
    post-up /sbin/ifconfig br0 145.xx.xx.35 netmask 255.255.255.255 broadcast 145.xx.xx.35
    pre-down /sbin/ifconfig br0 down

In the guest VM's XML definition something like this should work (I'm not familiar with OVH, this works on KVM/QEMU/libvirt machines and populates the MAC address):

<interface type='bridge'>
  <source bridge='br0'/>
  <model type='virtio'/>
</interface>

More gory details, debian-specific, are available at the Libvirt Wiki

quadruplebucky
  • 5,041
  • 18
  • 23