天天看點

搭建域名伺服器搭建域名伺服器

搭建域名伺服器

keywords: 自建dns伺服器

伺服器版本ubuntu22,使用軟體bind9

安裝

sudo apt install bind9 bind9utils bind9-doc
           

配置

/etc/bind/named.conf.local 添加如下内容:

sudo cp /etc/bind/db.local /etc/bind/db.example.com

修改 /etc/bind/db.example.com 内容如下:

;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     ns.example.com. root.ns.example.com. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@               IN      NS      ns.example.com.
example.com.    IN      A       192.168.1.1
ns              IN      A       192.168.1.10

;also list other computers
box             IN      A       192.168.1.21
           

表示:

example.com -> 192.168.1.1
ns.example.com -> 192.168.1.10
box.example.com -> 192.168.1.21
           

生效

重新開機服務生效:

sudo systemctl restart bind9
           

參考連結

  1. https://help.ubuntu.com/community/BIND9ServerHowto
  2. https://www.cnblogs.com/doherasyang/p/14464999.html
  3. https://www.isc.org/bind/
  4. https://blog.csdn.net/qq_19655405/article/details/117125744

2022/7/20