Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

What does a minimal /etc/hosts need to contain?

+7
−0

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:

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
History
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

1 answer

+4
−0

Technically, you don't need an /etc/hosts file at all if you have some other form of name resolution available - i.e. DNS.

In practice, what you have will work nicely, and could be cut down to just the 2 localhost entries.

History
Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »