set DNS

Issues related to configuring your network
Post Reply
ccrum
Posts: 6
Joined: 2007/03/23 19:44:05

set DNS

Post by ccrum » 2007/03/23 19:55:36

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

foxb
Posts: 1927
Joined: 2006/04/20 19:03:33
Location: Montreal/QC

set DNS

Post by foxb » 2007/03/23 20:37:36

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

ccrum
Posts: 6
Joined: 2007/03/23 19:44:05

Re: set DNS

Post by ccrum » 2007/03/23 21:52:56

I ran setup, but it never asked me for DNS entries. Any other ideas?

ccrum
Posts: 6
Joined: 2007/03/23 19:44:05

Re: set DNS

Post by ccrum » 2007/03/23 21:57:00

OK...I ran it again and there were two more entries in there...the first time there was only IP and subnet. Strange.

Cameron

yyagol
Posts: 1015
Joined: 2006/06/10 18:27:44
Location: 32 4′N 34 47′E
Contact:

Re: set DNS

Post by yyagol » 2007/04/07 17:02:41

[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]

.

Post Reply

Return to “CentOS 4 - Networking Support”