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

Fri Aug 13 14:47:44 UTC 2010
Mathieu Baudier <mbaudier at argeo.org>

> On first reading I thought eth1 would have been your second interface
> within the guest, besides eth0. Meanwhile I think you just skipped eth0.

There is a eth0 interface, but it is connected to the internal NAT
network of libvirt.
That way I have a LAN between my guests and eth1 is used for external access.

> That is because you can have just 1 default route. The OVH document does
> not describe a setup for a 2nd interface.

Yes I did have issue with that because the DHCP on eth0 was setting a gateway.
I solved it by forcing:

GATEWAY=IP.OF.HOST.GATEWAY (=x.y.z.254)

in eth0 as well.

Here is the ifcfg-eth0:

# Virtio Network Device
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=33:33:33:33:33:33
ONBOOT=yes
GATEWAY=IP.OF.HOST.GATEWAY


> Especially when dealing with more than 1 interface, do NOT set the GATEWAY
> in ifcfg-ethX. By principle always set GATEWAY (in your case
> GATEWAY=x.y.z.254) in /etc/sysconfig/network. Thus you do not need the

ok, good to know, I will fiddle with that.

> If you would have more than 1 interface (the OVH doc does not indicate to
> be written for such a case, neither notes explicitly to give problems in
> that case), then following the OVH doc gives you trouble.

It actually works fine when I had many virtualized interfaces (eth2,
eth3, etc.).
And I actually don't need to add other route-eth2, route-eth3, etc.
(because route-eth0 set the default gateway, isn't it?)

> An aliases interface does not have an own MAC, it is physically the same
> MAC as the primary interface.

maybe that is were I am doing something wrong, because I configured
this virtual MAC within OVH.

> You created a route-eth1:1 file?

yes, I tried that but it did not help.
and as put above it was not necessary for the other virtual interfaces.

> Yes, as said, the security design of the hoster must permit the use of
> defined IPs bound with a dedicated MAC. Ask you hoster.

I will ask them, they are pretty helpful in general.

> You can add additional IPs to virtualized interfaces - either by

good to know that is feasible

Thanks for your help!