内容简介:
- 新建一个named.conf,修改属组和属主。权限为640
- vim /etc/named.conf
- options {
- directory "/var/named";
- };
- zone "." IN {
- type hint;
- file "named.ca";
- };
- zone "localhost" IN {
- type master;
- file "named.localhost";
- };
- zone "0.0.127.in-addr.arpa" IN {
- type master;
- file "named.loopback":
- };
- chown root:named /etc/named.conf
- chmod 640 /etc/named.conf
- named-checkconf //检查主配置文件是否有语法错误
- named-checkzone "." /var/named/named.ca //检查区域文件是否有错误
- [root@localhost etc]# getenforce //查看SELinux状态
- Enforcing
- [root@localhost etc]# setenforce 0 //临时的关闭SELinux
- [root@localhost etc]# getenforce
- Permissive
- [root@localhost selinux]# vim /etc/selinux/config //配置文件,可以永久关闭。
- zone "chris.com" IN {
- type master;
- file "chris.com.zone"
- };
- zone "7.16.172.in-addr.arpa" IN {
- type master;
- file "172.16.6.zone";
- }
- 如图11所示
- 2、vim /var/named/chris.com.zone //配置chirs.com的正向数据
- $TTL 600
- chris.com. IN SOA ns1.chirs.com. admin.chris.com (
- 2013040401 //序列号
- 1H //刷新间隔
- 5M //重试间隔
- 2D //过期间隔
- 6H) //否定答案的缓存时长
- IN NS ns1.chris.com.
- IN 10 MX mail
- ns1 IN A 172.16.7.1
- www IN A 172.16.7.6
- ftp IN A 172.16.7.7
- mail IN A 172.16.7.8
- chris IN A 172.16.7.9
- chrislee IN CNAME chris
- [root@localhost named]# chown root:named chris.com.zone
- [root@localhost named]# chown root:named 172.16.7.zone
- [root@localhost named]# chmod 640 chris.com.zone
- [root@localhost named]# chmod 640 172.16.7.zone
- [root@localhost named]# named-checkconf
- [root@localhost named]# named-checkzone "chris.com" /var/named/chris.com.zone
- [root@localhost named]# named-checkzone "chris.com" /var/named/chris.com.zone
- zone chris.com/IN: loaded serial 2013040401
- OK //正常
- [root@localhost named]# named-checkzone "7.16.172.in-addr.arpa" /var/named/172.16.7.zone
- zone 7.16.172.in-addr.arpa/IN: loaded serial 2013040401
- OK //正常
- options {
- directory "/var/named";
- # recursion yes|no; //是否为客户端开启递归查询,默认是开启的
- allow-recursion {172.16.7.0/8; }; //开启递归查询,并规定客户端范围
- # allow-transfer {any;}; //全局定义,开启区域传输,并规定传输的客户端,默认是开启给所有主机传输
- };
- zone "." IN {
- type hint;
- file "named.ca";
- };
- zone "localhost" IN {
- type master;
- file "named.localhost";
- allow-transfer {none; }; //不给任何客户端传输其区域
- };
- zone "0.0.127.in-addr.arpa" IN {
- type master;
- file "named.loopback";
- allow-transfer {none; }; //不给任何客户端传输其区域
- };
- zone "chris.com" IN {
- type master;
- file "chris.com.zone";
- allow-transfer {172.16.7.2; }; //只给客户端172.16.7.2传输此区域
- };
- zone "7.16.172.in-addr.arpa" IN {
- type master;
- file "172.16.7.zone";
- allow-transfer {172.16.7.2; }; //只给客户端172.16.7.2传输此区域
- };
- $TTL 600
- chris.com. IN SOA ns1.chirs.com. admin.chris.com (
- 2013040403
- 1H
- 5M
- 2D
- 6H)
- IN NS ns1.chris.com.
- IN NS ns2.chris.com. //配置slave服务器的NS记录和相应的A记录,如果不配置将无法实现增量传输,就是数据号增加的时候客户端无法更新
- IN MX 10 mail
- IN A 172.16.7.2
- ns1 IN A 172.16.7.1
- ns2 IN A 172.16.7.2
- www IN A 172.16.7.6
- ftp IN A 172.16.7.7
- mail IN A 172.16.7.8
- chris IN A 172.16.7.9
- chrislee IN CNAME chris
- $TTL 600
- @ IN SOA ns1.chirs.com. admin.chris.com (
- 2013040401
- 1H
- 5M
- 2D
- 6H)
- IN NS ns1.chris.com.
- IN NS ns2.chris.com. ////配置slave服务器的NS记录和相应的PTR记录,如果不配置将无法实现增量传输,就是数据号增加的时候客户端无法更新
- 1 IN PTR ns1.chris.com.
- 2 IN PTR ns2.chris.com
- 6 IN PTR www.chris.com.
- 7 IN PTR ftp.chris.com.
- 8 IN PTR mail.chris.com.
- 9 IN PTR chris.chris.com.
- 9 IN PTR chirs.chris.com.
- options {
- directory "/var/named";
- };
- zone "." IN {
- type hint;
- file "named.ca";
- };
- zone "localhost" IN {
- type master;
- file "named.localhost";
- };
- zone "0.0.127.in-addr.arpa" IN {
- type master;
- file "named.loopback";
- };
- zone "chris.com" IN {
- type master;
- file "chris.com.zone";
- };
- zone "7.16.172.in-addr.arpa" IN {
- type master;
- file "172.16.7.zone";
- 【forward {only|first}
- forwards {172.16.100.1;}】:所有解析不出来的都转发给父域
- zone内设置只针对某个域的解析不�_来的转发格式:
- zone "ZONE_NAME"
- 【forward first;
- forwards {172.16.100.1;}】:
- 访问控制列表
- acl ACL_NAME {
- 172.16.0.0/16;
- 127.0.0,0/8
- }; //外面单独定义
- allow-query {ACL_NAME;}; //域内调用即可
- 系统内置的两个列表:
- none
- any
- cal a {
- 172.16.10.0/8;
- 127.0.0.1/8;
- };
- options{
- directory "/var/named"
- };
- view chris {
- match-clients {a; };
- zone "chris.com" IN {
- type master;
- file "chris.com.zone";
- };
- };
- view chrislee {
- match-client {any; };
- zone "chrislee.com" IN {
- type master;
- file "chrislee.com.zone";
- };
- };