When using net:getaddrinfo/1 with a non existent host name (i.e. “some.fake.host”), on a node that is connected to a network that uses a WireGuard VPN for external connectivity (at the router, this node does not have a WireGuard interface of its own), instead of the expected error the external IP address of the VPN gateway is being returned. Using host or nslookup both return NXDOMAIN, so I am confused why/how my public facing IP address is being returned for the the non-existent domain.
Results are the same when testing on a node that does have its own WireGuard interface to the VPN gateway host.
Is this a bug or something I may have overlooked in the documentation? Any insights here would be greatly appreciated.
On an Unix-like system, net:getaddrinfo/1.2 simply calls the system’s getaddrinfo(3) in the resolver library with a NULL service name, so this should be an OS question.
The question is what the WireGuard VPN does to the system configuration, in particular name resolving. The host(1) and nslookup(1) programs both do direct DNS lookups so they bypass the resolver library.
Thank you so much for the explanation! This helped me get to the bottom of the problem. The commands you suggested showed that my domain was being appended to the query. Which resulted in the catch all for my domain to be returned which is the external ip that was being returned.
This is the only machine that I use NetworkManager, which was messing with my dns configuration. (It’s always DNS! )This is one of the reasons I avoid NetworkManager like the plague, but it was installed by default with my OS and on the laptop it seemed convenient.
Your explanation of how dns records are resolved, and the diagnostic output helped immensely in figuring out what the actual problem was.