[Linux]DNS服务器的安装与配置
DNS服务器的安装与配置
1.DNS服务器的安装
#yum install bind
2.DNS服务器的配置
#vim /etc/named.conf
options {
listen-on port 53 { 192.168.9.128; }; #监听服务器IP
listen-on-v6 port 53 { ::1; };
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";
allow-query { any; }; #允许所有主机查询
3.DNS区域文件的配置
#vim /etc/named.rfc1912.zones
zone "9-Sky.cn" IN {
type master;
file "9-sky.cn.zone";
allow-update { none; };
};
# cd /var/named
# cp -p named.empty 9-sky.cn.zone
# vim 9-sky.cn.zone
$TTL 3H
@ IN SOA @ root.9-sky.cn. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @
A 192.168.9.128
www IN A 192.168.9.128
4.启动DNS服务器
#systemctl start named.service
#system enable named.service #设置DNS服务器开机自动启动
5.客户端测试
- 设置客户端指向
#systemctl stop firewalld.service #暂停防火墙
#ping www.9-sky.cn