Operating System - HP-UX
1753876 Members
7490 Online
108809 Solutions
New Discussion юеВ

Re: Resolving by hosts or DNS ...

 
SOLVED
Go to solution
Manuales
Super Advisor

Resolving by hosts or DNS ...

Hi, i would like you explain to me how the following files are joined, i mean, i need to know what file (s)i have to review into the operating system to know how the operating system is working when i need to login there or when i need to reach a server ...

I know there are these files:
what is the format?
resolve.conf
hosts
nsswitch

are there more configuration files i have to know?

thanks in advance.
Manuales.
11 REPLIES 11
James R. Ferguson
Acclaimed Contributor

Re: Resolving by hosts or DNS ...

Hi:

If I understand your question, correctly, yes, these three files would show you the basic DNS network configuration.

Regards!

...JRF...
Jaime Bolanos Rojas.
Honored Contributor

Re: Resolving by hosts or DNS ...

Hola Manuales,

I really did not understand your question, you might have elaborate a bit more on it.

The information on those files in located in their respective man pages:

# man resolv.conf
# man hosts
# man nsswitch.conf

Regards,

Jaime.
Work hard when the need comes out.
Manuales
Super Advisor

Re: Resolving by hosts or DNS ...

i need to understand how those files work toguether and what is i have to configure in each one of them ..
Steven E. Protter
Exalted Contributor

Re: Resolving by hosts or DNS ...

Shalom,

nsswitch.conf - decides how resolution will be done. Can include or exclude file based resoution, ldap, many options.

resolve.conf - lists what DNS servers will be used top to bottom if DNS is used for host resolution. nsswitch configuration controls how long DNS will take to fail over to secondary hosts or if it even will.

/etc/hosts
File based name resolution. Can exist without DNS or be used in combination to provide short name resolution.

SEP
nsswitch.conf
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
Jaime Bolanos Rojas.
Honored Contributor

Re: Resolving by hosts or DNS ...

Ohh that├В┬┤s easy all that info is in the man pages listed above, for ease of reading you can always find them in www.docs.hp.com.

Regards,

Jaime.
Work hard when the need comes out.
Manuales
Super Advisor

Re: Resolving by hosts or DNS ...

in Windows there are two files to be taken: hosts and lhosts ....

in unix, are there only these 3 files?
resolve.conf
hosts
nsswitch.conf

please let me know if one file is missed or not.

thanks.
Jaime Bolanos Rojas.
Honored Contributor
Solution

Re: Resolving by hosts or DNS ...

Manuales, there are two ways to resolve, by hosts files or by DNS. The file that tells which methods to use or which to use first because you can also use two of them is the nsswitch.conf.
Now if you are using DNS you are going to need the third file which is the resolv.conf which is the one that handles resolver information for the DNS servers located in a different place without or outside your network.

Jaime.
Work hard when the need comes out.
James R. Ferguson
Acclaimed Contributor

Re: Resolving by hosts or DNS ...

Hi (again) Manuales:

> in Windows there are two files to be taken: hosts and lhosts ...

And UNIX ain't WinDOZ even though the original DOS "operating system" borrowed from it.

Regards!

...JRF...
Matti_Kurkela
Honored Contributor

Re: Resolving by hosts or DNS ...

Each of these files has a man page, which completely describes the file format. These man pages are also available at docs.hp.com.

/etc/nsswitch.conf:
type "man nsswitch.conf", or read
http://docs.hp.com/en/B2355-60103/nsswitch.conf.4.html

/etc/resolv.conf (NOTE: there is no "e" in resolv.conf):
type "man resolv.conf" or read
http://docs.hp.com/en/B2355-60103/resolver.4.html

/etc/hosts:
http://docs.hp.com/en/B2355-60103/hosts.4.html

Basically, all of these are text files, in which each line may be blank, a comment or a record. The record format for each file is described in the man pages.

When a process is started, the standard start-up code reads /etc/nsswitch.conf and loads the correct name service libraries from /usr/lib. The nsswitch.conf file control many types of name services: for hostname resolution, the name service types are "hosts" for traditional TCP/IP hostname resolution, and "ipnodes" for IPv6-aware programs.
(NOTE: IPv6-aware programs are likely to use "ipnodes" hostname resolution settings for IPv4 traffic too.)

The "hosts" and "ipnodes" records in the nsswitch.conf file select the data source(s) for hostname resolution. If multiple data sources are specified, it determines which source is examined first and when to give up.

The "files" source uses configuration files in the local system: in the case of hostname resolution, the file is /etc/hosts. This file is a simple list of IP addresses, their official hostnames (preferably in fully qualified form) and alias names, if any.

Any unix-style host with a static IP address should always include a record with that IP address and its own valid hostname in /etc/hosts: network-aware programs will attempt to resolve the server's own name/IP surprisingly often. If the network is not accessible, this may cause significant delays in many applications if the host's own name cannot be resolved locally using /etc/hosts.

The "dns" source reads /etc/resolv.conf to find a list of DNS nameservers which can be queried for hostname/IP address information.
The resolv.conf file also specifies the default domain, which is automatically appended to any hostname which does not contain a domain part, or a search list of multiple domain parts to try.

The "dns" source assumes that all nameservers listed in /etc/resolv.conf are equal: that is, if one server responds "this name does not exist" it is assumed to be the truth. There will be no attempt to get a second opinion from other nameservers. The other nameservers will be contacted only if the primary nameserver does not respond at all.

Other sources like "ldap", "nis" or "nisplus" may be used, but "files" and "dns" are the most common for hostname resolution.

MK
MK