0%

DNS Server 筆記

環境:Ubuntu 16.04 - DNS Server

安裝

hostname:顯示hostname
hostname -h:求救
hostname -b google:將hostname更改為google

apt install bind9:安裝DNS Server
apt install dnsutils:DNS測試工具(應包含在bind9了)

ufw status:查看ubuntu防火牆狀態

NameCheap設定

申請google.me網域
在側邊欄點DashBoard -> MANAGE
NAMESERVERS -> Custom DNS -> 輸入兩個DNS Server(ns1.google.me./ns2.google.me)
Advanced DNS -> PERSONAL DNS SERVER 綁定IP

設定檔

cd /etc/bind/:bind設定檔位置

vim /etc/bind/named.conf.local:加入domain zone

1
2
3
4
zone "google.me" {
type master;
file "/etc/bind/db.google.me";
};

cp db.local db.google.me
vim db.google.me:詳細設定

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$TTL 604800
@ IN SOA google.me. root.google.me. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
;
@ IN NS ns2.google.me.
ns2 IN A xxx.xxx.xxx.xxx
;
www IN A yyy.yyy.yyy.yyy
@ IN A yyy.yyy.yyy.yyy

google.me的NS是ns2.google.me
ns2.google.me指向的IP為自己
www.google.me=yyy.yyy.yyy.yyy
google.me=yyy.yyy.yyy.yyy

開啟

systemctl start bind9.service
systemctl restart bind9.service
systemctl status bind9.service