Link to home
Start Free TrialLog in
Avatar of tjie
tjieFlag 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
ASKER CERTIFIED SOLUTION
Avatar of wesly_chen
wesly_chen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Steven Vona
Steven Vona
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 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
- 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)
> : redirect the output to
>> : append the output to
Avatar of 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
> Then, I do "  cat /etc/resolv.conf_backup "
do
cat /etc/resolv.conf
   NOT (cat /etc/resolv.conf_backup)
Avatar of 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
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.
Avatar of 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
vi is everywhere in Unix/Linux world.
nano is easier and popular in modern Linux world.

It's up to you. I use vi.