ubuntu环境搭建DNS服务器

1 安装bind9

apt install bind9

2 修改 named.conf.local,添加要解析的域名及对应的域名配置文件

zone "test.cn"{
    type master;
file "db.test.cn";
};

3 添加域名配置W饭明

cp /etc/bind/db.local /var/cache/bind/db.test.cn

编辑这个文件,最后一行增加,对应域名的IP地址

@ IN A 192.168.1.200

4 配置/etc/bind/named.conf.options
在中间加入下面的代码,这样外网的域名也能解析了

forwarders {
    192.168.1.1;
};


5 重启DNS服务即可

systemctl restart bind9

6 测试

curl http://test.cn

猜你喜欢

转载自www.cnblogs.com/lasdaybg/p/9722554.html