I have a Debian Jessie 8 server with three unique IPv4 IPs. I connect to the server from Windows 7 via Putty. I can open three Putty windows using each of the three IPs. I am trying to execute a Perl script that checks whois information using Perl's use Net::Whois::Raw and the system's whois using backticks

$domain_info = `whois google.com 2>&1`;
$domain_info2 = whois(google.com);

The script is automated and keeps on checking different URLs. The issue is, that because of the call frequency from the three windows I am getting

whois limit exceeded - see www.pir.org/whois for details

How can I execute the Perl script so that each Putty window will use the public IP I used to login to?


According to http://search.cpan.org/~nalobin/Net-Whois-Raw-2.85/lib/Net/Whois/Raw.pm, you can:

set_ips_for_server('whois.ripn.net', ['']);

You can specify IPs list which will be used for queries to desired whois server. It can be useful if you have few interfaces, but you need to access whois server from specified ips.

| improve this answer | |
  • I added set_ips_for_server('whois.pir.org', ['xxx.xxx.xxx.123']); set_ips_for_server('whois.verisign-grs.com', [''xxx.xxx.xxx.124']); set_ips_for_server('whois.verisign-grs.com', ['xxx.xxx.xxx.125']); and now I get Undefined subroutine &main::set_ips_for_server called at myScript.pl line 9. – KingsInnerSoul Aug 31 '15 at 13:45
  • 1
    Looks like the function is not exported; try prefixing the call -- Net::Whois::Raw::set_ips_for_server(....) – Jeff Schaller Aug 31 '15 at 13:56
  • 1
    @KingsInnerSoul did you get it working? – Jeff Schaller Sep 2 '15 at 1:40
  • Your suggestion worked. It seems to have forced the whois to be executed from the IPs I set, but I still wonder, how can you make the whole script be seen via a set IP? – KingsInnerSoul Sep 2 '15 at 13:15
  • 1
    Sounds like you'd want to pass that IP in as a parameter, then. – Jeff Schaller Sep 2 '15 at 14:50

Well, the pwhois utility of that module at https://api.metacpan.org/source/NALOBIN/Net-Whois-Raw-2.85/pwhois indicates there is a -a srcip flag, though you're calling whois which may or may not be pwhois.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.