配置DNS正向解析
[root@localhost ~]# yum install bind -y 下载软件包
[root@localhost ~]# vim /etc/named.conf
options {
listen-on port 53 { 192.168.1.250; };
directory "/var/named";
};
zone "baidu.com" IN {
type master;
file "named.baidu.com";
};
[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 192.168.1.250 mail IN A 172.24.8.128 www IN A 172.24.8.128 ftp IN CNAME www
[root@localhost ~]# systemctl disable firewalld --now
[root@localhost ~]# systemctl 0 关闭防火墙
测试
[root@localhost ~]# host www.baidu.com 192.168.1.250
配置DNS反向解析
[root@localhost ~]# vim /etc/named.conf options { listen-on port 53 { 192.168.1.250; }; directory "/var/named"; }; zone "baidu.com" IN { type master; file "named.baidu.com"; };
zone "1.168.192.in-addr.arpa" IN { type master; file "named.1.168.192";
};
[root@localhost ~]# vim /var/named/named.192.168.1 $TTL 1D @ IN SOA ns.baidu.com. admin.baidu.com. ( 0 1D 1H 1W 3H ) IN NS ns.baidu.com. 128 IN PTR ns.baidu.com. 128 IN PTR www.baidu.com. 128 IN PTR mail.baidu.com. 128 IN PTR ftp.baidu.com.
关闭防火墙
测试