Consul: DNS problem, nslookup works, ping/curl doesn't

Created on 9 Jan 2019  Â·  3Comments  Â·  Source: hashicorp/consul

nslookup works

`[root@test001 ~]# nslookup vault.service.consul
Server: 127.0.0.1
Address: 127.0.0.1#53

Name: vault.service.consul
Address: 192.168.3.1

[root@test001 ~]# curl -I http://192.168.3.1:8200
HTTP/1.1 307 Temporary Redirect
Cache-Control: no-store
Content-Type: text/html; charset=utf-8
Location: /ui/
Date: Wed, 09 Jan 2019 02:57:26 GMT
`

but ping/curl doesn't

`
[root@test001 ~]# ping vault.service.consul
ping: vault.service.consul: Name or service not known

[root@test001 ~]# curl -I http://vault.service.consul:8200
curl: (6) Could not resolve host: vault.service.consul; Name or service not known
`

os

[root@test-001 ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.4.1708 (Core)
Release: 7.4.1708
Codename: Core

consul

[root@test001 ~]# consul version
Consul v1.4.0
Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)

"ports" : {
"dns" : 53
},
"dns_config" : {
"node_ttl" : "10s",
"service_ttl": {
"": "5s",
"vault
": "10s"
},
"soa": {
"min_ttl" : 1
}
},

cat /etc/resolv.conf

[root@test001 ~]# cat /etc/resolv.conf
options timeout:2 attempts:3 rotate single-request-reopen
; generated by /usr/sbin/dhclient-script
search node.consul. service.consul.
nameserver 127.0.0.1
nameserver 100.100.2.138
nameserver 100.100.2.136

/etc/nsswitch.conf

[root@test001 ~]# grep '^hosts' /etc/nsswitch.conf
hosts: files dns myhostname

Most helpful comment

@limingyao remove single-request-reopen option from /etc/resolv.conf

All 3 comments

So,how to fix this?

how to fix ?

@limingyao remove single-request-reopen option from /etc/resolv.conf

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matteoturra picture matteoturra  Â·  4Comments

eshujiushiwo picture eshujiushiwo  Â·  3Comments

powerman picture powerman  Â·  3Comments

pritam97 picture pritam97  Â·  3Comments

sandstrom picture sandstrom  Â·  3Comments