/etc/resolv.conf

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

External

Internal

Overview

/etc/resolv.conf is the name of the file that configures the DNS resolver. The DNS resolver is a set of routines in the C library that provide access to DNS. Among other things, Template:/etc/resolv.conf configures the [default search domains|resolv.conf#DefaulSearchDomains] and the [nameserver|resolv.conf#Nameservers] IP addresses.


!!!Who Writes It?


Network configuration scripts or [Network Manager] write /etc/resolv.conf when configured to do so (see PEERDNS=yes), or not, in which case you will need to edit it manually.


!!!Configure DNS via /etc/sysconfig/network-scripts

The following settings should be specified in Template:/etc/sysconfig/network-scripts/ifcfg-ethX:

To configure the DNS resolver with a specific DNS server and __NOT__ the DNS server that comes with DHCP configuration, set:

{{{ PEERDNS=no IPV6_PEERDNS=no }}}

Note that setting only one is not sufficient, both need to be set.

Then specify the DNS IP address with

{{{ DNS1=... DNS2=... }}}

The network configuration scripts will write this into /etc/resolv.conf.

Actually, if I set PEERDNS=no, nothing is written, I need to write it manually. Return to this.

Also see [NM_CONTROLLED|LinuxNetwork#DisablingNetworkManager].


!!OpenShift Example

All (/etc/sysconfig/network-scripts/ifcfg-eth0, /etc/sysconfig/network-scripts/ifcfg-eth1):

{{{ ...

  1. DNS resolver

IPV6_PEERDNS=no PEERDNS=no NM_CONTROLLED=no DNS1=172.20.2.10 }}}

/etc/resolv.conf

{{{

  1. Manual 09/21/15

domain openshift.local search openshift.local nameserver 172.20.2.10 }}}

!!!Content

Template:/etc/resolv.conf contains

!!Nameservers

The Template:Nameserver is the DNS server IPv4 or IPv6 address.

Up to Template:MAXNS (currently 3, specified in Template:Resolv.h) name servers may be listed, one per keyword.

If multiple servers are listed, they are queried in order.

If no Template:Name server is specified, the default is to use the name server on the local machine.

Example:

{{{ nameserver 206.13.28.12 nameserver 206.13.28.13 nameserver 206.13.28.14 }}}

!!Domain

The Template:Domain keyword specifies the local domain name.

If no Template:Domain entry is present, the domain is determined from the local hostname returned by Template:Gethostname by taking everything after the first ".". If the hostname does not contain a domain part, the root domain is assumed.

Example

{{{ domain openshift.local }}}


!!Search

The search list of host name lookup. Strings added to non-canonical host names when those non-canonical host names are resolved to IP addresses.

The search list is normally determined from the local domain name, and by default it contains only the local domain name.

This may be changed by listing the desired domain search path following the Template:Search keyword. It is used as follows: resolver queries having fewer than 1 dot will be attempted using each component of the search path in turn until a match is found.


{{{ search novaordis.com }}}




__Referenced by:__\\ [{INSERT com.ecyrd.jspwiki.plugin.ReferringPagesPlugin WHERE max=20, maxwidth=50}]