Version
Current Version: 24.14.0, Same Issue on Every version of nodejs
Platform
Subsystem
No response
What steps will reproduce the bug?
- Set system DNS to a public resolver (e.g., 8.8.8.8) on Windows.
- Verify 'ipconfig /all' shows 8.8.8.8 as the only DNS server.
- Run the following command in a clean terminal:
node -e "console.log(require('node:dns').getServers())"
- Observe that it returns ['127.0.0.1'] despite system settings.
How often does it reproduce? Is there a required condition?
Always (100% of the time) on this specific machine after a PC reset, even after clearing virtual network adapters and setting the Interface Metric for Wi-Fi/Ethernet to 1.
What is the expected behavior? Why is that the expected behavior?
The 'dns.getServers()' method should return the DNS servers configured in the OS network stack (8.8.8.8). It should not default to the loopback address (127.0.0.1) when a valid external DNS is active and prioritized.
What do you see instead?
The output of node -e "console.log(require('node:dns').getServers())" is ['127.0.0.1'].
This occurs even though ipconfig /all confirms the system is using 8.8.8.8 and no local DNS proxy (like Acrylic or Acrylic DNS) is running on port 53.
Additional information
- I have already tried
netsh winsock reset, ipconfig /flushdns, and netsh int ip reset.
- I manually set the Interface Metric for the active Wi-Fi adapter to 1 to ensure priority.
- I uninstalled all virtual network adapters (WSL2/Docker/VPN bridges).
nslookup google.com correctly identifies the server as 8.8.8.8, but Node.js remains stuck on the loopback address.
- This behavior started immediately after a Windows PC reset.