/etc/resolve.conf or resolv.conf File Example

The resolv.conf file is the resolver configuration file. It is use to configure client side access to the Internet Domain Name System (DNS). This file defines which name servers to use.

The resolver is a set of routines in the C library that provide access to the Internet Domain Name System (DNS). The resolver configuration file contains information that is read by the resolver routines the first time they are invoked by a process. The file is designed to be human readable and contains a list of keywords with values that provide various types of resolver information

Note: File name is /etc/resolv.conf and not /etc/resolve.conf.

Sample resolv.conf file

Following is an example of resolv.conf file:

search cyberciti.biz
nameserver 202.54.1.10
nameserver 202.54.1.11

Where,

  • search domain.com: The search list is normally determined from the local domain name; by default, it contains only the local domain name. So when you type nslookup www, it will be matched to www.cyberciti.biz
  • nameserver Name-server-IP-address: Point out to your your own nameserver or to ISP’s name server. Up to 3 name servers may be listed.

But how do I edit the /etc/resolv.conf file?

Use text editor such as vi or gedit from Linux desktop:
# vi /etc/resolv.conf

Default /etc/resolv.conf file

Following file should be work with any ISP in the world :)
# cat /etc/resolv.conf
Output:

For more information see How to Setup Linux as DNS client.

Author: admin

I like chocolate, gadgets, open source software, photography, traveling and all shades of green colors. I love spending time with fun loving friends and family members. This is my own online journal.

17 thoughts on “/etc/resolve.conf or resolv.conf File Example”

  1. Yes it is the basic file and lots of guys donT understand how to and whats it for.

    Then they complaint for the slow internet speed:
    humm

    pushkar bhtkoti
    CCNA/CCNP/CCDP/CCSP/MCSE
    sydney

  2. once you have the nameserver in your /etc/resolv.conf …then you can run #host name ..to check
    i.e
    #hostname prod_servername

  3. vikha: nameserver is a keyword you have to write it as is, so in your resolv.conf file:
    nameserver 208.67.220.220
    nameserver 208.67.222.222

    Hope this help.

  4. Guys,

    Is it possible to provide diferrent DNS servers in resolv.conf for different domains?
    so abc.com –> gets resolved by DNS1 and xyz.com gets resolved by DNS2 ?

    ALL is well

  5. I keep wondering: I have seen things like this in resolv.conf:

    search server_ name

    instead of:

    search domain_name

    And I know both of them work so which one is better? Thanks a lot !!!

Leave a Reply

Your email address will not be published. Required fields are marked *