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

    Convert a list of DNS names to IPs

    Scheduled Pinned Locked Moved IT Discussion
    15 Posts 4 Posters 1.0k Views
    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.
    • IRJI
      IRJ
      last edited by

      Any quick solutions for this?

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

        What is the use case you need the IP addresses?

        IRJI 1 Reply Last reply Reply Quote 0
        • IRJI
          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
          • IRJI
            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
            • black3dynamiteB
              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

              IRJI 1 Reply Last reply Reply Quote 3
              • IRJI
                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

                black3dynamiteB 1 Reply Last reply Reply Quote 0
                • black3dynamiteB
                  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.

                  IRJI 1 Reply Last reply Reply Quote 1
                  • IRJI
                    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

                    black3dynamiteB 1 Reply Last reply Reply Quote 0
                    • IRJI
                      IRJ
                      last edited by

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

                        I am looking for a neat little list of IPs

                        1 Reply Last reply Reply Quote 0
                        • black3dynamiteB
                          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
                          • stacksofplatesS
                            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
                            
                            black3dynamiteB IRJI 2 Replies Last reply Reply Quote 5
                            • black3dynamiteB
                              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
                              • black3dynamiteB
                                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
                                • IRJI
                                  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
                                  • 1 / 1
                                  • First post
                                    Last post