resolv.conf

The /etc/resolv.conf file is where CentOS looks to resolve hostnames and domainnames that are not in the /etc/hosts file.

You can specify your nameservers as well as your search path and some other options in here.

Lets look at an example resolv.conf with comments telling you what each line does.

# this search line will automatically search for a hostname
# as localdomain, then dev.centoshowtos.org and then
# centoshowtos.org.
# ping websrv01 would try to ping websrv01.localdomain,
# websrv01.dev.centoshowtos.org and websrv01.centoshowtos.org
# in that order, and return the IP of the first one it matches
search localdomain dev.centoshowtos.org centoshowtos.org
# you can specify a lot of different options, but here are some
# examples below
# attempts - number of attempts at a server before trying next
# rotate - rotate between listed nameservers.
# by default it will try the first and only moves to the second
# if it's not reachable.
# timeout - seconds between timeouts. typically a good idea to
# set low for local dns servers because if it's unreachable and
# takes a while to timeout, it can create a bottleneck
options attempts:1 rotate timeout:1
# nameserver - dns server IP address, set these to your dns server
nameserver 10.66.6.11
nameserver 10.66.6.12

It’s also worth noting that this file is overwritten by the dhcp client if you do not have a statically assigned address. If you obtain your IP via dhcp, you want to set up the dhcp server to handout these options.

(Comments)

Comments