I am running a Ubuntu 22 container with --network host
with dnsmasq installed. Dig with explicit dns server and port works not without it. I have added "nameserver 127.0.0.1"
to resolv.conf and added 10-consul
entry in dnsmasq. Consul servers are not running on docker, they are running on other VMs.
dig @127.0.0.1 -p 8600 consul.service.consul
; <<>> DiG 9.18.1-1ubuntu1.3-Ubuntu <<>> @127.0.0.1 -p 8600 consul.service.consul
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64555
;; flags: qr aa rd; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;consul.service.consul. IN A
;; ANSWER SECTION:
consul.service.consul. 0 IN A Consul_Server1
consul.service.consul. 0 IN A Consul_Server2
consul.service.consul. 0 IN A Consul_Server3
;; Query time: 2 msec
;; SERVER: 127.0.0.1#8600(127.0.0.1) (UDP)
;; WHEN: Tue Mar 07 11:42:29 UTC 2023
;; MSG SIZE rcvd: 98
root@server:/home/postgres# dig consul.service.consul
; <<>> DiG 9.18.1-1ubuntu1.3-Ubuntu <<>> consul.service.consul
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 61564
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;consul.service.consul. IN A
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1) (UDP)
;; WHEN: Tue Mar 07 11:42:35 UTC 2023
;; MSG SIZE rcvd: 50
consul members
Node Address Status Type Build Protocol DC Partition Segment
server1 IP1:8301 alive server 1.15.0 2 dc1 default <all>
server2 IP2:8301 alive server 1.15.0 2 dc1 default <all>
server3 IP3:8301 alive server 1.15.0 2 dc1 default <all>
agent1 IP4:8301 alive client 1.15.0 2 dc1 default <default>
Edit: updating container/host details
Container Info:
Description: Ubuntu 22.04.2 LTS
Consul : Consul v1.15.0
Revision 53f65dc3
Build Date 2023-02-24T01:39:35Z
Dnsmasq installed:
server=/consul/127.0.0.1#8600
Host Info:
OS: Oracle Linux Server release 7.9
Dnsmasq installed:
server=/consul/127.0.0.1#8600