提供DNS服务的软件叫bind,服务名是named。
[root@localhost ~]# yum install bind -y
[root@localhost ~]# rpm -ql bind
/etc/named.conf # bind主配置文件
/var/named/slaves # 从dns服务器文件夹
[root@localhost ~]# vim /etc/named.conf
options {
#定义监听端口,如果所有地址都监听,则只写端口
listen-on port 53 { 127.0.0.1; };
listen-on-v6 port 53 { ::1; };
#定义数据文件目录
directory "/var/named";
#只允许本地主机进行查询
allow-query { localhost; };
};
#定义区域
zone "." IN {
type hint;
file "named.ca";
};
[root@localhost ~]# vim /var/named/named.baidu.com
$TTL 1D
@ IN SOA @ admin.baidu.com. ( 0 1D 1H 1W 3H )
IN NS ns.baidu.com.
IN MX 10 mail.baidu.com.
ns IN A 172.24.8.128
mail IN A 172.24.8.128
www IN A 172.24.8.128
ftp IN CNAME www
[root@localhost ~]# systemctl restart named
[root@localhost ~]# systemctl disable firewalld --now
[root@webserver ~]# setenforce 0