3 ms·
Use nslookup. The dig tool intentionally goes directly to DNS and bypasses all local overrides like NIS, /etc/hosts, etc….
by bradknowles 5y ago
Use nslookup. The dig tool intentionally goes directly to DNS and bypasses all local overrides like NIS, /etc/hosts, etc….
- xchaotic 5y agoI didn’t know about the dig behaviours but when I read about it I immediately thought that is a great way to narrow down the problem - compare dig results with something else that does respect local conf.
- bradknowles 5y agoThat is exactly how I always used it. If dig provided different answers than nslookup, then we knew where to start looking.
- teddyh 5y agonslookup also goes directly to DNS, as far as I can tell. From what I remember, nslookup is what people used to use before “dig” became popular. So there is no good reason to ever use nslookup.
- bradknowles 5y agoIt depends on how your nslookup application is configured. They can be configured to go straight to DNS and not use any local host resolution, that’s true. And in that case, I consider it to be marginally useful — at least it generates less noise than dig. However, by default on most platforms, nslookup is specifically configured to use /etc/hosts (or the equivalent) or other local lookup facilities (like NIS) before using DNS. That’s the real reason you use nslookup, to see what those other local name resolution facilities might tell you that are not represented in the DNS.
- teddyh 5y ago> However, by default on most platforms, nslookup is specifically configured to use /etc/hosts (or the equivalent) or other local lookup facilities (like NIS) before using DNS. I can find no reference to this, nor does nslookup do that on my system. Maybe on Windows, its “nslookup” (which is not the real Unix nslookup) command does this?
- bradknowles 5y agoSee https://en.wikipedia.org/wiki/Nslookup https://en.wikipedia.org/wiki/Nslookup In particular, note the following quote: “Unlike dig, nslookup does not use the operating system's local Domain Name System resolver library to perform its queries, and thus may behave differently. Additionally, vendor-provided versions may include output of other sources of name information, such as host files, and Network Information Service. Some behaviors of nslookup may be modified by the contents of resolv.conf.[2]”