1、yum install -y bind
2、vi /etc/named.conf
修改文件如下:
options {
directory "/var/named"; //存放zone文件的路径——/var/named/chroot/var/named
};
zone "test.com" {
type master;
file "test.com.zone"; //区配置文件名
};
3、cd /var/named
vi test.com.zone
编辑文件如下:
$TTL 1D
@ IN SOA root.test.com. root. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.test.com.
dns A 10.0.0.4
noderedis A 10.0.0.7
pg1 A 10.0.0.5
redis1 A 10.0.0.5
...
4、service named start 启动dns服务
nameserver 10.0.0.4
5、vi /etc/resolv.conf
添加一个nameserver地址为 dns服务器地址
6、测试ping pg1.test.com
named-checkconf 检查域名配置文件是否正确
named-checkzone test.com /etc/bind/zones/test.com 检查配置的域名是否正确