A Connection to whois.arin.net is not open to us. Our network administrators say we should use 192.0.47.59 for our whois service.
In some cases I will have a DNS name, in other cases I will have an IP address. I want to get the whois information in either case. My network administrators have allowed access to a specific IP address for the whois service, and I have to use that IP address. The define method allows me to set the IP address of the whois service if I give it the TLD, but I have no way to get it work for IP addresses.
This is related to Setting address of whois service for ruby whois gem, but since I got a partial solution, I know how to call the service, so for my question specific to IP addresses I thought I would start over.
I need to set the address of our whois service. So for a DNS name:
> Whois.whois('wandajackson.com')
Whois::ConnectionError: Errno::EHOSTUNREACH: No route to host - connect(2) for "whois.verisign-grs.com" port 43
from (irb):4
> Whois::Server.define(:tld, 'com', '192.0.47.59')
=> ["com", "192.0.47.59", {}]
irb(main):006:0> Whois.whois('wandajackson.com')
# => #<Whois::Record>
However, I cannot get it to work for IP addresses.
> Whois::Server.define(:ipv4, '74.0.0.0/8', '192.0.47.59')
=> ["74.0.0.0/8", "192.0.47.59", {}]
> Whois.whois('74.220.215.203')
Whois::ConnectionError: Errno::EHOSTUNREACH: No route to host - connect(2) for "whois.arin.net" port 43
from (irb):7
> Whois::Server.define(:ipv6, '2607::/8', '192.0.47.59')
=> ["2607::/8", "192.0.47.59", {}]
> Whois.whois('2607:f8b0:4004:800::200e')
Whois::ConnectionError: Errno::EHOSTUNREACH: No route to host - connect(2) for "whois.arin.net" port 43
from (irb):9
I'm sorry to say but that is a bug with missing
74.0.0.0/8assigment & if you create your own it is probably not correctly searched for in thedefinedlist thus => The assigment according to IP does not currently work.Why?
You can check the list and find out which ranges are assigned to ARIN:
First without any changes you check your IP address:
As you can see the record is not found at the authorities so it goes to a fallback
0.0.0.0/1which is set forwhois.arin.net.I tried to set
fatory(gets somehow ignored) anddefine:defineworked:As you can see there is assigment of
so you should be able to query IANA now? It appears you are not:
As you can see the
@allocationis still getting"0.0.0.0/1"and not74.0.0.0/8. Why? That I don't know yet. Probably some bug either on searching or finding the correct Object.Everything is lost? Not really, there is rather simple workaround but you have to understand the implications.
Workaround
If you define your fallback address via:
Everything starts to work. Now all the fallback queries will be done via IANA, which should not be a problem in your case as you can't reach ARIN anyways.
Now if you query via IP adddress you get correct results: