resolv class can let us get ip from domain name or get domain name from ip in a ruby program.
example
require 'resolv' p Resolv.getaddress "www.ruby-lang.org" p Resolv.getname "210.251.121.214"
result
"54.235.116.125" "ci.ruby-lang.org"
O