分类:
2008-03-11 10:56:57
# vi /etc/named/named.localhost
TTL 600
@ IN SOA localhost. root.localhost. (
20080228 ;serial
28800 ;refresh
14400 ;retry
720000 ;expire
86400 ;minimum
)
@ IN NS localhost.
localhost. IN A 127.0.0.1
编辑/etc/named/named.127.0.0 文档
# vi /etc/named/named.127.0.0
$TTL 600
@ IN SOA localhost. root.localhost. (
20080228 ;serial
28800 ;refresh
14400 ;retry
720000 ;expire
86400 ;minium
)
@ IN NS localhost.
1 IN PTR localhost.编辑/etc/named/named.mysite.com正解文档
# vi /etc/named/named.mysite.com
$TTL 600
@ IN SOA mysite.com. root.mysite.com. (
20080228 ;serial
28800 ;refresh
14400 ;retry
720000 ;expire
86400 ;mininum
)
@ IN NS mysite.com.
@ IN MX 10 mail.mysite.com.
mysite.com. IN A 192.168.0.105
www IN A 192.168.0.105
mail IN CNAME www
ftp IN A 192.168.0.106编辑/etc/named/named.192.168.0反解文档
# vi /etc/named/named.192.168.0$TTL 600
@ IN SOA mysite.com. root.mysite.com. (
20080228
28800
14400
720000
86400
)
@ IN NS mysite.com.
105 IN PTR mysite.com.
105 IN PTR
106 IN PTR .第四步:启动测试
让自己的DNS服务器指向自己如果想加入独立日志功能安如下操作
#echo "nameserver 127.0.0.1"> /etc/resolv.conf
启动bind
#/usr/local/bind/sbin/named
[root@localhost ~]# nslookup
> mysite.com
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: mysite.com
Address: 192.168.0.105
> ftp.mysite.com
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: ftp.mysite.com
Address: 192.168.0.106
> mail.mysite.com
Server: 127.0.0.1
Address: 127.0.0.1#53
mail.mysite.com canonical name =
Name:
Address: 192.168.0.105
> set type=mx
> mysite.com
Server: 127.0.0.1
Address: 127.0.0.1#53
mysite.com mail exchanger = 10 mail.mysite.com.
> set type=a
>
Server: 127.0.0.1
Address: 127.0.0.1#53
Name:
Address: 192.168.0.105
> 192.168.0.105
Server: 127.0.0.1
Address: 127.0.0.1#53
105.0.168.192.in-addr.arpa name =
105.0.168.192.in-addr.arpa name = mysite.com.
> 192.168.0.106
Server: 127.0.0.1
Address: 127.0.0.1#53
106.0.168.192.in-addr.arpa name = ftp.mysite.com.
>
#mkdir /var/log/named
编辑/etc/named.conf
添加:
logging {
channel dns_errors
{ file "/var/log/named/err_logs" versions 3 size 10m;
severity error;
print-category yes;
print-severity yes;
print-time yes;
};
channel dns_queries
{ file "/var/log/named/query_logs" versions 3 size 10m;
severity info;
print-category yes;
print-severity yes;
print-time yes;
};
category default { dns_errors; };
category queries { dns_queries; };
};
重新启动bind