centos set dns

domain name not resolving on a CentOS box?

[root@localhost ~]# ping -c2 www.google.com
ping: unknown host www.google.com

Edit /etc/resolv.conf to add some nameservers:

# Googles Public DNS
nameserver 8.8.8.8
nameserver 8.8.4.4
search localdomain

No reboot necessary!

(writing this basic step because Googling does not provide simple answer. ) This is not obviously how to set up a DNS server – it is just how to get the box to resolve DNS. old school basics that no one seems to want to document.

This entry was posted in CentOS, Linux. Bookmark the permalink.

2 Responses to centos set dns

  1. Tyron says:

    I’ve been scratching my head with my centos 5.7 box,it won’t resolve dns names even with a static ip or putting it on dhcp.I’ve confirmed my resolv.conf file and it currently has two nameservers.

    The box routes through my router,my router can resolve dns names correctly but centos can’t,it can ping the internet but cant make dns requests.If i specify a static dns entry on the router then centos can resolve that,i’ve also tried making the primary dns ip as the same gateway that the router uses but no help.

    Any help or suggestion would be much appreciated at this point

  2. gare says:

    Hi Tyron,

    I would confirm the nameserver entries you are using. Can you ping them? What happens when you try using nameserver 8.8.8.8 in your /etc/resolv.conf? That is Google’s public dns service, freely available.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>