Subject: Re: [vserver] Understanding localhost
From: Herbert Poetzl <herbert@13thfloor.at>
Date: Sat, 2 May 2009 00:40:36 +0200

On Fri, May 01, 2009 at 06:05:15PM -0400, John A. Sullivan III wrote:
> On Fri, 2009-05-01 at 23:34 +0200, Herbert Poetzl wrote:
> > On Fri, May 01, 2009 at 04:48:12AM -0400, John A. Sullivan III wrote:
> > > Hello, all. I'd like to confirm that I understand the way vserver
> > > 2.3 is handling localhost and the loopback address.

> > > Am I correct to understand that, unlike earlier version, the
> > > default kernel compilation makes it safe to use 127.0.0.1 on a
> > > guest? That is, each one is uniquely mapped and does not interfere
> > > with the host listening in 127.0.0.1? We can thus set our
> > > /etc/hosts files to use: 127.0.0.1 localhost localhost.localdomain
> > > etc . . .?

> > > However, is it also true that daemon bindings to localhost will
> > > still be made to the address in /etc/vservers/<guest>/interfaces/0
> > > and will not include 127.0.0.1 unless explicitly bound?

> > > I ask because we were delighted to realize we could simplify
> > > our zimbra installation by leaving /etc/hosts at 127.0.0.1
> > > for localhost. We then started retrofitting our other servers
> > > to do the same. Some of our servers communicate with sshd on
> > > 127.0.0.1. We had changed the configuration files to bind them
> > > to the non-loopback address, e.g., 192.168.1.10 because of our
> > > old understanding of 127.0.0.1. We also changed sshd_config by
> > > removing the ListenAddress 192.168.1.10 so that it goes back to
> > > the default of binding to all interfaces.

> > > This broke those applications. When we do a netstat -tln on the
> > > vserver guests, it shows sshd listening only on 192.168.1.10 (as
> > > an example) and not 0.0.0.0.

> > if you disable the single IP special casing, this
> > will change to the expected behaviour ...

> Sorry to be showing my ignorance again but what is "single IP special
> casing" that I should be disabling? Thanks - John

A Linux-VServer context flag, which controls the
behaviour in case a single IP is assigned to a guest
(which can be optimized by replacing 0.0.0.0 with
that single IP, instead of keeping a list to check
against) ...

http://linux-vserver.org/Capabilities_and_Flags

(see nflags, SINGLE_IP)

note, that in the kernel config, you can also set the
default behaviour (VSERVER_AUTO_SINGLE) which, when
enabled does set that flag automatically

HTC,
Herbert

> > > -- 
> > > John A. Sullivan III
> > > Open Source Development Corporation
> > > +1 207-985-7880
> > > jsullivan@opensourcedevel.com
> > > 
> > > http://www.spiritualoutreach.com
> > > Making Christianity intelligible to secular society
> -- 
> John A. Sullivan III
> Open Source Development Corporation
> +1 207-985-7880
> jsullivan@opensourcedevel.com
> 
> http://www.spiritualoutreach.com
> Making Christianity intelligible to secular society