I have requirements to find domain name using IP address using Ruby.
I have some IP addresses. I got every time different random IP address. But I have to filter the IP addresses that have a domain name.
How to find the domain name?
You can use the stdlib Resolve.
Resolv
is a thread-aware DNS resolver library written in Ruby. Resolv can handle multiple DNS requests concurrently without blocking the entire Ruby interpreter.
Resolv
can look up various DNS resources using the DNS module directly.
require 'resolv'
Resolv.getname "210.251.121.214" # => "ci.ruby-lang.org"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With