Deian简单配置bind9

1、安装bind9、dnsutils

apt install -y dnsutils bind9

2、修改配置文件

修改静态IP

nano /etc/network/interfaces
auto ens33
allow-hotplug ens33
iface ens33 inet static
address 192.168.200.100/24
gateway 192.168.200.254 #网关地址

重启网卡systemctl restart networking.service

nano /etc/bind/named.conf.default-zones 添加:

zone "xs.com" {
type master;
file "/etc/bind/xs.zone";
};

zone "200.168.192.in-addr.arpa" { #此处要对应自己的ip
type master;
file "/etc/bind/com.zone";
};

复制正向配置文件、反向配置文件

cd /etc/bind
cp -a db.local xs.zone
cp -a db.127 com.zone

编辑xs.zone正向解析,注意所用域名后面都有“.”

;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     xs.com. admin.xs.com. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@ 	IN 	NS 	ns.xs.com.
@ 	IN 	A 	192.168.200.200
ns 	IN 	A	192.168.200.200
www	IN 	A	192.168.200.200

编辑com.zone反向解析

;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     xs.com. admin.xs.com. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@	IN		NS		ns.xs.com.
100	IN		PTR		www.xs.com.

修改nano /etc/resolv.conf :

nameserver 192.168.200.100
search xs.com

重启服务systemctl restart bind9
查询验证

nslookup xs.com
nslookup 192.168.200.100

若是配置根域服务器,在配置文件中添加

zone "." {
type master;
file "/etc/bind/db.root";
};

并复制正反向模板,并修改。

nano db.root
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA @ none. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS @
@ IN A 192.168.200.100
* IN A 192.168.200.100

重启服务,nslookup验证。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

我比他的还要新

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值