Ubuntu DNS安装及配置
发布网友
发布时间:2022-04-23 03:12
我来回答
共1个回答
热心网友
时间:2023-10-12 23:23
Ubuntu
DNS安装及配置安装sudo
apt-get
install
bind9修改/etc/bind/named.conf.localsudo
vi
/etc/bind/named.conf.local在里面加入如下内容(注意把domainname替换面你想要的),zone
domainname.com
{
type
master;
file
/etc/bind/zones/domainname.com.db;
};zone
0.168.192.in-addr.arpa
{
type
master;
file
/etc/bind/zones/rev.0.168.192.in-addr.arpa;};接下来编辑文件/etc/bind/named.conf.options,sudo
vi
/etc/bind/named.conf.options在里面加入以下内容,forwarders
{#
Replace
the
address
below
with
the
address
of
your
provider's
DNS
server180.168.255.118;};现在我们来创建zone的定义文件sudo
mkdir
/etc/bind/zonessudo
vi
/etc/bind/zones/domainname.com.dbdomainname.com.
IN
SOA
dns.domainname.com.
admin.domainname.com.
(
200608140128800360060480038400
)domainname.com.
IN
NS
dns.domainname.com.domainname.com.
IN
MX
10
mta.domainname.com.dns
IN
A
192.168.0.104mta
IN
A
192.168.0.104nfs
IN
A
192.168.0.105master
IN
A
192.168.0.102接下来创建反向解析文件(从IP解析出域名)sudo
vi
/etc/bind/zones/rev.0.168.192.in-addr.arpa在里面输入以下内容$TTL
86400@
IN
SOA
dns.domainname.com.
admin.domainname.com.
(1997022700
;
Serial28800
;
Refresh14400
;
Retry3600000
;
Expire86400
)
;
MinimumIN
NS
dns.domainname.com.104
IN
PTR
dns.domainname.com.105
IN
PTR
nfs.domainname.com.102
IN
PTR
master.domainname.com.修改/etc/resolv.confsudo
vi
/etc/resolv.conf在里面输入,search
domainname.comnameserver
192.168.0.104注:以上修改会在机器重启后被覆盖,
如果重启机器后此次修改继续生效的话,需要在文件
/etc/resolvconf/resolv.conf.d/base里输入以上内容现在可以测试你的配置啦,dig
example.comhost
dnshost
192.168.0.102