安装bind9
apt install bind9
配置DNS
cd /etc/bind/
备份配置
cp name.conf.local name.conf.local.bak
编辑本地配置,增加正向与反向解析(ubuntu.cn)
//
// Do any local configuration here
//
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
// 正向解析 ubuntu.cn
zone "ubuntu.cn" {
type master;
file "/etc/bind/db.ubuntu.cn";
};
// 反向解析 172.24.
zone "24.172.in-addr.arpa" {
type master;
file "/etc/bind/db.172.24";
};
正向解析配置
- SOA: 起始授权机构记录, 被标记成在众多NS记录中哪一台是主服务器
- NS: 域名服务器
- @代表ubuntu.cn
- *开头是泛域名匹配
- 增加A记录,记录名为ns,指向当前服务器接口IP
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA u