protocoles
May 4 2008, 12:28 PM
Hello,
I had installed Proxy software (Squid) today and I've problem now.
When I'm using different IP to see how it works but It's only show the primary IP, I'm using curl.
The code I'm using are:
$ch = curl_init();
curl_setopt($ch, CURLOPT_PROXY, "xxx.xxx.xxx.xxx:8080");
curl_setopt($ch, CURLOPT_URL,"http://myip.dk");
curl_setopt($ch, CURLOPT_REFERER, "");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$html = curl_exec($ch);
curl_close ($ch);
print $html;
Any idea, how can squid read all my server IPs.
Thanks
James Jhurani
May 4 2008, 12:44 PM
I'm not sure if there is a way to do this using PHP. Depending on how comfortable you are configuring squid, you may want to take a look at the tcp_outgoing_address directive in squid.conf.
protocoles
May 4 2008, 10:46 PM
can you please tell me little bit more. I've enabled following in my squid.conf
tcp_outgoing_address mysecond ip address
but it is still showing same main ip.
Really appreciate your help
James Jhurani
May 5 2008, 01:00 AM
CODE
squid.conf:
# TAG: tcp_outgoing_address
# Allows you to map requests to different outgoing IP addresses
# based on the username or source address of the user making
# the request.
#
# tcp_outgoing_address ipaddr [[!]aclname] ...
#
# Example where requests from 10.0.0.0/24 will be forwarded
# with source address 10.1.0.1, 10.0.2.0/24 forwarded with
# source address 10.1.0.2 and the rest will be forwarded with
# source address 10.1.0.3.
#
# acl normal_service_net src 10.0.0.0/255.255.255.0
# acl good_service_net src 10.0.1.0/255.255.255.0
# tcp_outgoing_address 10.0.0.1 normal_service_net
# tcp_outgoing_address 10.0.0.2 good_service_net
# tcp_outgoing_address 10.0.0.3
#
# Processing proceeds in the order specified, and stops at first fully
# matching line.
#
# Note: The use of this directive using client dependent ACLs is
# incompatible with the use of server side persistent connections. To
# ensure correct results it is best to set server_persistent_connections
# to off when using this directive in such configurations.
Assuming im reading it correctly...
CODE
acl box_1_port myport 3128
acl box_2_port myport 3129
acl vox_3_port myport 3130
tcp_outgoing_address 192.168.123.10 box_1_port
tcp_outgoing_address 192.168.123.20 box_2_port
tcp_outgoing_address 192.168.123.30 box_3_port
it would be something like this