使用bind9设置DNS服务器问题:创建TCP套接字:地址不可用

使用bind9设置DNS服务器问题:创建TCP套接字:地址不可用

我正在尝试在 ubuntu 上设置 dns 服务器。和

sudo systemctl 状态bind9

我明白了

Apr 17 10:14:21 dns named[1002]: no longer listening on fe80::9903:2b67:b230:aaaa%3#53
Apr 17 10:14:21 dns named[1002]: listening on IPv6 interface eno2, fe80::9903:2b67:b230:aaaa%3#53
Apr 17 10:14:21 dns named[1002]: creating TCP socket: address not available
Apr 17 10:15:06 dns named[1002]: no longer listening on fe80::9903:2b67:b230:aaaa%3#53
Apr 17 10:15:06 dns named[1002]: listening on IPv6 interface eno2, fe80::9903:2b67:b230:aaaa%3#53
Apr 17 10:15:06 dns named[1002]: creating TCP socket: address not available
Apr 17 10:15:51 dns named[1002]: no longer listening on fe80::9903:2b67:b230:aaaa%3#53
Apr 17 10:15:51 dns named[1002]: listening on IPv6 interface eno2, fe80::9903:2b67:b230:aaaa%3#53
Apr 17 10:15:51 dns named[1002]: creating TCP socket: address not available
Apr 17 10:16:36 dns named[1002]: no longer listening on fe80::9903:2b67:b230:aaaa%3#53

我不明白从哪里来

fe80::9903:2b67:b230:aaaa%3#53

来自,它不在我的配置或 ansible 剧本中。

dig 和 nslookup 可以工作,但不能 ping:

$ 挖掘 gitlab.bobby

挖 gitlab.bobby

; <<>> DiG 9.16.1-Ubuntu <<>> gitlab.bobby
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 151
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;gitlab.bobby.      IN  A

;; Query time: 439 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Du apr 17 13:43:40 EEST 2022
;; MSG SIZE  rcvd: 44




ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: wlp0s20f3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether dc:41:a9:a0:e4:43 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.138/24 brd 192.168.1.255 scope global dynamic noprefixroute wlp0s20f3
       valid_lft 71048sec preferred_lft 71048sec
    inet6 fe80::a7fb:95aa:eceb:644e/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 100
    link/none 
    inet 10.9.100.6/16 brd 10.9.255.255 scope global tun0
       valid_lft forever preferred_lft forever
    inet6 fe80::801:28e7:2f5b:5191/64 scope link stable-privacy 
       valid_lft forever preferred_lft forever

该设置是使用 ansible playbook 运行的,我在测试服务器中对其进行了测试并且它有效。 systemd-resolved 也使用套接字 53,杀死、重新启动等没有变化。

有什么我可以尝试的吗?

答案1

问题不是端口被阻止,而是系统解决了。

我解决了这里描述的问题:

https://kifarunix.com/configure-openvpn-clients-to-use-specific-dns-server/

apt install openresolv

将其添加到您的客户端 ovpn 文件中:

script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf

在客户端启动 openvpn:

openvpn client-1.ovpn

检查它是否有效 cat /etc/resolv.conf

相关内容