Operating System - HP-UX
1753971 Members
8130 Online
108811 Solutions
New Discussion юеВ

Host file or DNS resolution of a server

 
SOLVED
Go to solution
Manoj1
Advisor

Host file or DNS resolution of a server

Hi all,

I need to find out whether a fully qualified domain name is being resolved by /etc/hosts file or a DNS server ?

Our servers are configured to look in local host first and then dns.

Also can i specify in nslookup to resolve only through DNS Server ?

Thanks,
Manoj
3 REPLIES 3
Bill Hassell
Honored Contributor
Solution

Re: Host file or DNS resolution of a server

Just ask nsquery to tell you:

nsquery hosts fully.qualified.com

nsquery is preferred over nslookup as it describes all the resolver steps. hostname resolution is controlled by two files:

/etc/resolv.conf
/etc/nsswitch.conf

nslookup and nsquery follow the rules in nsswitch.conf, but if nsswitch.conf and resolv.conf do not exist, all resolution is theough /etc/hosts. If resolve.conf exists but nsswitch.conf does not, then all resolution is through the DNS servers listed in resolv.conf.

nslookup will look only at the DNS server you supply on the command line, regardless of nsswitch.conf or resolv.conf -- just put the DNS server on the command line like this:

nslookup hp.com 8.8.8.8

This is a good way to test selected DNS servers but that changes nothing for programs and applications use system calls. They will follow the resolver rules (man resolv.conf and man nsswitch.conf)


Bill Hassell, sysadmin
Manix
Honored Contributor

Re: Host file or DNS resolution of a server

In /etc/hosys you may specify either "hostnmae"
of "FQDN" with the IP address or both it`s just a local lookup and not aware of any thing
unless you specify.

Where as DNS is configured to resolve domain specific queries & "domain name "is always
mentioned while configuring DNS.

Hope this helps.

Thanks

Manix
HP-UX been always lovable - Mani Kalra
Ismail Azad
Esteemed Contributor

Re: Host file or DNS resolution of a server

Hi,

Nsquery should do a "hostname fallback" analysis of your /etc/nsswitch.conf file. In case you have in /etc/nssiwtch.conf

hosts: dns nis files

Then, if dns resolution fails, it will fallback to nis and if nis fails it will fallback to /etc/hosts and the whole flow should be shown with the command nsquery. Remember you can also manipulate the behaviour of the fallback by mentioning the states NOTFOUND, UNAVAIL etc.

>Manix

"In /etc/hosys you may specify either "hostnmae"
of "FQDN" with the IP address or both it`s just a local lookup and not aware of any thing
unless you specify".

This is right but not in case the server is a DNS server. If it the server is serving as a DNS name server you will require an FQDN in the /etc/hosts file.

Regards
Ismial Azad
Read, read and read... Then read again until you read "between the lines".....