Operating System - Linux
1820553 Members
3769 Online
109626 Solutions
New Discussion юеВ

Re: what is the difference between /etc/host.conf and /etc/nsswitch.conf

 
Hanry Zhou
Super Advisor

what is the difference between /etc/host.conf and /etc/nsswitch.conf

Do I have to use both of them, either one?

Thanks,
none
6 REPLIES 6
Steven E. Protter
Exalted Contributor

Re: what is the difference between /etc/host.conf and /etc/nsswitch.conf

You MUST have nsswitch.conf.

It decides how resolution like hostname resolution happens on your system.

/etc/hosts is also a requirement, because all machines need a loopback address. Beyond that, you don't have to use /etc/hosts for names resolution if you use DNS.

nsswitch tells the machine how to resolve hostnames. hosts can be used to actually resolve hostnames.

SEP
Please don't forget to assign points if this helps.
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
Stuart Browne
Honored Contributor

Re: what is the difference between /etc/host.conf and /etc/nsswitch.conf

Umm, he said 'host.conf', not 'hosts'.

In any case Steve is right.

The 'host.conf' is the old way of telling Linux the resolver order. On other *nix systems, this was an entry in /etc/resolv.conf called 'hostresorder'.

nsswitch.conf does this, as well as the lookup method/order for many other subsystems, thus it is far more useful.

I'm unsure whether you can get away with not having a 'host.conf', but I think you can on a modern machine.
One long-haired git at your service...
Mark Grant
Honored Contributor

Re: what is the difference between /etc/host.conf and /etc/nsswitch.conf

I just removed my /etc/host.conf file on Slackware and it doesn't seem to have caused any ill effects so I think it's safe to say you don't really need it any more.
Never preceed any demonstration with anything more predictive than "watch this"
Stanimir
Trusted Contributor

Re: what is the difference between /etc/host.conf and /etc/nsswitch.conf

The only important "hosts"-type files for you are:
/etc/hosts
/etc/hosts.equiv.
But you need /etc/nsswitch.conf indeed.
Regards.
Hanry Zhou
Super Advisor

Re: what is the difference between /etc/host.conf and /etc/nsswitch.conf

I understand quite well about nsswitch.conf and /etc/hosts,and what they are for, but not /etc/host.conf. I have redhat 9 server, and it does have such file.

I still don't understand what /etc/host.conf for, and if the server works fine without it, why this file exists there.

Point will be followed later.
none
Stuart Browne
Honored Contributor

Re: what is the difference between /etc/host.conf and /etc/nsswitch.conf

As I said in my post:

The 'host.conf' is the old way of telling Linux the resolver order. On other *nix systems, this was an entry in /etc/resolv.conf called 'hostresorder'.

"old way". As in there are newer 'better' ways. It's still there 'cause it's the most known in the Linux world. As one of the other posters said, you can remove it, and it won't have any affect, assuming your nsswitch.conf is configured properly.
One long-haired git at your service...