Squid specific incoming port -> outgoing IP on system

squid

Right now the following works for an incoming connection to a specific port and it uses a specific proxy for the outgoing connection

http_port 8000 name=port_8000
acl port_8000_acl myportname port_8000
always_direct deny port_8000_acl
never_direct allow port_8000_acl
cache_peer 54.38.228.38 parent 20006 0 no-query default name=proxy8000
cache_peer_access proxy8000 allow port_8000_acl
cache_peer_access proxy8000 deny all

How can I configure Squid so instead of using a proxy for an outgoing connection, I want it to use a specific network interface by providing the IP address of that NIC.

For example if we have 4 NICs on the machine and one of them has the IP of 192.168.2.147, I want to set Squid to use the interface with the IP 192.168.2.147 if we have an incoming connection to port 8000

Best Answer

Squid proxy has tcp_outgoing_address setting to map requests to different outgoing IP addresses:

tcp_outgoing_address 192.168.2.147 port_8000_acl

Related Topic