Convert a list of DNS names to IPs
-
@dustinb3403 said in Convert a list of DNS names to IPs:
What is the use case you need the IP addresses?
I have a list of DNS names that I need to convert to IP addresses
-
I see alot of windows solutions, but I am looking for a linux one..
-
Convert Internet Domains to IP
http://domaintoipconverter.com/Resolve IP Addresses from List of Host Names
https://gallery.technet.microsoft.com/scriptcenter/Resolve-IP-Addresses-from-df4cbbe5On Linux systems, use a commands like
dig
dig +short -4 -f dns.txt
-f = read a list of dns names in a text file
-4 = show the ip address in IPv4 -
@black3dynamite said in Convert a list of DNS names to IPs:
Convert Internet Domains to IP
http://domaintoipconverter.com/Resolve IP Addresses from List of Host Names
https://gallery.technet.microsoft.com/scriptcenter/Resolve-IP-Addresses-from-df4cbbe5On Linux systems, use a commands like
dig
dig +short -4 -f dns.txt
-f = read a list of dns names in a text file
-4 = show the ip address in IPv4cool thanks
-
@irj said in Convert a list of DNS names to IPs:
@black3dynamite said in Convert a list of DNS names to IPs:
Convert Internet Domains to IP
http://domaintoipconverter.com/Resolve IP Addresses from List of Host Names
https://gallery.technet.microsoft.com/scriptcenter/Resolve-IP-Addresses-from-df4cbbe5On Linux systems, use a commands like
dig
dig +short -4 -f dns.txt
-f = read a list of dns names in a text file
-4 = show the ip address in IPv4cool thanks
Here's a better one for dig
dig +noall +answer -f dns.txt
+noall = will not show any information provided by dig
+anwser = will only show the answer section dns name and IP. -
@black3dynamite said in Convert a list of DNS names to IPs:
dig +noall +answer -f dns.txt
I am not getting any results printed for any of the commands
-
This post is deleted! -
I am looking for a neat little list of IPs
-
@irj said in Convert a list of DNS names to IPs:
@black3dynamite said in Convert a list of DNS names to IPs:
dig +noall +answer -f dns.txt
I am not getting any results printed for any of the commands
I tried it again, but this time at work and it doesn't provide an answer but it works great at home.
-
It's pretty simple with Bash and a list of names on each line. Just do
while read dnsname; do nslookup $dnsname done < dnsnames.txt
-
@stacksofplates said in Convert a list of DNS names to IPs:
It's pretty simple with Bash and a list of names on each line. Just do
while read dnsname; do nslookup $dnsname done < dnsnames.txt
That's awesome. It even works with .local domain networks too.
-
Adding
| grep ^Name -A1; echo
at the end will only output the dns name and address.while read dnsname; do nslookup $dnsname done < dnsnames.txt | grep ^Name -A1; echo
-
@stacksofplates said in Convert a list of DNS names to IPs:
while read dnsname; do
nslookup $dnsnameBeautiful