Subject: Re: [vserver] Too many network devices inside guest?
From: Herbert Poetzl <herbert@13thfloor.at>
Date: Sat, 31 Oct 2009 16:13:40 +0100

On Sat, Oct 31, 2009 at 01:03:58PM +0100, Gerhard Mehsel wrote:
> Hello all,
> 
> so I get stuck again I don't know if it's a problem of me or a 
> bug or whatever, sorry for that.

no problem, that's what the IRC channel and the ML is for

> I installed the vmlinuz-2.6.30-vserver-686 from here: 
> http://zbla.net/debian and ran into several problems 

> (one old guest not starting anymore, 

most likely due to the broken debian kernel and bad file
attributes on the guest dir ... (see barrier)
http://linux-vserver.org/Installation_on_Debian#Issues_with_the_current_2.6.26_Kernel

> creating a new guest succeded but network problem again

the network problem being?
could you paste the build line you used, and the util-vserver
version (vserver-info - SYSINFO)

> ...disappearing ethernet dev's on the host...

most likely related to this:
http://linux-vserver.org/Frequently_Asked_Questions#If_I_shut_down_my_vserver_guest.2C_the_whole_Internet_interface_ethX_on_the_host_is_shut_down.__What_happened.3F
or simply that you assign a 'dev' for an already existing
IP on the host, which simply means, please (util-vserver)
bring up that IP on guest startup, and _remove_it_ on
guest shutdown ...

> "RTNETLINK answers: File exists"  and so on).

that sounds like util-vserver trying to assign the IP
which is already there (i.e. configured on the host)

solution: as I wrote before, remove the 'dev' entry
and replace it by a 'nodev' one, or let util-vserver
manage the guest IP(s)

> Can someone provide me a sample build command for my situation, 
> please?

I don't know what your situation is, but 
http://linux-vserver.org/Building_Guest_Systems
works for most folks and situations

> On my host there are following dev's with IP 
> adresses/broadcats/gateway/netmask configured and working:
> 
> eth0  --> this is for the host only (sshd)
> eth0:0
> eth0:2
> eth0:3
> eth0:4
> eth0:5

> I want to have two guests.
> First should only listen to eth0:2 and localhost

assuming that the IPs are already configured on the host,
you would do something like this:

vserver vserver1 build -m debootstrap --context 4201 \
    --hostname vserver1.mydomain.com \
    --interface <ip-of-eth0:2>/<prefix-of-eth0:2> \
    -- -d lenny -m http://ftp.de.debian.org/debian

note that <...> is not literally, but should be replaced
by the IP/prefix (or netmask) of your interface

alternatively, if you decide to let util-vserver manage
the guest IP, you could do:

vserver vserver1 build -m debootstrap --context 4201 \
    --hostname vserver1.mydomain.com \
    --interface 2=eth0:<ip-of-eth0:2>/<prefix-of-eth0:2> \
    -- -d lenny -m http://ftp.de.debian.org/debian

or simply drop the 2= part, as there is no real need
for havin aliases nowadays (they got replaced by secondaries)

> Second should listen to eth0:3 and eth0:4 and localhost

vserver vserver2 build -m debootstrap --context 4202 \
    --hostname vserver2.mydomain.com \
    --interface <ip-of-eth0:3>/<prefix-of-eth0:3> \
    --interface <ip-of-eth0:4>/<prefix-of-eth0:4> \
    -- -d lenny -m http://ftp.de.debian.org/debian

or again, with util-vserver management, 3=eth0:....
and 4=eth0:... or simply eth0:... for secondaries

> Can anyone give me the sample build command?

see above, here a few additional notes:

 - if you have AUTO_SINGLE_IP enabled in your kernel
   .config, you want to put a ~single_ip into the first
   guest's config 'nflag' entry, to avoid that special
   casing

 - if you do not have AUTO_LBACK enabled in your kernel
   .config, you want to specify a unique lback address
   for each guest

 - if you _really_ want to share 127.0.0.1 between the
   guests and the host, you have to disable lback_remap
   and enable lback_allow for both guests, but be aware
   that this is a potential security issue, as the guests
   can easily prevent host services from binding to
   127.0.0.1 that way (and thus replace host services) 

HTH,
Herbert

> Thank you,
> Gerd
>