I know you can test if a DNS server is valid by running:
dig +short test_hostname @nameserver
But what if we don't have a test_hostname
to test queries with?
For example if the system we want to run this command on is within a restricted network and we don't know what hostnames they have access to or are available on their network.
Would using localhost
as the test_hostname
be a reliable way of checking if this is a valid DNS server?
Or I did notice that dig, host, nslookup
will all return:
;; connection timed out; no servers could be reached
if you type in an invalid DNS server regardless of what test_hostname
you type in, so would just running:
dig +short @nameserver
be a reliable way of checking if the DNS server is valid? There is no need to check if the DNS server is fake/malicious or not, just if it is valid or invalid.