LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to add DNS IP address through terminal ? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-add-dns-ip-address-through-terminal-855527/)

gardenair 01-11-2011 02:51 AM

How to add DNS IP address through terminal ?
 
Hi,
In Red Hat Linux GUI interface i know that under Network Configuration there is a DNS tab and there I want write my DNS IP address.
Well I want to add DSN entries through command line. which file should I edit and write

Primary DNS:
Secondary DNS:
Teriary DNS:

thanks
garden

repo 01-11-2011 03:01 AM

Edit
Quote:

/etc/resolv.conf
Quote:

nameserver xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.xxx
Kind regards

gardenair 01-11-2011 03:06 AM

thanks for reply .well what about # etc/sysconfig/network file.What is the purpose of this file ?

repo 01-11-2011 03:08 AM

Quote:

Originally Posted by gardenair (Post 4220234)
thanks for reply .well what about # etc/sysconfig/network file.What is the purpose of this file ?

http://www.faqs.org/docs/securing/chap9sec93.html

Kind regards

gardenair 01-11-2011 04:36 AM

thanks "repo" for the reply.About gateway it clear but when we go to # cat /etc/host i can see
Code:

127.0.0.1 localhost.localdomain localhost
what this files do ? Actually i am confuse about /etc/resolv.conf and /etc/hosts file.
By default after fresh installation in GUI interface under Network Configuration DNS tab i can see Hostname as
localhost.localdomain and this can be viewed in
Code:

cat /etc/hosts
file as following
Code:

127.0.0.1 localhost.localdomain localhost
This indicate what ever i check that in /etc/hosts reflect what ever i see in GUI INTERFACE.
So to put DNS IP address in this file is wrong ?
Please again guide me .
thanks

repo 01-11-2011 04:40 AM

Quote:

So to put DNS IP address in this file is wrong ?
Yes, resolv.conf is the place to put your DNS
You can however use the hosts file to put some isolated nodes.
See
http://linux.die.net/man/5/hosts

Kind regards

gardenair 01-11-2011 04:50 AM

so
Code:

/etc/resolv.conf
well it means the word nameserver is the keyword for linux and just ahead we have to assign our DNS IP address ?
Example

Quote:

nameserver 192.168.1.200
nameserver 192.168.1.201
nameserver 192.168.1.202
where

192.168.1.200 is primary DNS,192.168.1.201 is Secondary DNS and 192.168.1.202 is Tretiary DNS
I am sure now i am correct!
thanks

repo 01-11-2011 04:55 AM

As long as the ip's are from a dns server, it's correct.

Kind regards

gardenair 01-11-2011 04:59 AM

thanks "repo" a lot :hattip:
one thing which i want to confirm again that nameserver is a keyword here or it can be as anything else

# vi /etc/resolv.conf

Quote:

nameserver 192.168.1.200
nameserver 192.168.1.201
nameserver 192.168.1.202
yes i know that ip's should be from a dns server,


All times are GMT -5. The time now is 01:15 PM.