1

I changed my hostname on Ubuntu 16.04.1.

Now running hostname -i gets rid most of my addresses except for one.

Instead it's output is:

127.0.1.1

It used to be: ipv6_address%eth0 ipv6_address%eth1 ipv6_address%2 ipv4_address ipv4_address ipv4_address ipv4_address.

/etc/hostname: ubuntu-rany-01

/etc/hosts:

# 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

Is there anyway to get my addresses back?

5
  • What is the content of yours /etc/hostname and /etc/hosts ? – pa4080 Aug 31 '16 at 12:49
  • This is because in /etc/hosts you find the entry 127.0.1.1 YourLinuxBoxName. This particular localhost entry (every address in 127/8 is localhost) is used by DNSmasq. It is safe to ignore. – jawtheshark Aug 31 '16 at 12:55
  • @SpasSpasov I updated the question – rany Aug 31 '16 at 12:55
  • @jawtheshark could you add this as an answer :) – rany Aug 31 '16 at 13:00
  • I'll do so, but Spas Spasov answer is actually right too. – jawtheshark Aug 31 '16 at 13:08
2

This is because in /etc/hosts you find the entry 127.0.1.1 YourLinuxBoxName.

This particular localhost entry (every address in 127/8 is localhost) is used by DNSmasq. It is safe to ignore.

1

You should change next line:

127.0.1.1 rany-01 rany-01

in /etc/hosts. It must be:

127.0.1.1 ubuntu-rany-01

Or you can change the content of /etc/hostname: rany-01 instead of ubuntu-rany-01.

2
  • DigitalOcean doesn't want me to change this file according to documentation. – rany Aug 31 '16 at 13:09
  • 3
    That's just because if you change it and make a mess, your system would become non-functional and then they get support calls. If you limit yourself to the edit Spas suggests, it will be fine. – jawtheshark Aug 31 '16 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.