温馨提示×

ubuntu如何配置域名服务器地址

小新
1358
2021-01-16 19:58:10
栏目: 云计算

ubuntu如何配置域名服务器地址

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使其生效即可。


0