HowTo: Edit The /etc/resolv.conf File in CentOS Linux

How do I edit /etc/resolv.conf file in CentOS Linux?

You need to use the text editor such as vi / vim or joe make changes to /etc/resolv.conf file. You must be logged in as root user in order to change this file. The /etc/resolv.conf is resolver configuration file. You can set nameserver ip address and domain search query name in this file.

Edit File Using Vi or Joe Text Editor

Type the following command:
vi /etc/resolv.conf
OR
joe /etc/resolv.conf
Edit as follows and set name server IP address:

search dnsknowledge.com
nameserver 69.9.190.5
nameserver 69.9.162.17

Save and close the file. Test new settings either with dig or host command:

dig google.com
host google.com
dig  dnsknowledge.com

{ 2 comments… read them below or add one }

rav October 22, 2012 at 1:00 am

Thanks it was helpful!!

Reply

bunga February 22, 2013 at 3:35 am

thanx a lot!

Reply

Leave a Comment

Previous post:

Next post: