To understand it, please read the article Understanding DNS behavior with Bind9 and dnsmasq.
Run the following command to start servers A and B:
docker compose up -d dns-a dns-bRun the server:
docker compose up dns-initialIn another terminal, you can query the dns-initial with the following commands:
dig -t A @127.0.0.1 -p 30010 willianantunes.com
dig -t A @127.0.0.1 -p 30010 db-a.privatelink.database.windows.net
dig -t A @127.0.0.1 -p 30010 db-b.privatelink.database.windows.netRun the server:
docker compose up dns-initial-dnsmasqIn another terminal, you can query the dns-initial-dnsmasq with the following commands:
dig -t A @127.0.0.1 -p 30005 willianantunes.com
dig -t A @127.0.0.1 -p 30005 db-a.privatelink.database.windows.net
dig -t A @127.0.0.1 -p 30005 db-b.privatelink.database.windows.netSometimes the query will return NXDOMAIN either for db-a or db-b. This happens because the DNS Proxy returns the first answer it receives. Learned it from a reddit post.