错误(网络不可达)解决

错误(网络不可达)解决

通过查看我的日志,我意识到我的服务器的某些部分可能已被破坏,虽然我不是 Bind 9 的专家,但我不确定该如何纠正才能防止这种情况发生:

Oct 24 14:16:50 ip151 named[54864]: error (network unreachable) resolving 'www.gamasutra.com/A/IN': 2001:4800:7814:0:5008:8553:ff04:b151#53
Oct 24 14:16:50 ip151 named[54864]: error (network unreachable) resolving 'www.kitchenworksinc.com/A/IN': 2607:f208:302::2d#53
Oct 24 14:16:50 ip151 named[54864]: error (network unreachable) resolving 'gyogynovenyek-gyogyteak.com/A/IN': 2607:f0d0:1101:16f::6#53
Oct 24 14:16:50 ip151 named[54864]: error (network unreachable) resolving 'www.kitchenworksinc.com/AAAA/IN': 2607:f208:302::2d#53
Oct 24 14:16:50 ip151 named[54864]: error (network unreachable) resolving 'www.kitchenworksinc.com/A/IN': 2607:f208:206::2d#53
Oct 24 14:16:50 ip151 named[54864]: error (network unreachable) resolving 'www.kitchenworksinc.com/AAAA/IN': 2607:f208:206::2d#53
Oct 24 14:16:50 ip151 named[54864]: error (network unreachable) resolving 'gyogynovenyek-gyogyteak.com/AAAA/IN': 2607:f0d0:1101:16f::6#53
Oct 24 14:16:51 ip151 named[54864]: validating @0x7f4e1405ce60: www.gamasutra.com A: no valid signature found
Oct 24 14:16:51 ip151 named[54864]:  validating @0x7f4e1c5befc0: gamasutra.com SOA: no valid signature found
Oct 24 14:16:51 ip151 named[54864]:  validating @0x7f4e2008e200: www.gamasutra.com NSEC: no valid signature found
Oct 24 14:16:54 ip151 named[54864]: error (network unreachable) resolving 'www.utrinski.mk/A/IN': 2001:678:1::2#53
Oct 24 14:16:54 ip151 named[54864]: error (network unreachable) resolving 'www.utrinski.mk/AAAA/IN': 2001:678:1::2#53
Oct 24 14:16:54 ip151 named[54864]: error (network unreachable) resolving 'www.utrinski.mk/A/IN': 2001:628:453:bb::4#53
Oct 24 14:16:54 ip151 named[54864]: error (network unreachable) resolving 'www.utrinski.mk/AAAA/IN': 2001:628:453:bb::4#53
Oct 24 14:16:54 ip151 named[54864]: error (connection refused) resolving 'www.utrinski.mk/A/IN': 194.149.137.168#53
Oct 24 14:16:54 ip151 named[54864]: error (connection refused) resolving 'www.utrinski.mk/AAAA/IN': 194.149.137.168#53
Oct 24 14:16:59 ip151 named[54864]: validating @0x7f4e241324c0: www.biblioteksforeningen.org AAAA: no valid signature found
Oct 24 14:16:59 ip151 named[54864]: validating @0x7f4e0ccf4060: www.biblioteksforeningen.org A: no valid signature found
Oct 24 14:16:59 ip151 named[54864]: validating @0x7f4e0ccf4060: biblioteksforeningen.org A: no valid signature found
Oct 24 14:17:04 ip151 named[54864]: error (network unreachable) resolving 'dsac.cn/DS/IN': 2001:dc7::1#53

似乎我的服务器充斥着来自陌生人的名称解析。如果我理解正确的话,我需要做的是将我的服务器设置为某种形式的私密服务器。

如果我没有使用正确的术语,我深感抱歉,我只是想在这个问题成为我托管的网站的真正问题之前尽快解决它。

谢谢

更新 1: -route § 的结果是:

Destination                    Next Hop                   Flag Met Ref Use If
[::]/96                        [::]                       !n   1024 0     0 lo
0.0.0.0/96                     [::]                       !n   1024 0     0 lo
2002:x00::/24                  [::]                       !n   1024 0     0 lo
2002:xf00::/24                 [::]                       !n   1024 0     0 lo
2002:x9fe::/32                 [::]                       !n   1024 0     0 lo
2002:xc10::/28                 [::]                       !n   1024 0     0 lo
2002:x0a8::/32                 [::]                       !n   1024 0     0 lo
2002:x000::/19                 [::]                       !n   1024 0     0 lo
3ffe:xfff::/32                 [::]                       !n   1024 0     0 lo
[::]/0                         [::]                       !n   -1  113233992 lo
localhost/128                  [::]                       Un   0   116069755 lo
ipxxx.ip-17x-3x-4x.eu/128      [::]                       Un   0   1 14444 lo
ff00::/8                       [::]                       U    256 0     0 ens18
[::]/0                         [::]                       !n   -1  113233992 lo

更新2

