Selecting which IP address to use in Perl

Posted on 2003-03-31
Medium Priority
Last Modified: 2010-03-05
Say I have a server with 4 ip addresses allocated to it:
Whenever I connect to another server FROM my server it uses
Is there any way to write a script where I can either 'choose' which IP address to use to connect to other servers or cycle through them or even pick one of them randomly to use?
Question by:Melitaweb
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

fz2hqs earned 150 total points
ID: 8239577
Assuming that you only have one NIC, you will only get traffic coming from the first address that is bound to it. If you have multiple NICs then the IP will be routed least cost, hence still tend to come from the same adapter. This should be true of any OS.

If you wanted to script something then you *may* be able to fool around with routing tables, however IMHO you are best to leave that alone, yoou could quickly end up with something that doesn't work at all !

Author Comment

ID: 8239665
I wondered if it was possible at all. The reason I want to do this is I want to use the whois statement but I need to check about 20,000 domains (for registration status) and I didn't want to run the risk of having an IP banned - was going to cycle through them.
Ah well if it's not possible it's not. I'll give it a couple of days to see if anyone can shed any light before I award the points.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question