Post History
I run an environment that, until recently, did all local name resolution by putting names in /etc/hosts. I'm in the process of replacing that with local DNS. The DNS part works fine, and now I'm tr...
#2: Post edited
I run an environment that, until recently, did all local name resolution by putting names in /etc/hosts. I'm in the process of replacing that with local DNS. The DNS part works fine, and now I'm trying to clean the old entries out the /etc/hosts files. It seems to me that, rather than try to sed-out bogus entries and hope I didn't miss anything important, it will be simpler to replace each system's /etc/hosts with a clean copy.- What does a minimal working /etc/hosts file need to contain? So far I have this:
- ```conf
- 127.0.0.1 localhost
- # some sources suggest 127.0.1.1 for the fqdn and hostname; it seems to
- # me that the local private IP is a better idea, so the machine sees
- # the same address for itself that its peers do.
- 192.168.x.y $HOSTNAME.$DNSDOMAIN $HOSTNAME
- # These are in a stock ubuntu install; I am unsure of their universality.
- # All machines in question have an ip6 address, but some are
- # link-local only.
- ::1 ip6-localhost ip6-loopback
- fe00::0 ip6-localnet
- ff00::0 ip6-mcastprefix
- ff02::1 ip6-allnodes
- ff02::2 ip6-allrouters
- ```
- I run an environment that, until recently, did all local name resolution by putting names in /etc/hosts. I'm in the process of replacing that with local DNS. The DNS part works fine, and now I'm trying to clean the old entries out of the /etc/hosts files. It seems to me that, rather than try to sed out bogus entries and hope I didn't miss anything important, it will be simpler to replace each system's file with a clean copy.
- What does a minimal working /etc/hosts file need to contain? So far I have this:
- ```conf
- 127.0.0.1 localhost
- # some sources suggest 127.0.1.1 for the fqdn and hostname; it seems to
- # me that the local private IP is a better idea, so the machine sees
- # the same address for itself that its peers do.
- 192.168.x.y $HOSTNAME.$DNSDOMAIN $HOSTNAME
- # These are in a stock ubuntu install; I am unsure of their universality.
- # All machines in question have an ip6 address, but some are
- # link-local only.
- ::1 ip6-localhost ip6-loopback
- fe00::0 ip6-localnet
- ff00::0 ip6-mcastprefix
- ff02::1 ip6-allnodes
- ff02::2 ip6-allrouters
- ```
#1: Initial revision
What does a minimal /etc/hosts need to contain?
I run an environment that, until recently, did all local name resolution by putting names in /etc/hosts. I'm in the process of replacing that with local DNS. The DNS part works fine, and now I'm trying to clean the old entries out the /etc/hosts files. It seems to me that, rather than try to sed-out bogus entries and hope I didn't miss anything important, it will be simpler to replace each system's /etc/hosts with a clean copy. What does a minimal working /etc/hosts file need to contain? So far I have this: ```conf 127.0.0.1 localhost # some sources suggest 127.0.1.1 for the fqdn and hostname; it seems to # me that the local private IP is a better idea, so the machine sees # the same address for itself that its peers do. 192.168.x.y $HOSTNAME.$DNSDOMAIN $HOSTNAME # These are in a stock ubuntu install; I am unsure of their universality. # All machines in question have an ip6 address, but some are # link-local only. ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ```