!["hostname -i"를 실행하면 더 이상 모든 주소가 표시되지 않습니다.](https://rvso.com/image/885957/%22hostname%20-i%22%EB%A5%BC%20%EC%8B%A4%ED%96%89%ED%95%98%EB%A9%B4%20%EB%8D%94%20%EC%9D%B4%EC%83%81%20%EB%AA%A8%EB%93%A0%20%EC%A3%BC%EC%86%8C%EA%B0%80%20%ED%91%9C%EC%8B%9C%EB%90%98%EC%A7%80%20%EC%95%8A%EC%8A%B5%EB%8B%88%EB%8B%A4..png)
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
.
이 특정 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