ubuntu配置域名服務器地址的方法:
1.打開終端輸入以下命令進行安裝配置DNS。
sudo apt install bind9
2.修改配置文件“/etc/bind/named.conf.local”,添加正逆解析文件的配置,修改后如下:
//// Do any local configuration here
//
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
//domain->ip
zone "flovem.home" in {
type master;
file "/var/cache/bind/db.flovem.home";
};
//ip->domain
zone "0.168.192.in-addr.arpa" in {
type master;
file "/var/cache/bind/reverse/db.0.168.192";
};
3.根據第2步中的配置,添加相應的正逆向解析文件,例如:
在/var/cache/bind/目錄下添加文件db.flovem.home:
//正向解析
$TTL 604800
@ IN SOA flovem.home. root.flovem.home. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604000) ; Negative Cache TTL
;
; name servers
@ IN NS ns.flovem.home.
@ IN A 192.168.0.102
;ns records
ns IN A 192.168.0.102
;host records
hangzhou IN A 192.168.0.102
在/var/cache/bind/reverse/目錄中添加文件db.0.168.192
//逆向解析
$TTL 604800
@ IN SOA flovem.home. root.flovem.home. (
2 ; Serial Number
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
86400 ); ; Minimum
@ IN NS flovem.home.
66 IN PTR hangzhou.flovem.home.
4.重啟ubuntu使其生效即可。