vim /etc/named.conf (编辑DNS配置文件,添加一个zone,如下)
zone "123.com" IN {
type master;
file "123.com.zone";
};
named-checkconf (查看配置文件是否正确)
vim /var/named/123.com.zone (编辑123.com的zone,具体格式如下)
$TTL 1D
@ IN SOA @ XXX.163.com. (
2015110801 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS ns.123.com.
IN MX 5 mail.123.com.
mail IN A 192.168.111.20
ns IN A 192.168.111.129
www IN A 11.11.11.11
bbs IN CNAME www
named-checkzone "123.com" /var/named/123.com.zone (检查123.com的zone配置文件是否正确)
/etc/init.d/named start (开启DNS服务)
yum install -y bind-utils (安装dig命令套件)
dig @192.168.111.129 www.123.com (测试DNS是否正常解析)
dig @192.168.111.129 bbs.123.com
配置DNS反向解析
vim /etc/named.conf (编辑配置文件,添加反向的zone)
zone "111.168.192.in-addr.arpa" IN {
type master;
file "111.168.192.zone";
};
named-checkconf (查看配置文件是否正确)
vim /var/named/111.168.192.zone (编辑111.168.192反向zone配置文件,如下)
$TTL 1D
@ IN SOA @ XXX.163.com. (
2015110801 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS ns.123.com.
129 IN PTR ns.123.com.
20 IN PTR mail.123.com.
named-checkzone "111.168.192" /var/named/111.168.192.zone (查看配置文件是否正确)
/etc/init.d/named restart (重启服务)
dig @192.168.111.129 -x 192.168.111.20 (查看反向解析是否正确)
dig @192.168.111.129 -x 192.168.111.129
DNS主从
主:
vim /etc/named.conf (编辑配置文件,添加如下红色内容)
zone "123.com" IN {
type master;
file "123.com.zone";
notify yes;
also-notify { 192.168.111.128; };
};
zone "111.168.192.in-addr.arpa" IN {
type master;
file "111.168.192.zone";
notify yes;
also-notify { 192.168.111.128; };
};
vim /var/named/123.com.zone (更改DNS域配置文件,修改红色内容,时间标记需要修改,只要比以前的大就可以)
2015110802 ; serial
longfei IN A 111.111.111.111
named-checkconf (查看配置文件是否正确)
dig @192.168.111.129 XXX.123.com (测试解析)
从:
yum install -y bind (安装DNS服务)
yum install -y bind-utils (安装dig命令)
vim /etc/named.conf (编辑配置文件,注释掉前两行,并添加下面的内容)
// listen-on port 53 { 127.0.0.1; };
// listen-on-v6 port 53 { ::1; };
zone "123.com" IN {
type slave;
file "slaves/123.com.zone";
masters { 192.168.111.129; };
};
zone "111.168.192.in-addr.arpa" IN {
type slave;
file "slaves/111.168.192.zone";
masters { 192.168.111.129; };
};
/etc/init.d/named start (启动DNS服务)
ls /var/named/slaves/ (查看是否生成配置文件)
原文地址:http://blog.51cto.com/culiangmianbao/2056510