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

by admin on October 18, 2005 · 17 comments

in Desktop Linux, Tip that matters

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


  • 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


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

{ 17 comments… read them below or add one }

1 Pushkar Bhatkoti February 11, 2006 at 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:

pushkar bhtkoti

2 aravind May 23, 2006 at 6:45 pm

i want to know the secret dns server address

3 nixCraft May 23, 2006 at 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

4 shubh June 24, 2008 at 11:12 am

thanx i resolve my problem

5 Francisco May 19, 2009 at 3:50 pm

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

6 rk September 4, 2009 at 7:36 am

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

7 ahmbay September 6, 2009 at 3:57 pm

thanx i resolve my problem

8 ddk October 6, 2009 at 5:03 am

thanx i resolve my problem

9 Abu Sufian November 6, 2009 at 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

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

10 Nyiko Khoza December 10, 2009 at 10:36 am

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

11 vikha December 17, 2009 at 9:32 am


do you means nameserver is my domain name?
is this correct example :

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

sory for my english. :( :)

12 vikha December 17, 2009 at 9:33 am

i realy need your help :(

13 Teaser December 30, 2009 at 11:52 am

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

Hope this help.

14 Phunsukh Wangdow June 26, 2010 at 10:25 am


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

15 Victor Chaves November 3, 2010 at 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 !!!

16 koriaki January 21, 2011 at 1:46 am

Good reference for resolv.conf
Setup as DNS Client / Name Server IP Address –

17 Josh January 18, 2014 at 6:56 pm

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

Previous post:

Next post: