|Can outgoing connections be associated with a specific ip address?|
Not sure if this is the right forum, I apologize if it isn't.
I have a hosted VPS with many sites on a shared ip address.
I added two new ip addresses and associated each with a single site (all done via WHM CPanel), so now two sites have unique ip addresses. DNS propagated and when I ping either site I correctly get (each of) the site's new,
unique ip address.
However, outgoing connections from each of the two unique-ip sites still use the old, shared ip address: when I run a wget script from the site's ssh shell to query WhatIsMyIp.com (or run a web page with a php script that does the same thing), WhatisMyIp.com reports that the call is coming from the old shared ip address, not from the
new associated unique address.
Is it even possible to associate an outgoing connection with a unique ip address in this manner?
(My Linux knowledge is rudimentary. If more VPS hardware or software details are required to answer this I can email tech-support to obtain the info--they were unable to answer this outgoing-connection-ip-address question).
In any case, I appreciate any help.
This seems to be a problem with the definition of "the site's ssh shell script." The *site* does not have a shell, the whole server machine has a shell. So the IP address associated with that shell depends on the (hardware) configuration, not on which 'server' you think you are using when running the shell.
That's about all I know... sorry. If this is a commercially-hosted machine, you might want to call the host's help desk and see if there is any way to 'specify' what IP address you want the shell to use (command-line switch, maybe).
Otherwise, you may need to 'split' the sites into several virtual machines, with the IP address of each VM defined at a 'much higher level.' You'd end up with three VM's, each running separate instances of Apache: Two with non-shared/IP-based hosts, and one with your named-based/shared-IP hosting on it.
Try using the
--bind-address option, this should allow you to choose the source IP address.
--bind-address=ADDRESS bind to ADDRESS (hostname or IP) on local host.
Thanks a lot Jim and Andrew, that's very helpful.
At first glance, and as far as I can tell without knowing Linux or Apache, I have maybe 3 options:
--wget (or any other program) that can use --bind-address=ADDRESS syntax as per above (works great)
- use socket_bind for PHP scripts I control (re. [webhostingtalk.com...]
--Splitting the sites into several virtual machines as per above ("User mode Linux with each virtual host having it's own IP address and Apache/PHP setup" (re. [answers.yahoo.com...] this seems to be
an implementation of virtual machines of this type.
Splitting the sites into several virtual machines is the most tempting for my needs, depending on hard it is to do. If anyone has any further thoughts on where to find resources for learning how to implement it, I would appreciate it.
Anyway thanks a lot for taking the time to respond.