configure dns in centos

Hi, how do I set the DNS in centos.

I don't mean of creating DNS server, but setting what should be the DNS server of centos.

I mean to what server he should go in order to translate url into ip

ur question is not clear
i mean in LAN or public u want,

u want to create new DNS server in ur LAN ? go through the below URL
HOWTO: Setting Up Your Own Local DNS Server - Mark S. Kolich

No, I do NOT want to create a DNS server.

I want to tell the centos what is the ip of the DNS server.
Currently for some reason it behave as if it doesn't know any ip.

I mean how do I tell the centos that 8.8.8.8 should be the DNS server that the computer use?

There's probably a sysconf-* command, but the direct approach would be adding the line

nameserver 8.8.8.8

in /etc/resolv.conf .

1 Like

can you elaborate more about the sysconf-* command.

Because I tried to use it but I could not.
I got a message "command not found ".

All the Red Hat derivatives that I know (CentOS, RHEL, Fedora) have commands to configure the system. I never used them since I'm more comfortable editing the config files myself, based on templates, so I actually had to consult with Doctor Google on what they're called: system-config-xxx where xxx are various categories like network, ...

1 Like

Hey how are you.
I'm a Solaris admin but I have been doing a lot of RHEL administration lately. No matter what UNIX or Linux distro I have work with, the /etc/resolve.conf file is used to point a server to the DNS server. If you don't want to use a editor like vi, then use this command.

Example your DNS server's IP is 10.0.0.1

echo nameserver 10.0.0.1 >>  /etc/resolve.conf 

This should be what you see;

cat /etc/resolve.conf 
nameserver 10.0.0.1

You can also use the GUI.
System --> Administration --> Network
you can edit the the interfase in this GUI.

I hope this helps

1 Like