localhost or LAN addresses in /etc/hosts

Chris G cl at isbd.net
Fri Dec 12 18:16:38 UTC 2008


How does one decide whether to put a machine's name as a localhost
address or an actual LAN address in /etc/hosts?

My ubuntu server machine's name is isbd, this appears in three places
in /etc/hosts at the moment:-

    127.0.0.1   isbd    localhost.localdomain   localhost
    127.0.1.1 isbd

    192.168.1.4 home.isbd.net isbd 84-45-228-40.no-dns-yet.enta.net chris.isbd.net

This is all very well until one runs something like dnsmasq and get
localhost addresses when asking for the address of isbd.

I think the 127.0.1.1 is redundant and should be removed, can I also
remove the isbd from the 127.0.0.1 line as well?  Why does it get put
there, maybe it's there for use when the machine gets its IP via DHCP
and thus it isn't fixed.

-- 
Chris Green




More information about the ubuntu-users mailing list