Issue
I'm using macOS Ventura (13.0.1).
Using 4km3/dnsmasq to spin up a DNS server on my local machine. Using subnet 10.6.0.0/16
and assigned static IP 10.6.0.2
. I've added the DNS server IP address in my network settings.
Here's what happening
$ dig +short my.domain.test
10.6.0.6
$ host my.domain.test
my.domain.test has address 10.6.0.6
$ nslookup my.domain.test
Server: 10.6.0.2
Address: 10.6.0.2#53
Name: my.domain.test
Address: 10.6.0.6
$ curl -i -v -4 my.domain.test
* Could not resolve host: my.domain.test
* Closing connection 0
curl: (6) Could not resolve host: my.domain.test
When it doesn't work, the DNS server doesn't seem to be queried.
I've found many other post on the same problem but none of them seems to resolve my issue.
To get the API calls to work, I need this to work with curl
.
[It works on Chrome Browser, doesn't work on Safari]
Solution
As it turns out, curl doesn't care about local DNS. The domain name needs to exist ON THE INTERNET. curl looks for records in root servers. So, even if your DNS record resolves, you can't really access them in all the ways you want. Some will work, some won't.
One solution for this would be, register an actual domain name. Then point the domain name to your private IP addresses or whatever you want to point it to. You can have additional DNS server on your local machine.
Answered By - Rocky Answer Checked By - Katrina (WPSolving Volunteer)