hashicorp / hashicorp/consul

nslookup and dig working for service.consul but ping and curl wont

Open
#7,587 1 comment 0 reactions 0 assignees View on GitHub
theme/dns
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
2d 6h
Merged PRs (30d)
43

Description

Hello Team,

I am using consul and dnsmasq in my corporate env.
NSLOOKUP and DIG is working fine for all the services I have created but I am unable to ping or use curl connecting to same service name. Its appending domain name from my search list in /etc/resolv.conf

host:~ # cat /etc/dnsmasq.conf
server=/consul/127.0.0.1#8600
host:~ #
--------------
host:~ # cat /etc/resolv.conf

domain xxx.yyy.zzz

search xxx.yyy.zzz aa.bbb

nameserver 127.0.0.1

nameserver xx.xxx.xx.xx
nameserver xx.xxx.xx.xx

options timeout:2
options rotate
host:~ #
--------------
host:~ # nslookup consul.service.consul
Server: 127.0.0.1
Address: 127.0.0.1#53

Name: consul.service.consul
Address: xx.xxx.xx.xx
Name: consul.service.consul
Address: xx.xxx.xx.xx
Name: consul.service.consul
Address: xx.xxx.xx.xx

host:~ #

--------------
host:~ # ping consul.service.consul
ping: unknown host consul.service.consul
host:~ #

entry from dnsmasq logs:
2020-04-03T06:52:15.363062+00:00 host dnsmasq[3500]: 125 127.0.0.1/40562 query[A] consul.service.consul.xxx.yyy.zzz from 127.0.0.1
2020-04-03T06:52:15.363414+00:00 host dnsmasq[3500]: 125 127.0.0.1/40562 forwarded consul.service.consul.xxx.yyy.zzz to 10.116.33.84
2020-04-03T06:52:15.363605+00:00 host dnsmasq[3500]: 125 127.0.0.1/40562 forwarded consul.service.consul.xxx.yyy.zzz to 10.116.33.90
2020-04-03T06:52:15.370112+00:00 host dnsmasq[3500]: 125 127.0.0.1/40562 reply consul.service.consul.xxx.yyy.zzz is NXDOMAIN

OR

2020-04-03T06:54:00.394582+00:00 host dnsmasq[3500]: 129 127.0.0.1/49513 query[A] consul.service.consul.aa.bbb from 127.0.0.1
2020-04-03T06:54:00.395218+00:00 host dnsmasq[3500]: 129 127.0.0.1/49513 forwarded consul.service.consul.aa.bbb to 10.116.33.84
2020-04-03T06:54:00.395425+00:00 host dnsmasq[3500]: 129 127.0.0.1/49513 forwarded consul.service.consul.aa.bbb to 10.116.33.90
2020-04-03T06:54:00.395616+00:00 host dnsmasq[3500]: 129 127.0.0.1/49513 reply consul.service.consul.aa.bbb is NXDOMAIN

same is happening if I do curl

mo-c7cb6b32a:~ # curl -vvv -x "" http://test_svc_51api.service.consul:8080/test/serverping/serverping.do
* Hostname was NOT found in DNS cache
* Could not resolve host: test_svc_51api.service.consul
* Closing connection 0
curl: (6) Could not resolve host: test_svc_51api.service.consul
mo-c7cb6b32a:~ #

LOGS:

2020-04-03T06:55:26.689100+00:00 host dnsmasq[3500]: 130 127.0.0.1/42316 query[A] test_svc_51api.service.consul.aa.bbb from 127.0.0.1
2020-04-03T06:55:26.689569+00:00 host dnsmasq[3500]: 130 127.0.0.1/42316 forwarded test_svc_51api.service.consul.aa.bbb to 10.116.33.84
2020-04-03T06:55:26.690209+00:00 host dnsmasq[3500]: 130 127.0.0.1/42316 forwarded test_svc_51api.service.consul.aa.bbb to 10.116.33.90
2020-04-03T06:55:26.690411+00:00 host dnsmasq[3500]: 131 127.0.0.1/42316 query[AAAA] test_svc_51api.service.consul.aa.bbb from 127.0.0.1
2020-04-03T06:55:26.690695+00:00 host dnsmasq[3500]: 131 127.0.0.1/42316 forwarded test_svc_51api.service.consul.aa.bbb to 10.116.33.84
2020-04-03T06:55:26.690911+00:00 host dnsmasq[3500]: 130 127.0.0.1/42316 reply test_svc_51api.service.consul.aa.bbb is NXDOMAIN
2020-04-03T06:55:26.691126+00:00 host dnsmasq[3500]: 131 127.0.0.1/42316 reply test_svc_51api.service.consul.aa.bbb is NXDOMAIN

host:~ # consul version
Consul v1.7.0
Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)
host:~ # dnsmasq -v
Dnsmasq version 2.78 Copyright (c) 2000-2017 Simon Kelley
Compile time options: IPv6 GNU-getopt no-DBus i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack ipset auth no-DNSSEC loop-detect inotify

This software comes with ABSOLUTELY NO WARRANTY.
Dnsmasq is free software, and you are welcome to redistribute it
under the terms of the GNU General Public License, version 2 or 3.
host:~ #

We dont want to remove search from /etc/resolv.conf as its been used on all corporate servers domain search. While performing ping or curl domain name is appended which is causing issue.

Can you please suggest what can we do for resolving it ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.