Operating System - Linux
1821638 Members
3006 Online
109633 Solutions
New Discussion юеВ

DNS / HOSTS file question

 
SOLVED
Go to solution
Ragni Singh
Super Advisor

DNS / HOSTS file question

Hi all, I just started a new job at a new place and have some questions. at my old place, we had a centralized DNS server, we had one hosts file on all the servers.

at my new job, there is a DNS server and I'm not sure what its currently doing. But every system has its own hosts file and is driving me crazy.

What are the pros and cons of having one hosts file on all server versus every system having its own hosts file.

thanks and points will be assigned.
6 REPLIES 6
Steven E. Protter
Exalted Contributor

Re: DNS / HOSTS file question

Shalom,

/etc/nsswtich.conf

hosts line determines the order of host name resoultion.

normally its sales files dns

That means files first dns second

/etc/hosts is a mini dns type database that the admin can edit. If its not maintained, it can be a problem. We actually generate ours FROM DNS, so it provides redundancy.

if you want to go dns first, change /etc/nsswitch.conf

The change will be instant, and you need to test things such as email after you do it.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Ragni Singh
Super Advisor

Re: DNS / HOSTS file question

But Steven, you still haven't mentioned the pros anc cons. Why would someone prefer to have a seperate host file on each server versus one host file for all servers.
Bill Thorsteinson
Honored Contributor
Solution

Re: DNS / HOSTS file question

PRO - Limits the number of changes required.
Individual files should have IPs for the
server, its mailhib, and possibly a few other
servers for purposes such as LDAP and backup.
The file only needs to change if one of these
IPs change.
Other changes are reflected by DNS.
- Don't need a mechanism to keep all servers
updated with the latest hosts file.

CON - Need to have DNS entries for all
local net servers (10.* 192.*). This may
require multiple DNS configurations.
- If DNS is down servers ability to
find each other degrades rapidly.
- Are require to have a mechanism such
as cfengine to keep all the servers up
to date.

Ivan Ferreira
Honored Contributor

Re: DNS / HOSTS file question

I don't understand this:

"having one hosts file on all server versus every system having its own hosts file"


You must have one hosts file on every server, now, the contents of the file could be the same or different, I think that is that what you mean.

Maintaining name resolution using hosts file is time consuming and requires too much administrative effort.

You should use the hosts file only for some critical servers, then use DNS for everything else.

I see more cons that pro on hosts based name resolution. The pro is that you don't depend of the availability the DNS server. The cons is the administrative job that requires maintaining that file.

If your DNS server is reliable or you have a secondary DNS server also, or you can configure one, you should use DNS as name resolution method.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Ragni Singh
Super Advisor

Re: DNS / HOSTS file question

Ivan, what I meant was one hosts file with all the ip addresses and everything on all systems.

Thanks for all your response. Assigning points now.
Matti_Kurkela
Honored Contributor

Re: DNS / HOSTS file question

Using /etc/hosts on each and every server:
PROS:
+ makes servers more independent: failure of DNS server does not cause problems

CONS:
- more work when a new server is added or old one is changed (you have to ensure /etc/hosts is up to date on all servers, or constantly deal with them being out of sync)

Using DNS:
PROS:
+ much easier to maintain, since all changes can be done in one spot

CONS:
- if you have just one DNS server, "everything" stops working when it fails (so you'd better have at least two)
MK