127.0.0.1
は127.0.0.2
とどのように関連していますか?
Sshを使用して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.
ログイン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:~$
私の理解では、127.0.0.1
と127.0.1.1.
は、少なくともUbuntuでは、ホスト名に使用されます。
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
tleilaxでyastを使用しました-なぜIPアドレスが127.0.0.2
になるのですか?それは127.0.0.1
と何か違いがありますか?それは単にyastを使用した結果ですか?
最後に、127.0.0.2
を127.0.0.1
に変更した場合、なんらかの形でyastが台無しになりますか?私はそれが本当に重要ではないと推測しています-私はそれについてもっと興味があります。
これは、IPv4アドレスがどのように機能するかについてのより広い要件とは対照的に、各ディストリビューション内の単なる慣例ですか?
ループバックデバイスlo
はネットワーク127/8
(別名127.0.0.1/255.0.0.0
)にバインドされているため、anyアドレス範囲127.0.0.1
から127.255.255.254
はローカルループバックです。
したがって、127.0.0.1
と127.0.0.2
のどちらを使用してもかまいません。
彼ら(Debian)が彼らが選んだスキームを選んだ理由は Debian-reference で説明されています(そしてそれは本当にバグの回避策です)