1.安装DNS软件包bind
[root@localhost ~]# yum -y install bind
2.配置
step1.修改主配置文件/etc/named.conf
[root@localhost ~]# vim /etc/named.conf
step2.在自定义配置文件 /etc/named.rfc1912.zones
里面添加域
[root@localhost ~]# vim /etc/named.rfc1912.zones
step3. 进入/var/named
创建域配置文件,配置域名解析
[root@localhost etc]# cd /var/named/
[root@localhost named]# ls
data dynamic named.ca named.empty named.localhost named.loopback slaves
[root@localhost named]# cp named.localhost sec.com
[root@localhost named]# vim sec.com
- 增加权限,并重启服务
[root@localhost named]# chmod 644 sec.com
[root@localhost ~]# service named restart
停止 named:. [确定]
启动 named: [确定]
[root@localhost ~]#
3.测试:
- nslookup测试
C:\Users\22303>nslookup
默认服务器: public1.114dns.com
Address: 114.114.114.114
> server 192.168.3.111
默认服务器: [192.168.3.111]
Address: 192.168.3.111
> www.sec.com
服务器: [192.168.3.111]
Address: 192.168.3.111
名称: www.sec.com
Address: 192.168.3.231
> game.sec.com
服务器: [192.168.3.111]
Address: 192.168.3.111
名称: game.sec.com
Address: 10.1.1.1
> sec.com
服务器: [192.168.3.111]
Address: 192.168.3.111
名称: sec.com
Address: 192.168.3.111
>
- dig测试
以上配置测试是没有问题的,修改完配置请记得重启服务,如果测试不成功,请检查防火墙,或者直接关闭防火墙,再进行测试