How to specify the DNS server in host command
6,777
Just use:
host -a google.com my.dns.server.com
host [-aCdlnrsTwv] [-c class] [-N ndots] [-R number] [-t type] [-W wait] [-m flag] [-4] [-6] {name} [server]
Author by
None
Updated on September 18, 2022Comments
-
None over 1 year
I want to use linux
host
command to query all records (A, TXT, etc.) of a domain. I find this possible using-a
option as in:host -a google.com
However, I need to specify my own DNS server by its IP. I could not find any way to specify the resolver or the name server. I find this in dig as in:
dig MX google.co.uk @ns1.google.com
where the string after@
is the name server. But I did not find a way to query all records (TXT, A, etc.) indig
.I prefer to use
host
. How can I specify the name server nhost
command? -
tripleee about 6 years+1 though I'm not entirely sure this is completely portable; I have seen some pesky differences between different versions of the
host
command. -
tripleee about 6 years
-
None about 6 yearsI ma using ubuntu. It did not work with me. When I use
dig
with the name server (I use its IP), it works. So I am sure my name server is up and running. When I used your suggested command format, It get:~$ host -a mywerver.com mydns1.com Trying "myserver.com" ;; connection timed out; no servers could be reached
-
None about 6 yearsFor some reason the vm got into
aborted
state. After starting it again the command worked successfully. -
Aubs about 6 yearsGlad to hear it. I tried it myself on Ubuntu first to make sure it worked!