How is 127.0.0.1
related to 127.0.0.2
?
Using ssh to login to tleilax (OpenSuSE):
tleilax:~ #
tleilax:~ # hostname
tleilax
tleilax:~ #
tleilax:~ # hostname -f
tleilax.bounceme.net
tleilax:~ #
tleilax:~ # cat /etc/hosts
#
# hosts This file describes a number of hostname-to-address
# mappings for the TCP/IP subsystem. It is mostly
# used at boot time, when no name servers are running.
# On small systems, this file can be used instead of a
# "named" name server.
# Syntax:
#
# IP-Address Full-Qualified-Hostname Short-Hostname
#
127.0.0.1 localhost
# special IPv6 addresses
::1 localhost ipv6-localhost ipv6-loopback
fe00::0 ipv6-localnet
ff00::0 ipv6-mcastprefix
ff02::1 ipv6-allnodes
ff02::2 ipv6-allrouters
ff02::3 ipv6-allhosts
127.0.0.2 tleilax.bounceme.net tleilax
tleilax:~ #
tleilax:~ # exit
logout
Connection to 192.168.1.4 closed.
logged into doge (Ubuntu):
thufir@doge:~$
thufir@doge:~$ hostname
doge
thufir@doge:~$
thufir@doge:~$ hostname -f
doge.bounceme.net
thufir@doge:~$
thufir@doge:~$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 doge.bounceme.net doge
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
thufir@doge:~$
My understanding is that 127.0.0.1
and 127.0.1.1.
are, at least in Ubuntu, used for the hostname:
Somme years ago Thomas Hood started a discussion[0] about how the system
hostname should be resolved.
The eventual result[1] was that Debian nowadays ships /etc/hosts like
these per default:
127.0.0.1 localhost
127.0.1.1 <host_name>.<domain_name> <host_name>
As also described in the Debian reference[2].
I had a short mail conversation with Thomas and he proposed bringing up
the following at d-d.
https://lists.debian.org/debian-devel/2013/07/msg00809.html
On tleilax I used yast -- why does it give an IP address of 127.0.0.2
? Is that any different from 127.0.0.1
? Is it just an artifact of using yast?
Finally, will it muck up yast in any way were I to change 127.0.0.2
to 127.0.0.1
? I'm guessing it doesn't really matter -- I'm more curious about it.
To what extent is this just convention within each distro, versus a wider requirement for how IPv4 addresses work?
/etc/hosts
on many Linux machines," ...doge
I entered the FQDN during install, Ubuntu populated thehosts
file. Fortleilax
yast populated the hosts file (OpenSuSE)./etc/hosts
; also very common)