![「hostname -i」を実行してもすべてのアドレスが表示されなくなりました](https://rvso.com/image/885957/%E3%80%8Chostname%20-i%E3%80%8D%E3%82%92%E5%AE%9F%E8%A1%8C%E3%81%97%E3%81%A6%E3%82%82%E3%81%99%E3%81%B9%E3%81%A6%E3%81%AE%E3%82%A2%E3%83%89%E3%83%AC%E3%82%B9%E3%81%8C%E8%A1%A8%E7%A4%BA%E3%81%95%E3%82%8C%E3%81%AA%E3%81%8F%E3%81%AA%E3%82%8A%E3%81%BE%E3%81%97%E3%81%9F.png)
Ubuntu 16.04.1 でホスト名を変更しました。
今実行すると、hostname -i
1 つを除いてほとんどのアドレスが削除されます。
代わりに出力は次のようになります。
127.0.1.1
それは従来:ipv6_address%eth0 ipv6_address%eth1 ipv6_address%2 ipv4_address ipv4_address ipv4_address ipv4_address
。
/etc/ホスト名:ubuntu-rany-01
/etc/ホスト:
# Your system has configured 'manage_etc_hosts' as True.
# As a result, if you wish for changes to this file to persist
# then you will need to either
# a.) make changes to the master file in /etc/cloud/templates/hosts.tmpl
# b.) change or remove the value of 'manage_etc_hosts' in
# /etc/cloud/cloud.cfg or cloud-config from user-data
#
127.0.1.1 rany-01 rany-01
127.0.0.1 localhost
# 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
ff02::3 ip6-allhosts
住所を取り戻す方法はありますか?
答え1
/etc/hosts
これは、 にエントリが見つかるからです127.0.1.1 YourLinuxBoxName
。
この特定の localhost エントリ ( 内のすべてのアドレスは127/8
)localhost
は DNSmasq によって使用されます。無視しても問題ありません。
答え2
次の行を変更する必要があります:
127.0.1.1 rany-01 rany-01
で/etc/hosts
、次のようになります:
127.0.1.1 ubuntu-rany-01
または、の代わりに/etc/hostname
:の内容を変更できます。rany-01
ubuntu-rany-01