ML
    • Register
    • Login
    • Search
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups

    Convert a list of DNS names to IPs

    IT Discussion
    4
    15
    776
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • IRJ
      IRJ last edited by

      Any quick solutions for this?

      1 Reply Last reply Reply Quote 0
      • DustinB3403
        DustinB3403 last edited by

        What is the use case you need the IP addresses?

        IRJ 1 Reply Last reply Reply Quote 0
        • IRJ
          IRJ @DustinB3403 last edited by

          @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

          1 Reply Last reply Reply Quote 1
          • IRJ
            IRJ last edited by

            I see alot of windows solutions, but I am looking for a linux one..

            1 Reply Last reply Reply Quote 0
            • black3dynamite
              black3dynamite last edited by

              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-df4cbbe5

              On 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

              IRJ 1 Reply Last reply Reply Quote 3
              • IRJ
                IRJ @black3dynamite last edited by

                @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-df4cbbe5

                On 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

                cool thanks

                black3dynamite 1 Reply Last reply Reply Quote 0
                • black3dynamite
                  black3dynamite @IRJ last edited by

                  @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-df4cbbe5

                  On 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

                  cool 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.

                  IRJ 1 Reply Last reply Reply Quote 1
                  • IRJ
                    IRJ @black3dynamite last edited by

                    @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

                    black3dynamite 1 Reply Last reply Reply Quote 0
                    • IRJ
                      IRJ last edited by

                      This post is deleted!
                      1 Reply Last reply Reply Quote 0
                      • IRJ
                        IRJ last edited by

                        I am looking for a neat little list of IPs

                        1 Reply Last reply Reply Quote 0
                        • black3dynamite
                          black3dynamite @IRJ last edited by black3dynamite

                          @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.

                          1 Reply Last reply Reply Quote 0
                          • stacksofplates
                            stacksofplates last edited by stacksofplates

                            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
                            
                            black3dynamite IRJ 2 Replies Last reply Reply Quote 5
                            • black3dynamite
                              black3dynamite @stacksofplates last edited by

                              @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.

                              1 Reply Last reply Reply Quote 1
                              • black3dynamite
                                black3dynamite last edited by black3dynamite

                                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
                                
                                1 Reply Last reply Reply Quote 1
                                • IRJ
                                  IRJ @stacksofplates last edited by

                                  @stacksofplates said in Convert a list of DNS names to IPs:

                                  while read dnsname; do
                                  nslookup $dnsname

                                  Beautiful

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post