[CentOS-virt] IP aliases from a QEMU/KVM guest

Fri Aug 13 13:19:50 UTC 2010
Mathieu Baudier <mbaudier at argeo.org>

Hello,

I'm trying to set up IP aliases within a QEMU/KVM guest on CentOS 5.5
x86_64, going through a bridged virtualized interface.

The virtualized interface in the guest is configured as follow:

# ifcfg-eth1

DEVICE=eth1
BOOTPROTO=none
PEERDNS=yes
GATEWAY=IP.OF.HOST.GATEWAY
HWADDR=11:11:11:11:11:11
IPADDR=IP.OF.GUEST.ETH1
NETMASK=255.255.255.255
ONBOOT=yes
ARP=yes
USERCTL=no
IPV6INIT=no

# route-eth1

IP.OF.HOST.GATEWAY dev eth1
default via IP.OF.HOST.GATEWAY dev eth1

This is the configuration recommended by the provider (OVH) after a
virtual MAC address has been allocated for IP.OF.GUEST.ETH1:
http://help.ovh.com/BridgeClient

It works fine for virtual interfaces added via libvirt/QEMU.

But when I try to configure an IP alias on another IP address aliasing
a virtualized interface, as per the instructions from
http://help.ovh.co.uk/IpAlias (and after assigning it a virtual mac
just like for eth1) :

# ifcfg-eth1:1

DEVICE=eth1:1
BOOTPROTO=none
PEERDNS=yes
GATEWAY=IP.OF.HOST.GATEWAY
HWADDR=22:22:22:22:22:22
IPADDR=IP.OF.GUEST.ETH1:1
NETMASK=255.255.255.255
ONBOOT=yes
ARP=yes
USERCTL=no
IPV6INIT=no

I get the following error when restarting the network:

SIOCADDRT: Network is unreachable

and IP.OF.GUEST.ETH1:1 is:
- pingable from the same guest
- not pingable from other guests by the same provider
- not pingable from outside

Setting
BOOTPROTO=static
or commenting out
#GATEWAY=IP.OF.HOST.GATEWAY
or setting:
NETMASK=255.255.255.252
(the IP block was a /30, but I don't think that has something to do here)

did not change the behavior.

I'll be interested to hear from experiences with setting IP alias from
within a guest.
Maybe my problem is due to the configuration of the provider network
and it is actually impossible to use IP aliases on virtualized
interfaces.
Any opinion/idea welcome!

Mathieu