การติดตั้ง DNS Server

DNS (Domain Name Server) หรือ named Server เป็นตัวที่ใช้ในการแปลง ชื่อ เป็น ip และจาก ip เป็นชื่อ
ให้ใส่ CD แผ่นที่ 2 ใน เครื่อง Server และที่เครื่องลูกที่เราทำงาน ไปที่หน้าต่างของโปรแกรม putty

login as: root
Sent username "root"
[email protected]'s password:
Last login: Mon Aug 12 16:54:16 2002
[root@one root]# mount /mnt/cdrom/
[root@one root]# cd /mnt/cdrom/RedHat/RPMS/
[root@one RPMS]# rpm -Uvh bind-utils-9.2.0-8.i386.rpm
Preparing... ########################################### [100%]
1:bind-utils ########################################### [100%]
[root@one RPMS]# rpm -Uvh bind-9.2.0-8.i386.rpm
Preparing... ########################################### [100%]
1:bind ########################################### [100%]
[root@one RPMS]# rpm -Uvh caching-nameserver-7.2-1.noarch.rpm
Preparing... ########################################### [100%]
1:caching-nameserver ########################################### [100%]
[root@one RPMS]#

จากนั้นสั่ง vi /etc/named.conf

// generated by named-bootconf.pl

options {
directory "/var/named";
forwarders {
203.146.0.20 ; เป็น DNS ของ loxinfo ซึ่งใช้อยู่
203.146.0.30 ; เป็น DNS ของ loxinfo ซึ่งใช้อยู่
};
/*
* If there is a firewall between you and nameservers you want
* to talk to, you might need to uncomment the query-source
* directive below. Previous versions of BIND always asked
* questions using port 53, but BIND 8.1 uses an unprivileged
* port by default.
*/
// query-source address * port 53;
};

//
// a caching only nameserver config
//
controls {
inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
zone "." IN {
type hint;
file "named.ca";
};

zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};

zone "abcdef.com" IN {
type master;
file "abcdef.com.zone";
allow-update { none; };
};

zone "1.168.192.in-addr.arpa" IN {
type master;
file "1.168.192.rev";
allow-update { none; };
};

include "/etc/rndc.key";

หมายเหตุ ข้อความใน สีแดง ข้างบนหมายถึงให้เราพิมพ์เพิ่มเข้าไป

จากนั้นก็บันทึกโดย กดปุ่ม ESC ตามด้วย :wq แล้วกดปุ่ม ENTER เราก็จะได้แฟ้ม named.conf ซึ่งอยู่ที่ /etc/named.conf

ลำดับต่อไป ไปที่ /var/named

[root@one RPMS]# cd /var/named/
[root@one named]# ls
localhost.zone named.ca named.local
[root@one named]# cp named.local abcdef.com.zone
[root@one named]# cp named.local 1.168.192.rev
[root@one named]#

ต่อไปแก้แฟ้ม abcdef.com.zone โดย vi /var/named/abcdef.com.zone

$TTL 86400
@ IN SOA one.abcdef.com. root.one.abcdef.com. (
1997022701 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum

IN NS one.abcdef.com.
IN MX 10 mail.abcdef.com.
one IN A 192.168.1.1
mail IN CNAME one
ftp IN CNAME one
www IN CNAME one

;

แล้วทำการบันทึก จากนั้นเราก็แก้แฟ้ม 1.168.192.rev โดย vi /var/named/1.168.192.rev

$TTL 86400
@ IN SOA one.abcdef.com. root.one.abcdef.com. (
1997022701 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS one.abcdef.com.
1 IN PTR one.abcdef.com.
;

แล้วทำการบันทึก แล้วสั่งให้ named ทำงานโดยใช้คำสั่ง

[root@one root]# /etc/init.d/named start
Starting named: [ OK ]
[root@one root]#

จากนั้นลอง nslookup ดู

root@one root]# nslookup
Note: nslookup is deprecated and may be removed from future releases.
Consider using the `dig' or `host' programs instead. Run nslookup with
the `-sil[ent]' option to prevent this message from appearing.
> www.abcdef.com <== ลองกรอกลงไป
Server: 192.168.1.1
Address: 192.168.1.1#53

www.abcdef.com canonical name = one.abcdef.com.
Name: one.abcdef.com
Address: 192.168.1.1
> mail.abcdef.com <== ลองกรอกลงไป
Server: 192.168.1.1
Address: 192.168.1.1#53

mail.abcdef.com canonical name = one.abcdef.com.
Name: one.abcdef.com
Address: 192.168.1.1
> 192.168.1.1 <== ลองกรอกลงไป
Server: 192.168.1.1
Address: 192.168.1.1#53

1.1.168.192.in-addr.arpa name = localhost.
>
[1]+ Stopped nslookup
[root@one root]#

หรือจะลองใช้ คำสั่ง dig ดู

[root@one root]# dig

; <<>> DiG 9.2.0 <<>>
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 54637
;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 1

;; QUESTION SECTION:
;. IN NS

;; ANSWER SECTION:
. 432364 IN NS C.ROOT-SERVERS.NET.
. 432364 IN NS D.ROOT-SERVERS.NET.
. 432364 IN NS E.ROOT-SERVERS.NET.
. 432364 IN NS F.ROOT-SERVERS.NET.
. 432364 IN NS G.ROOT-SERVERS.NET.
. 432364 IN NS H.ROOT-SERVERS.NET.
. 432364 IN NS I.ROOT-SERVERS.NET.
. 432364 IN NS J.ROOT-SERVERS.NET.
. 432364 IN NS K.ROOT-SERVERS.NET.
. 432364 IN NS L.ROOT-SERVERS.NET.
. 432364 IN NS M.ROOT-SERVERS.NET.
. 432364 IN NS A.ROOT-SERVERS.NET.
. 432364 IN NS B.ROOT-SERVERS.NET.

;; ADDITIONAL SECTION:
J.ROOT-SERVERS.NET. 518764 IN A 192.58.128.30

;; Query time: 4 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Fri Dec 20 10:45:27 2002
;; MSG SIZE rcvd: 244

[root@one root]#

หรือจะลอง dig ไปที่ IP 202.28.131.11

[root@one root]# dig 202.28.131.11

; <<>> DiG 9.2.0 <<>> 202.28.131.11
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 23934
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;202.28.131.11. IN A

;; Query time: 3999 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Fri Dec 20 10:47:45 2002
;; MSG SIZE rcvd: 31

[root@one root]#

แสดงว่า DNS ทำงานแล้วก็จบการ Config ของ DNS

|BACK|. : : By Mr.Sontaya
Hosted by www.Geocities.ws

1