本文介绍了为什么服务器找不到pihole.service.consul:NXDOMAIN,我该如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对领事有以下配置。

{
  "service": {
    "name": "pihole",
    "Address": "192.168.0.15",
    "tags": [
      "pi"
    ],
    "port": 8165,
    "check": {
      "args": [
        "curl",
        "192.168.0.15"
      ],
      "interval": "10s"
    }
  }
}

使用dig我现在没有错误,

using dig i get no error now,

$ dig @127.0.0.1 -p 8600 pihole.service.consul

; <<>> DiG 9.9.7-P3 <<>> @127.0.0.1 -p 8600 pihole.service.consul
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63573
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;pihole.service.consul.     IN  A

;; ANSWER SECTION:
pihole.service.consul.  0   IN  A   192.168.0.15

;; Query time: 0 msec
;; SERVER: 127.0.0.1#8600(127.0.0.1)
;; WHEN: Sun Aug 30 23:02:34 BST 2020
;; MSG SIZE  rcvd: 66

但是当我执行nslookup时,出现错误 server cant not查找pihole.service.consul:NXDOMAIN

but when I do nslookup, i get the error server can't find pihole.service.consul: NXDOMAIN

$ nslookup pihole.service.consul
Server:     192.168.0.15
Address:    192.168.0.15#53

** server can't find pihole.service.consul: NXDOMAIN

我实际上在领事健康检查通过的这个IP地址192.168.0.15
上有一个漏洞。

I actually have a pihole running at this ip address 192.168.0.15on the consul health check is passing.

2020-08-30T23:10:58.707+0100 [DEBUG] agent: Check status updated: check=service:pihole status=passing


推荐答案

在命令 dig @ 127.0.0.1 -p 8600 pihole.service.consul 您明确指示主机使用服务器 127.0.0.1 和端口 8600

In the command dig @127.0.0.1 -p 8600 pihole.service.consul you explicitly instructed host to use server 127.0.0.1 and port 8600.

Nslookup默认使用/etc/resolv.conf文件中的名称服务器和端口53。

Nslookup uses nameserver from your /etc/resolv.conf file and port 53 by default.

您可以尝试

nslookup pihole.service.consul 127.0.0.1 -port=8600

这篇关于为什么服务器找不到pihole.service.consul:NXDOMAIN,我该如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 04:58