安装软件
yum -y install bind bind-utils
备份一下文件
cp /etc/named.conf /etc/named.conf-123
vi /etc/named.con
options {
directory "/var/named";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
#域名1
zone "jbjb.com" IN {
type master;
file "jbjb.com.zone";
};
#域名2
zone "bbcc.com" IN {
type master;
file "bbcc.com.zone";
};
语法检测
named-checkconf
添加bbcc.com.zone,jbjb.com.zone文件
切换到数据库
cd /var/named/
cat jbjb.com.zone
$TTL 7200
jbjb.com. IN SOA jbjb.com. 1234.qq.com (222 1H 15M 1W 1D)
jbjb.com. IN NS dns1.imooc.com.
dns1.jbjb.com. IN A 192.168.1.69
www.jbjb.com. IN A 192.168.1.66
cat bbcc.com.zone
$TTL 7200
bbcc.com. IN SOA bbcc.com. 1234.qq.com (222 1H 15M 1W 1D)
bbcc.com. IN NS dns1.bbcc.com.
dns1.bbcc.com. IN A 192.168.1.69
www.bbcc.com. IN A 192.168.1.71
注意:邮箱地址,@在DSN中是保留字符串,所以用.代替
改一下用户权限
chown root:named jbjb.com.zone bbcc.com.zone
再次语法检测
[root@test69 named]# named-checkzone jbjb.com jbjb.com.zone
zone jbjb.com/IN: loaded serial 222
OK
测试
客户端使用写上dns服务器的IP192.168.1.69
cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.1.69