1.安装bind软件包
yum install -y bind*
2.各配置文件路径索引
/etc/named.conf #主配置文件 /var/named/ #解析数据库文件目录 /etc/named.rfc1912.zones #默认的解析区域文件
3.主配置文件的修改
#以下修改只是我做改动的地方 vim /etc/named.conf options { #listen-on port 53 { 127.0.0.1; }; 注释掉该行表示在所有接口IP启用53端口的监听 #listen-on-v6 port 53 { ::1; }; 关闭IPv6的监听 directory "/var/named"; dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt"; memstatistics-file "/var/named/data/named_mem_stats.txt"; recursing-file "/var/named/data/named.recursing"; secroots-file "/var/named/data/named.secroots"; #allow-query { localhost; }; 允许所有主机进行DNS查询,默认只允许本地查询 zone "example.com" IN { type master; file "example.com.zone"; #如果不加绝对路径的话,默认会将配置文件认为是在/var/named目录内 }; #include "/etc/named.rfc1912.zones"; 注释掉该行 include "/etc/named.root.key";
4.创建数据库文件
cd /var/named/ cp named.localhost example.com.zone #通过默认的区域文件创建一个 vim example.com.zone $TTL 1D @IN SOAexample.com dns.example.com. ( 0; serial 1D; refresh 1H; retry 1W; expire 3H ); minimum @ INNSdns.example.com. dnsINA172.16.104.123 wwwINA172.16.104.123
5.重启测试
systemctl restart named [root@localhost named]# systemctl status named #查看一下状态 cat /etc/resolv.conf #确定DNS地址 # Generated by NetworkManager nameserver 172.16.104.123 [root@localhost ~]# nslookup www.example.com Server:172.16.104.123 Address:172.16.104.123#53 Name:www.example.com Address: 172.16.104.123
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。