Page 1 of 1

set DNS

Posted: 2007/03/23 19:55:36
by ccrum
Forgive me as this is my first plunge into Linux. I have a new CentOS box, CLI only right now and have managed to set a public static IP using ifconfig and route commands. I can ping the box from the internet, and can ping ip address form the centos box, but the box won't resolve namespace. If I try to ping google.com, I get :

ping: unknown host google.com

So where do I set the DNS servers in Linux?

Cameron

set DNS

Posted: 2007/03/23 20:37:36
by foxb
For a newbie better use

"setup" command

It is more user friendly even from CLI

But to answer your question... look at:

/etc/resolv.conf

Re: set DNS

Posted: 2007/03/23 21:52:56
by ccrum
I ran setup, but it never asked me for DNS entries. Any other ideas?

Re: set DNS

Posted: 2007/03/23 21:57:00
by ccrum
OK...I ran it again and there were two more entries in there...the first time there was only IP and subnet. Strange.

Cameron

Re: set DNS

Posted: 2007/04/07 17:02:41
by yyagol
[quote]ccrum wrote:
I ran setup, but it never asked me for DNS entries. Any other ideas?[/quote]
The DNS are taken automaticly by the dhclient from the router/modem. the fact that
you enterd a static IP and disabling in this way the dhclient is why you do not have resolving.
the way to overcome this problem is to set-up dns nameserver in the resolv.conf file and, to tell
the server not to try and get other nameservers (xxx and yyy are ip address of dns servers):

[code]
# echo -e "nameserver\t xxx.xxx.xxx.xxx \n nameserver\t yyy.yyy.yyy.yyy" > /etc/resolv.conf
[/code]

Take a look at the file /usr/share/doc/initscripts-7.93.25.EL/sysconfig.txt , you will find the proper way.
one way is to set "PEERDNS=no" in the [b]/etc/sysconfig/network-scripts/ifcfg-ethX[/b]

.