What is the difference between /etc/hosts and /etc/resolv.conf? Also, is there a good documentation that explain all these configuration files.
Thank you. Bala
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
resolv.conf specifies the nameservers for resolver lookups, where it will actually use the DNS protocol for resolving the hostnames.
hosts file is used for administrative purposes, such as backend and internal functions, which is substantially more isolated in scope, as only the local server will reference it.
/etc/nsswitch.conf specifies the lookup order with the
If this does not answer your question, please clarify further.
Look at the following manpages:
DHCP, this file is automatically populated with DNS record issued by
hosts: files dnsthen
/etc/hostsfile will be checked first for resolution, if domain is still un-resolvable, DNS will then be consulted.
/etc/hosts: Mapping between IP addresses & hostnames, for name resolution.
127.0.0.1 localhost.localdomain localhost 10.2.3.4 myhost.domain.org myhost
/etc/nsswitch.conf: Sources that must be used by various system library lookup functions.
passwd: files nisplus nis shadow: files nisplus nis group: files nisplus nis hosts: files dns nisplus nis
/etc/resolv.conf: Domain names that must be appended to bare hostnames, and DNS servers that will be used for name resolution.
search domain1.org domain2.org nameserver 192.168.3.3 nameserver 192.168.4.4