Subject: Re: [vserver] vserver + virtual interfaces
From: Herbert Poetzl <herbert@13thfloor.at>
Date: Wed, 12 Nov 2008 14:07:11 +0100

On Tue, Nov 11, 2008 at 05:33:44PM -0300, Tomás de Barros Correia wrote:
>  Hi all,
> 
> I'd like to create about 5 virtual machines wich one with real IPs on
> my machine (with just one physical network interface - eth0). I've
> tried to create 5 virtual network interfaces (eth0:0, eth0:1 ...) 

those are _not_ virtual interfaces, those are so called
'aliases' which are basically handled like normal IPs
on the host

> and the file /etc/network/interfaces looks like:
> # The loopback network interface
> auto lo
> iface lo inet loopback
> 
> # physical interface
> auto eth0
> iface eth0 inet dhcp
> 
> # virtual interface etho0:0
> auto eth0:0
> iface eth0:0 inet manual

on the host, I hope ...

> ...
> 
> So, I set manually my configuration (IP, network and device) in 
> my virtual machine (/etc/vserver/mymachine/interfaces/0/*). 

> When I started my virtual machine, it assumes the correct IP 
> but the command ifconfig -a on my VM shows me eth0 instead eth0:0.

what are the IPs on the host (ip addr ls) and what
IPs do you have assigned to the guest (what is in
/etc/vserver/mymachine/interfaces/)?

> The problem is: all my configuration (host and VMs) is just 
> ignored and all the differents IPs currently used by my VMs 
> just points the host machine, showing me the host machine shell.

kind of guessing here what you do, but I'd say you
have an unrestricted sshd running on the host, so
you'll always end up on the host, regardless where
you ssh to ... (but I might be wrong, to little
information yet)

> There's something wrong or something missing in my configuration 
> an I would like to know the way to do it (tutorial, how to, 
> articles etc).

the basic (and probably best) way to use a single IP
for several guests is to assigne private addresses to
the guest (e.g. 192.168.0.*) and S/DNAT them for the
ports you want to be mapped.

> Can anybody help me?

very likely, but we all need more information about
your system/setup ...

> Thanks in advance!

best,
Herbert