4 ms·
It's worth noting that dig (and host) bypass the normal DNS resolution mechanism used by most programs on the host. i.e. These tools aren't using getaddrinfo/ge
by js2 5y ago
It's worth noting that dig (and host) bypass the normal DNS resolution mechanism used by most programs on the host. i.e. These tools aren't using getaddrinfo/gethostbyname.
Sometimes, I want to see the results from getaddrinfo, which are impacted by caching on the host itself and/or OS-specific configuration settings that dig and host know nothing about. (scutil --dns on macOS, systemd-resolvedand nscd on Linux, etc.)
In that case, I usually use ping. e.g., waiting for a DNS change to propagate to a host, I might use:
while :; do ping -c 1 hostname; sleep 1; done
- nonsequitur 5y agoYou can directly query `getaddrinfo` with getent ahosts myhost
- indigodaddy 5y agoThanks for this. I’ve always wanted to know how to replicate how the OS is resolving.
- sgentle 5y agoThe OS X equivalent is: dscacheutil -q host -a name MYHOST
- formerly_proven 5y agoIf you have a particularly bad ISP or are on a controlled network, dig might not use the specified DNS server because the network is intercepting outgoing DNS traffic. Edit: It's not necessarily something to be worried about, just that "strange results" may occur if unaware. E.g. "why and how does 8.8.8.8 resolve a domain-local host?"
- midasuni 5y agoIf you’re concerned about network interception and lack the ability to have a trusted ISP, then WireGuard your connection to a trusted endpoint (you should probably route everything over it). Normally you’d want your devices to use your pi hope so you can block malicious traffic (adverts, trackers etc) from all your devices.
- da_chicken 5y agoThat's not really a dig problem.
- 1vuio0pswjnm7 5y agohttp://cdn.netbsd.org/pub/NetBSD/NetBSD-release-9/src/usr.bin/getaddrinfo/getaddrinfo.c http://cdn.netbsd.org/pub/NetBSD/NetBSD-release-9/src/usr.bi...
- globular-toast 5y agoThis has confused me before when trying to lookup mDNS/avahi/.local names. You can't use dig, host etc. to look them up because the answer doesn't come from a DNS server, but you can ping them.