Avatar of tjie
tjie
Flag for United States of America asked on

Cento 5: To Configure the DNS server

Hi,

1) I have a linux server (which host name is Centos_5) in the Active Directory Environment
2) The Domain Controllers (DC1 and DC2) and the Centos_5 are in LAN 1
- LAN 1: 172.17.17.0/24
- The IP of Centos_5 is "172.17.17.30"
- DC1 is "172.17.17.10"
- DC1 and Centos_5 can ping each other by its IP addresses

3) My Goal:
- I want to configure the DNS server for Centos_5 (the DNS server or name server are the IP of DC1 and DC2 (172.17.17.10 and 172.17.17.11)

4) At Centos_5
- Login as root
- cd /etc
- [root@Centols_5 etc]#
- Type in: gedit resolv.conf
- The error messages:

xlib: connection to ":0.0" refused by server
xlib: no protocol specified

cannot open display:
Run 'gedit --help' to see a full list of available command line options

5) As I mention above that the goal is to configure the DNS server or name servers at Centos_5
6) Any help?
7) Thanks

tjie
LinuxLinux NetworkingLinux Security

Avatar of undefined
Last Comment
wesly_chen

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
wesly_chen

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Steven Vona

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
tjie

ASKER
Hi Wesley_Chen

1) I follow the above EXCEPT echo "nameserver  172.17.17.11" >> /etc/resolv.conf (right her, I just type with ONE " > "; I am not sure the right one is ONE  (of ">") or TWO (of " >>")

2) Then, when do " cat /etc/resolv.conf_backup"
- the answer is " search local domain"

3) So, Have I configured the DNS servers at this Centos_5?
- If Yes, How can I know it?

4) Thanks

tjie
wesly_chen

- echo "nameserver  172.17.17.11" >> /etc/resolv.conf (right her, I just type with ONE " > "
1.
You need ">>" for the second line. Otherwise it will override the first one.
Andy just do it again.

echo "nameserver  172.17.17.10" > /etc/resolv.conf
echo "nameserver  172.17.17.11" >> /etc/resolv.conf

2.
cat /etc/resolv.conf
  to confirm (it's ok for /etc/resolv.conf_backup, nothing need to add to the new one)
wesly_chen

> : redirect the output to
>> : append the output to
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
tjie

ASKER
Hi Wesley_Chen,

1) I did with ">>" for 172. . .11"
2) Then, I do "  cat /etc/resolv.conf_backup "
- The answer is the same as above --> search local domain

3) Has the nameserver or DNS been configured?
- I believe that it has NOT been configured
- Any comment or confirmation?

4) Thanks

tjie
wesly_chen

> Then, I do "  cat /etc/resolv.conf_backup "
do
cat /etc/resolv.conf
   NOT (cat /etc/resolv.conf_backup)
tjie

ASKER
1) Yes, you are the man

2) When I type: cat /etc/resolv.conf

3) I got the answer:
nameserver 172.17.17.10
nameserver 172.17.17.11

--> so I got the DNS servers for this Centos_5

4) The things that still confused me:
- Why You have to do or to create " /etc/resolv.conf_backup "....and we do not use this "resolv.conf_backup" ----> is it for Security reason?
- the 2nd things that I need your confirmation:
- So to create a new " /etc/resolv.conf ", I can use this formula

 *echo "nameserver  172.17.17.10" > /etc/resolv.conf
 * echo "nameserver  172.17.17.11" >> /etc/resolv.conf

5) Just explain in general a little bit of #4 please
6) Thanks

tjie
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
wesly_chen

A4. Yes, it is for security reason in case something wrong and you can roll back the change.

  Say,
  $ echo A
   and it returns
  A
   on the screen

So
echo "nameserver  172.17.17.10"
  returns (whatever within "... " )
nameserver  172.17.17.10
  on the screen

echo "nameserver  172.17.17.10" > /etc/resolv.conf
   It redirect screen output to the file /etc/resolv.conf and override anything in that file (it file not exist, it creates one.)

echo "nameserver  172.17.17.11" >> /etc/resolv.conf
   append "nameserver  172.17.17.10" to  the file, /etc/resolv.conf as second line.
tjie

ASKER
Hi Wesley_Chen & Savone:

1) One more related question ...

2) Per Savone,

""" Gedit is a graphical text editor like notepad but you are trying to start it in an environment without graphics (command line). """

3) My question:

- Which editor should I use for it? Nano? Vi?

4) Thanks

tjie
wesly_chen

vi is everywhere in Unix/Linux world.
nano is easier and popular in modern Linux world.

It's up to you. I use vi.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy