I have a Seafile server running on a local network, and exposed to the internet (via port forwarding).
When I am outside of home, I can access the server just fine through the public hostname and port of my internet provider (eg. 123.myprovider.com:<my-port>
), that forwards to my router (and that then forwards the specific port to a Seafile server), but I thought that when I am at home, the clients should know that the server can be reached at a local IP address (eg. 192.168.1.3) instead, so that they connect directly through LAN.
On my local DNS server (pihole) I have set up a static DNS record saying that 123.myprovider.com should resolve to 192.168.1.3.
And now the problem:
nslookup
looks up the correct IP address all right:
> nslookup 123.myprovider.com
Server: 192.168.1.17 # this is my local DNS server - a pihole instance
Address: 192.168.1.17#53
Name: 123.myprovider.com
Address: 192.168.1.3 # this is exactly what should happen
- However,
curl
(and all the other HTTP based tools, like browser) still report the public IP instead:
> curl https://123.myprovider.com:<my-port> -vvvv
* Trying <my public IP address>:18275 ...
… and this fails.
I have flushed the DNS cache with sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
, but this doesn’t change anything.
Why does MacOS ignores the static DNS record from a local pihole, when nslookup uses it? How can I make it respect the local record?
Thanks for ideas!