วิธีการติดตั้งและคอนฟิก DNS Server บนลินุกซ์
ระบบที่ทดสอบ
- Fedora 8
- bind-9.5.0-23.b1.fc8.i386.rpm
- bind-chroot-9.5.0-23.b1.fc8.i386.rpm
คอนฟิกพื้นฐานของ Server
- IP Address: 192.168.1.1
- Subbet Mask: 255.255.255.0
ตัวอย่างไฟล์คอนฟิก /var/named/chroot/etc/named.conf
options {
directory "/var/named";
dump-file "data/cache_dump.db";
statistics-file "data/named_stats.txt";
memstatistics-file "data/named_mem_stats.txt";
recursion yes;
};
zone "." IN {
type hint;
file "named.ca";
};
zone "your-domain.com" IN {
type master;
file "zones/your-domain.com.zone";
};
zone "1.168.192.in-addr.arpa" IN {
type master;
file "zones/192.168.1.zone";
};
include "/etc/named.rfc1912.zones";
ตัวอย่างไฟล์ /var/named/chroot/var/named/zones/your-domain.com.zone
$ORIGIN .
$TTL 86400
your-domain.com IN SOA your-domain.com. root.your-domain.com. (
2008050401 ; serial
10800 ; refresh (3 hours)
900 ; retry (15 minutes)
604800 ; expire (1 week)
86400 ; minimum (1 day)
)
NS ns1.your-domain.com.
A 192.168.1.1
MX 0 mail.your-domain.com.
$ORIGIN your-domain.com.
ns1 A 192.168.1.1
mail A 192.168.1.1
www A 192.168.1.1
ตัวอย่างไฟล์ /var/named/chroot/var/named/zones/192.168.1.zone
$ORIGIN .
$TTL 86400
1.168.192.in-addr.arpa IN SOA your-domain.com. root.your-domain.com. (
2008050401 ; serial
10800 ; refresh (3 hours)
900 ; retry (15 minutes)
604800 ; expire (1 week)
86400 ; minimum (1 day)
)
NS ns1.your-domain.com.
MX 0 mail.your-domain.com.
$ORIGIN 1.168.192.in-addr.arpa.
81 PTR ns1.your-domain.com.
Start DNS Server
ใช้คำสั่ง service เพื่อ start DNS Server
[root@server etc]# service named start Starting named: [ OK ]
การทดสอบ
บนเครื่อง client ที่เป็น Windows เราสามารถใช้คำสั่ง ping ในการทดสอบ DNS
C:\Documents and Settings\user\ping www.your-domain.com Pinging www.your-domain.com [192.168.1.1] with 32 bytes of data Reply from 192.168.1.1: bytes times=1ms TTL=235 [Ctrl-C] ...
Stop DNS Server
ใช้คำสั่ง service เพื่อ stop DNS Server
[root@server etc]# service named stop Shutting down named: [ OK ]
ข้อมูลอ้างอิง