You may use the following method to configure the Domain Name System (DNS) servers that Linux CentOS (http://www.centos.org/) will use. In this particular example the server will be configured to use the well known Google public DNS servers that utilize the following Internet Protocol (IP) addresses: 8.8.8. & 8.8.4.4.

Begin by logging into the server and elevating to the root user. You may verify the current user by issuing the whoami command.

# whoami root

Next, navigate to the /etc directory.

# cd /etc

# pwd /etc

Now, you may use the editor of your choice to edit the resolv.conf file. In this example I will be using the nano text editor.

# nano -w resolv.conf

Once the file opens use the following syntax to specify the name servers: nameserver IP Address (see the edited file below).

nameserver 8.8.8.8

nameserver 8.8.4.4

Close the editor by using ctrl+x and saving the file.

The file step is to test the configuration. This can be done by using the nslookup command to resolve a fully qualified domain name to an IP address.

# nslookup cnn.com Server: 8.8.8.8

Address: 8.8.8.8#53

 

Non-authoritative answer:

Name: cnn.com

Address: 157.166.226.25

Name: cnn.com

Address: 157.166.226.26

Name: cnn.com

Address: 157.166.255.18

Name: cnn.com

Address: 157.166.255.19

The fact that cnn.com is resolving to multiple IP addresses is most likely due to the fact that they are utilizing load balancing. Additionally, this completes the configuration.

Enjoy!