Resolv is a thread-aware DNS resolver library written in Ruby. Resolv can handle multiple DNS requests concurrently without blocking the entire Ruby interpreter.

See also resolv-replace.rb to replace the libc resolver with Resolv.

Resolv can look up various DNS resources using the DNS module directly.


p Resolv.getaddress ""
p Resolv.getname "" do |dns|
  ress = dns.getresources "", Resolv::DNS::Resource::IN::A
  p { |r| r.address }
  ress = dns.getresources "", Resolv::DNS::Resource::IN::MX
  p { |r| [, r.preference] }


  • NIS is not supported.

  • /etc/nsswitch.conf is not supported.