≡ Menu
Home > Tutorials > OpenDNS > CentOS: Use OpenDNS To Resolve Hostnames

CentOS: Use OpenDNS To Resolve Hostnames

How do I use OpenDNS server for my CentOS Linux vps or dedicated server to resolve hostnames?

You need to edit the /etc/resolv.conf file which is resolver configuration file for CentOS Linux server. The syntax is as follows:

nameserver {Name server IP address}

How To Use OpenDNS For Centos Server

You need to set name server that the resolver should query and up to 3 name servers may be listed in /etc/resolv.conf file. Edit /etc/resolv.conf, run:
vi /etc/resolv.conf
Append / modify the file as follows:

nameserver 208.67.222.222
nameserver 208.67.220.220

Save and close the file.

Test It

Type the following command:
dig google.com
Sample outputs:

; <<>> DiG 9.6.1-P1 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51272
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;google.com.			IN	A

;; ANSWER SECTION:
google.com.		65	IN	A	74.125.67.100
google.com.		65	IN	A	74.125.53.100
google.com.		65	IN	A	74.125.45.100

;; Query time: 202 msec
;; SERVER: 208.67.222.222#53(208.67.222.222)
;; WHEN: Sun Nov 22 18:27:01 2009
;; MSG SIZE  rcvd: 76
{ 2 comments… add one }
  • Oliver September 7, 2011, 10:34 am

    Hi,

    great tutorial.

    I am running a WHM server and right now I am using the resolvers from my hosting provider.

    Is it safe to simply change to the OpenDNS IP’s or can it break my server?

    Will it revert back to default when I reboot?

    Thank you for your help
    Oliver

  • Lina July 4, 2013, 1:26 am

    I want to know how to configure Open DNS on CentOS 5.5. could you help me?

Leave a Comment