Dnsmasq doesn't register consul agent service dns on local node running the db service

I am setting up consul on-premise server setup I have while I am learning consul.
After giving up months back today I am trying again. This is critical to my server setup.

I have 2 consul server setup and 1 agent named rockpi on which db service is running:


then I have service also registered:
consul_services_registered

then I updated the /etc/dnsmasq.d/10-consul that contains:

# Enable forward lookup of the 'consul' domain:
server=/consul/127.0.0.1#8600

and /etc/dnsmasq.conf contains:

conf-dir=/etc/dnsmasq.d
port=53

then I checked /etc/resolv.conf

nameserver 127.0.0.53

and then if I do dig db.service.consul I get Answer Section empty:


# dig  db.service.consul

; <<>> DiG 9.11.3-1ubuntu1.16-Ubuntu <<>> db.service.consul
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 6735
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

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

;; Query time: 10 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Thu Nov 04 21:49:22 GMT 2021
;; MSG SIZE  rcvd: 46

what am I missing and what am I doing wrong ?

So I got this to work

I realized I had a dnsmasq configuration but dnsmasq was not really installed, so I installed dnsmasq then set DNSStubListener=no in /etc/systemd/resolved.conf then in /etc/dhcpcd.conf I set domain_name_servers=127.0.0.531.1.1.1 in the eth0 interface.

then restarted dhcpcd service, restarted dnsmasq and I got it to work.

to make internet work alongside I had to add 1.1.1.1 dns server ip in dhcpcd config of eth0 interface