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

by Vivek Gite · 14 comments

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.

{ 14 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:
humm

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

Reply

2 aravind May 23, 2006 at 6:45 pm

i want to know the secret dns server address

Reply

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

Reply

4 shubh June 24, 2008 at 11:12 am

thanx i resolve my problem

Reply

5 Francisco May 19, 2009 at 3:50 pm

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

Reply

6 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
i.e
#hostname prod_servername

Reply

7 rk September 4, 2009 at 7:36 am

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

Reply

8 ahmbay September 6, 2009 at 3:57 pm

thanx i resolve my problem

Reply

9 ddk October 6, 2009 at 5:03 am

thanx i resolve my problem

Reply

10 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
nameserver 192.168.1.1

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

Reply

11 vikha December 17, 2009 at 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. :( :)

Reply

12 vikha December 17, 2009 at 9:33 am

i realy need your help :(

Reply

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:
nameserver 208.67.220.220
nameserver 208.67.222.222

Hope this help.

Reply

14 Phunsukh Wangdow June 26, 2010 at 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

Reply

Previous post:

Next post: