DNS配置(FB6.22)
#########################BIND9 安装########################
cd /usr/ports/dns/bind9
make install clean
#########################BIND9 配置########################
修改 /var/named/etc/namedb/named.conf (以huang.com为例)
zone "huang.com" {
type master;
file "master/huang.com";
};
增加 /var/named/etc/namedb/master/huang.com 内容为:
$TTL 60
@ IN SOA huang.com dns.huang.com. (
2005102601 ; Serial
8 ; Refresh
4 ; Retry
720000 ; Expire
86400 ) ; minimum
@ IN NS dns.huang.com.
@ IN MX 10 dns.huang.com.
dns IN A 10.16.11.140
只增加主dns 本机地址为 10.16.11.140
修改/etc/hosts 将本机hostname 对应到上面配置文件的内容(本例为huang.com)
#########################BIND9 测试########################
修改 /etc/resolv.conf
增加 nameserver 127.0.0.1
启动DNS 服务 /usr/sbin/named -gc /var/named/etc/namedb/named.conf
测试:
> www.sohu.com
Server: 127.0.0.1
Address: 127.0.0.1#53
Non-authoritative answer:
www.sohu.com canonical name = d7.a.sohu.com.
d7.a.sohu.com canonical name = pagegrp7.a.sohu.com.
Name: pagegrp7.a.sohu.com
Address: 61.135.150.93
Name: pagegrp7.a.sohu.com
Address: 61.135.150.98
Name: pagegrp7.a.sohu.com
Address: 61.135.150.101
Name: pagegrp7.a.sohu.com
Address: 61.135.150.104
Name: pagegrp7.a.sohu.com
Address: 61.135.150.108
Name: pagegrp7.a.sohu.com
Address: 61.135.150.113
Name: pagegrp7.a.sohu.com
Address: 61.135.150.126
Name: pagegrp7.a.sohu.com
Address: 61.135.150.145
########################################################
测试成功后可以增加域名来提供对外服务
别忘记修改 /var/named/etc/namedb/named.conf 将 listen-on { 127.0.0.1; }; 中增加本机地址
在 /var/named/etc/namedb/master/huang.com 中增加新的记录就能够解析地址了
上面的例子中能够正确解析 dns.huang.com
没有评论:
发表评论