/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:

nameserver 208.67.220.220
nameserver 208.67.222.222

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

Meet the 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 comments… add one
  • Pushkar Bhatkoti Feb 11, 2006, 4:51 am

    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

  • aravind May 23, 2006, 6:45 pm

    i want to know the secret dns server address

  • nixCraft May 23, 2006, 7:21 pm

    aravind, if you want to find out address of your DNS server then read this http://www.cyberciti.biz/faqs/2006/01/how-to-find-out-what-my-dns-servers.php

  • shubh Jun 24, 2008, 11:12 am

    thanx i resolve my problem

  • Francisco May 19, 2009, 3:50 pm

    Hi everyone
    And now who I know if it’s working ?

  • rk Sep 4, 2009, 7:36 am

    hi,
    what is the use of adding domain in /etc/resolv.conf ?

  • ahmbay Sep 6, 2009, 3:57 pm

    thanx i resolve my problem

  • ddk Oct 6, 2009, 5:03 am

    thanx i resolve my problem

  • Abu Sufian Nov 6, 2009, 5:14 pm

    Hello. i want learn how to configure DNS server in Linux. But i didn’t clearly understand the topic resolve.conf. the problem am facing is that if am establishing a (DNS)server say http://www.xyz.com ..what should i do?? can i put this on resolve.conf file like
    serach http://www.xyz.com
    nameserver 192.168.1.1

    please help me my email address is sufian_bd@hotmail.com

  • Nyiko Khoza Dec 10, 2009, 10:36 am

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

  • vikha Dec 17, 2009, 9:32 am

    nameserver 208.67.220.220
    nameserver 208.67.222.222

    do you means nameserver is my domain name?
    is this correct example :
    http://www.mydomain.com 208.67.220.220
    http://www.mydomain.com 208.67.222.222

    is this working if I make file in directory /etc/resolv.conf in shared webhosting??

    sory for my english. :( :)

  • vikha Dec 17, 2009, 9:33 am

    i realy need your help :(

  • Teaser Dec 30, 2009, 11:52 am

    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.

  • Phunsukh Wangdow Jun 26, 2010, 10:25 am

    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

  • Victor Chaves Nov 3, 2010, 2:29 pm

    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 !!!

  • koriaki Jan 21, 2011, 1:46 am

    Good reference for resolv.conf
    Setup as DNS Client / Name Server IP Address –
    http://www.cyberciti.biz/tips/linux-how-to-setup-as-dns-client.html

  • Josh Jan 18, 2014, 6:56 pm

    Why would someone put ‘nameserver 8.8.8.8’ instead of their global IP?

Leave a Comment