Linux中DNS设置中要注意的几点
一,bind的安装
二,检查bind-chroot的状态,如果启用,则使用命令“bind-chroot-admin -d” 关闭
三,主配置文件named.conf是需要手动创建的,可以复制生成
#cp /usr/share/doc/bind-9.3.3/sample/etc/named.conf /etc/named.conf拷贝范例生成主配置文件,编制主配置文件named.conf(每个段落之后都要用“;”结尾,“//”是注释内容)
// Red Hat BIND Configuration Tool
//
// Default initial "Caching Only" name server configuration
//
options {
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
/*
* 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.
*/
//可以在这添加forwarders的内容
Forwards{219.146.0.130;219.150.32.132;};
allow-query{any;}; //是否允许被查询,允许
allow-transfer{none;}; //是否允许传送zone,默认不允许
// query-source address * port 53;
};
//关于root(.)的设置
zone "." IN {
type hint;
file "named.root";
};
zone "localdomain." IN {
type master;
file "localdomain.zone";
allow-update { none; };
};
//关于本机localhost的正反解
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; };
};
//IPV6的解析文件
zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa." IN {
type master;
file "named.ip6.local";
allow-update { none; };
};
//广播文件
zone "255.in-addr.arpa." IN {
type master;
file "named.broadcast";
allow-update { none; };
};
zone "0.in-addr.arpa." IN {
type master;
file "named.zero";
allow-update { none; };
};
//DNS的一些加密数据
include "/etc/rndc.key";
zone "cvc.com" IN {
type master;
file "named.cvc.com";
allow-update { none; };
};
zone "0.0.10.in-addr.arpa" IN {
type master;
file "named.cvc.com.rev";
allow-update { none; };
};
//这一部分是手工添加的。定义了“cvc.com”这个域和对应的反向查询域。“type master”说明本机是“zrs.com”和“0.0.10.in-addr.arpa”这两个域的主dns服务器(primary name server)。“named.cvc.com”和“named.cvc.com.rev”是域的记录文件。这两个文件也是自己创建的。所有自己创建解析文件默认都放在/var/named文件夹下边。
四、创建named.cvc.com跟named.cvc.com.rev文件
named.cvc.com
$TTL 86400
@ IN SOA cvc.com. root.cvc.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS cvc.com.
IN NS 192.168.1.1
www IN A 192.168.1.1
named.cvc.com.rev
$TTL 86400
@ IN SOA cvc.com. root.cvc.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
@ IN NS cvc.com.
6 IN PTR cvc.com.
五、修改本地DNS信息
vi /etc/resolv.com
nameserver 192.168.1.1