Ubuntu – changing 127.0.1.1 back to 127.0.0.1 — will it break anything in Unity

hostnamenetworkingunity

The /etc/hosts file defaults your hostname to 127.0.1.1 rather than 127.0.0.1

127.0.0.1   localhost 
127.0.1.1   my_machine

I've already found out why. But that was giving me problems testing some web apps, which had hard-coded assumption, that local machine == 127.0.0.1. So I've change my hosts file to

127.0.0.1   localhost my_machine

Question is:

  • are there reasons for which 127.0.1.1 hack still valid?
  • if so, which software included in 11.04 might have problem with the change I've made?

Best Answer

Your local machine IS 127.0.0.1. It's the standard IP for the localhost.

Instead, the hostname of your machine resolves to 127.0.1.1.

It should be no problem to change it to anything in the range 127.0.0.0/8 which is reserved for loopbacks.

As long as nothing listens exclusively on 127.0.1.1 you should be safe. To find if there's something listening on 127.0.1.1:

sudo netstat -tunelp | grep 127.0.1.1
Related Question