Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Perform a DNS query with Ruby
# requires net-dns gem
# query defaults to A record
require 'net/dns'
res = Net::DNS::Resolver.new
packet = res.query("google.com")
packet.answer.first.value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.