加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

domain-name-system – 必须重新启动Bind9才能使DNS服务器在每次

发布时间:2020-12-14 23:32:10 所属栏目:资源 来源:网络整理
导读:我跟着 this very nice tutorial在Debian Jessie上创建了我的第一个DNS服务器(在我的Raspberry Pi上).它似乎运作良好.我可以ping: ping myhostname.mydomain 它工作正常.问题是每次我重启我的覆盆子Pi,我必须运行 sudo service bind9 restart 否则DNS服务器
我跟着 this very nice tutorial在Debian Jessie上创建了我的第一个DNS服务器(在我的Raspberry Pi上).它似乎运作良好.我可以ping:
ping myhostname.mydomain

它工作正常.问题是每次我重启我的覆盆子Pi,我必须运行

sudo service bind9 restart

否则DNS服务器将无法启动我的配置,我的DNS定义将无法正常工作.现在我必须说,如果我运行htop,我可以看到bind9在那里运行,但是,我做ping,我得到的主机名不存在.只有在我手动重启bind9后,DNS服务器才会再次运行.

我不得不说,虽然我一直试图解决这个问题,但是我让bind9运行through Chroot as explained in the Debian page,但这没有用.

我对此仍然很陌生,所以请询问您是否需要任何其他信息.我不知道从哪里开始寻找bind9的问题来解决这个问题.

注意:我是从全新安装开始的.

根据评论中的问题进行更新:

dig myhostname.mydomain

给出超时:

; <<>> DiG 9.9.5-9+deb8u3-Raspbian <<>> myhostname.mydomain
;; global options: +cmd
;; connection timed out; no servers could be reached

命令netstat -plnut返回

(Not all processes could be identified,non-owned process info
 will not be shown,you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN      -
tcp6       0      0 :::80                   :::*                    LISTEN      -
tcp6       0      0 :::53                   :::*                    LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -
tcp6       0      0 ::1:953                 :::*                    LISTEN      -
tcp6       0      0 ::1:6010                :::*                    LISTEN      -
udp        0      0 127.0.0.1:53            0.0.0.0:*                           -
udp        0      0 0.0.0.0:68              0.0.0.0:*                           -
udp        0      0 192.168.1.2:123         0.0.0.0:*                           -
udp        0      0 127.0.0.1:123           0.0.0.0:*                           -
udp        0      0 0.0.0.0:123             0.0.0.0:*                           -
udp        0      0 0.0.0.0:48851           0.0.0.0:*                           -
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           -
udp6       0      0 :::546                  :::*                                -
udp6       0      0 :::53                   :::*                                -
udp6       0      0 2003:75:e15:c201:52:123 :::*                                -
udp6       0      0 fe80::ba27:ebff:fe7:123 :::*                                -
udp6       0      0 ::1:123                 :::*                                -
udp6       0      0 :::123                  :::*                                -
udp6       0      0 :::53420                :::*                                -
udp6       0      0 :::5353                 :::*                                -

重新启动后,这两行将被添加,属于DNS服务器:

tcp        0      0 192.168.1.2:53          0.0.0.0:*               LISTEN      -
udp        0      0 192.168.1.2:53          0.0.0.0:*                           -

解决方法

1)处理DHCP延迟的自定义脚本.
(以root / sudo创建文件)

cat /usr/local / sbin / network-check

#!/bin/bash
while ! ifconfig | grep "192.168.1." > /dev/null; do
        #Network Down
        sleep 1
done
#Network up restart bind9
service bind9 restart

chmod a x /usr/local / sbin / network-check

在/etc/rc.local中的exit 0之前添加一行

network-check
exit 0

然后重启

2)设置静态,网络将以IP开始,然后bind9将启动(并使用该IP)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读