I've assigned a dedicated IP on my server to one of my customer via Plesk. But when he accesses any external content the IP reflected there as Host IP is the primary one of my server and not the dedicated one that is assigned to him. What could be the problem and how will I solve this.
-
You need to provide more information to get better help! For example, how is he accessing the server (using DNS name or IP)? – Khaled Dec 22 '11 at 10:25
-
well he may access it via any method. @khaled – user1075213 Dec 22 '11 at 16:05
1 Answers
The dafault behaviour in all TCP/IP stacks is that unless you specify otherwise, outgoing connections bind to the first address on the outgoing interface for the route the connection needs to take (and if there are two interfaces through which the connectino could be routed, the first in the routing table will be picked) - in this case your primary address. If you need to appear to come from one of the other addresses, or need/want to force the choice of interface the connection is routed through you need to specify the local interface or address to bind to.
Many libraries and tools expose this option, for instance cURL with it's --interface
option:
curl --interface 192.168.1.10 http://www.example.com/document.html
curl --interface eth2 http://www.example.com/document.html
curl --interface eth0:1 http://www.example.com/document.html
which is exposed by most language bindings for libcurl, such as in PHP:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch, CURLOPT_INTERFACE, "192.168.1.10");
curl_exec($ch);
curl_close($ch);
[I chose cURL as an example as it is a very common method used for conncetions to external services, and you gave no indication in your question as to what external connections were a problem. Other libraries and tools usually offer similar options - check their documentation for details]
This is not something you can do as an administrator: your user needs to update his code to control which interface/address his outgoing connections bind to rather than just allowing the IP stack to follow its default behaviour in that respect.

- 22,754
- 45
- 67
-
is there anyway by which i can force routing tables to make sure that, that request from that dedicated IP Plesk account is routed by that specific IP. I want that particular Plesk account to be blocked from accessing it via default server IP. I dont want to bother him either @david-spillett – user1075213 Dec 22 '11 at 16:09
-
@user1075213: unfortunately I'm not an expert in that area under Windows. With Linux and iptables based filtering you can match based on the user of the packet (with `-m owner --uid-owner`, see http://bit.ly/uwxRfS) *but* if the connection is from a script running from a web server process that is not running as that specific user this doesn't help. You've still not said what connections your want to set the source address of. If you include more detail in your question you might increase the chance of someone passing by and thinking "oh yes, I did that a while back" and answering. – David Spillett Dec 23 '11 at 10:52
-
its for SOAP requests going to one specific IP address. I want that to be routed through one particular IP – user1075213 Dec 27 '11 at 07:03