執行“hostname -i”不再顯示我的所有位址

執行“hostname -i”不再顯示我的所有位址

我在 Ubuntu 16.04.1 上更改了主機名稱。

現在,除了一個之外,運行hostname -i會刪除我的大部分地址。

相反,它的輸出是:

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

DNSmasq 使用此特定的 localhost 項目(127/8is中的每個位址)。localhost忽略它是安全的。

答案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.

相關內容