Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Apr 2017 08:17:24 +0100
From:      Arthur Chance <freebsd@qeng-ho.org>
To:        byrnejb@harte-lyne.ca, freebsd-questions@freebsd.org
Subject:   Re: Q. Re loopback address for jails
Message-ID:  <8bc3bbcf-b172-3425-00de-740e08be4d6c@qeng-ho.org>
In-Reply-To: <8116ebb9b81db0c913af691c59f2a391.squirrel@webmail.harte-lyne.ca>
References:  <8116ebb9b81db0c913af691c59f2a391.squirrel@webmail.harte-lyne.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
On 11/04/2017 16:48, James B. Byrne via freebsd-questions wrote:
> Given that for a FreeBSD jail one clones the lo interface and assigns
> a different address than 127.0.0.1 say 127.0.33.1 what files does one
> need to change throughout the jail?
> 
> I have modified /usr/jails/jail/etc/hosts,
> /usr/jails/jail/etc/resolv.conf and
> usr/jails/jail/etc/ssh/sshd_config. I note however that there are a
> very large number of configuration files throughout the jail that
> contain a literal value of 127.0.0.1.  Do all of these need updating?
> 
> Under  /usr/jails/jail/usr/local/etc/ there are also files that
> contain 127.0.0.1 as literal values,
> /usr/jails/hlldns02/usr/local/etc/rc.d/named for example.  How does
> one handle rc.d scripts that specify 127.0.0.1?
> 
> If these all require manual alteration then why is not localhost used
> instead?  Then one would only need alter the hosts file.

The networking code for bind(2) and connect(2) (and other networking
calls that are equivalent) treats the 127.0.0.1 address specially when
in jails. It is replaced by the first IPv4 address assigned to the jail
(or fails if the jail does not have an IPv4 addr). That way 127.0.0.1 is
always "this jail" rather than "this host". This can be very useful
because reassigning jail addresses in /etc/jail.conf doesn't mean
editing lots of config files in the jail.

-- 
Unicode allows even more stupid password rules. Your password must
contain at least one of each of: upper case letter, lower case letter,
title case letter, digit, currency symbol, punctuation character,
ideogram, box character, emoji, Middle Kingdom hieroglyph, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8bc3bbcf-b172-3425-00de-740e08be4d6c>