我只是修改了 named.conf 文件并做了以下更改(文件中清楚地解释了所有内容,我应该先查看那里)

options {
    listen-on port 53 {
        any;
        };
//  listen-on-v6 port 53 {
//      any;
//      }; 

我注释了最后三行,因为我的网站上没有处理任何 IP V6。

还将该行从是修改为否:

`/* 
 - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
 - If you are building a RECURSIVE (caching) DNS server, you need to enable 
   recursion. 
 - If your recursive DNS server has a public IP address, you MUST enable access 
   control to limit queries to your legitimate users. Failing to do so will
   cause your server to become part of large scale DNS amplification 
   attacks. Implementing BCP38 within your network would greatly
   reduce such attack surface 
*/`
    recursion no;

它似乎不会影响我的任何网站。因此,我的日志现在如下所示:

Oct 24 15:10:57 ip151 named[40819]: client 127.0.0.1#58400 (www.dunyadinleri.com): query (cache) 'www.dunyadinleri.com/AAAA/IN' denied
Oct 24 15:10:57 ip151 named[40819]: client 127.0.0.1#58400 (www.dunyadinleri.com): query (cache) 'www.dunyadinleri.com/A/IN' denied
Oct 24 15:10:57 ip151 named[40819]: client 127.0.0.1#17750 (ujquery.org): query (cache) 'ujquery.org/A/IN' denied
Oct 24 15:10:57 ip151 named[40819]: client 127.0.0.1#17750 (ujquery.org): query (cache) 'ujquery.org/AAAA/IN' denied
Oct 24 15:10:57 ip151 named[40819]: client 127.0.0.1#58400 (adsl.aruba.it): query (cache) 'adsl.aruba.it/A/IN' denied
Oct 24 15:10:57 ip151 named[40819]: client 127.0.0.1#58400 (adsl.aruba.it): query (cache) 'adsl.aruba.it/AAAA/IN' denied
Oct 24 15:10:57 ip151 named[40819]: client 127.0.0.1#58400 (www.microscopy-uk.org.uk): query (cache) 'www.microscopy-uk.org.uk/A/IN' denied

答案1

10月24日 14:16:50 ip151 命名[54864]: 错误 (网络不可达) 解析‘www.gamasutra.com/A/IN’: 2001:4800:7814:0:5008:8553:ff04:b151#53

10月24日 14:16:50 ip151 命名[54864]: 错误 (网络不可达) 解析‘www.kitchenworksinc.com/A/IN’: 2607:f208:302::2d#53

嗯,我发现这种情况只发生在来自 IPv6 源地址的请求上。所以我认为您的服务器正在监听 IPv6 地址上的请求,但无法到达或发送回复(网络不可达)。我很确定这可能是由于缺少默认网关或默认路由而发生的。

因此请检查以下内容,运行:

route -6

你应该看到类似

::/0                           2001:xxxx:xxxx:196::1      UG   1024 8   874 eth0

如果没有 ::/0 路由,那么这就是问题所在(没有默认路由),因此无法向 IPv6 查询发送回复。

更新:

Destination                    Next Hop                   Flag Met Ref Use If
[::]/96                        [::]                       !n   1024 0     0 lo
0.0.0.0/96                     [::]                       !n   1024 0     0 lo
2002:x00::/24                  [::]                       !n   1024 0     0 lo
2002:xf00::/24                 [::]                       !n   1024 0     0 lo
2002:x9fe::/32                 [::]                       !n   1024 0     0 lo
2002:xc10::/28                 [::]                       !n   1024 0     0 lo
2002:x0a8::/32                 [::]                       !n   1024 0     0 lo
2002:x000::/19                 [::]                       !n   1024 0     0 lo
3ffe:xfff::/32                 [::]                       !n   1024 0     0 lo
[::]/0                         [::]                       !n   -1  113233992 lo
localhost/128                  [::]                       Un   0   116069755 lo
ipxxx.ip-17x-3x-4x.eu/128      [::]                       Un   0   1 14444 lo
ff00::/8                       [::]                       U    256 0     0 ens18
[::]/0                         [::]                       !n   -1  113233992 lo

正如我所说,没有默认路由,因此他们可以联系到你,但你却联系不上。同样,如果你不想收到这些查询,你有三个选择

  • 在 ip6tables 中阻止 53 端口
  • 禁用接口上的 ipv6 地址
  • 从接口中删除 ipv6 地址

选择任何选项套件(正如你所说,你正在运行一个网络服务器而不是 DNS),否则你将离开你的系统非常脆弱

答案2

阻止端口 53 (DNS) 上的传入 UDP 流量应该可以解决问题。
为了不重复已经说过的内容,请查看为什么大学要阻止目标端口为 53 的传入 UDP 流量?

答案3

从您的日志中我看不到那么多流量。无论如何,如果您只想向某些客户提供 DNS 服务,请使用命名 ACL。

有关如何执行此操作的更多信息,请查看以下答案:

除非允许查询为“任何”,否则绑定将不起作用

相关内容