lasdaybg

1 安装bind9

apt install bind9

 如果提示找不到安装包,则需要更新apt update更新安装包列表

 

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

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

 

3 添加域名配置

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

 

编辑这个文件,将localhost替换成test.cn,并在最后一行增加对应域名的IP地址

@ IN A 192.168.1.200

 

4 配置/etc/bind/named.conf.options
在中间加入下面的代码,这样外网的域名也能解析了,其中,192.168.1.1是访问外网域名用到的域名解析服务器

forwarders {
    192.168.1.1;
};


5 重启DNS服务即可

systemctl restart bind9

 

6 测试

dig test.cn

 如果返回的ANSWER数量大于0,则表示解析成功

 

分类:

技术点:

相关文章:

  • 2021-08-06
  • 2021-04-24
  • 2021-12-29
  • 2019-01-16
  • 2021-09-17
  • 2022-12-23
  • 2021-10-03
猜你喜欢
  • 2021-07-28
  • 2021-11-05
  • 2021-12-12
  • 2021-11-12
  • 2021-10-31
  • 2021-07-31
相关资源
相似解决方案