0

I have one server with 3 interfaces (3 physical lan card), which are connected to 3 different routers. Each router has a different subnet, i.e. the 3 interfaces of server belong to 3 different subdomains:

eth0    192.168.1.42 #default interface
eth1    192.168.11.42
eth2    192.168.12.42

I have installed a squid server on the server with minimal configuration, and it indeed works fine with web browser. Here is the squid.conf:

acl all src all
acl lan src 192.168.0.0/16
http_port 3128
access_log /var/log/squid3/access.log squid
hosts_file /etc/hosts
http_access allow lan
http_access deny all

Now, I would like the squid server to use one particular interface (eth1) instead of eth0 to send out the packets (because that router has openvpn inside). And after some research, I tried with the following:

tcp_outgoing_address 192.168.11.42

However, after this line is added, I could not go to ANY place from browser using the squid proxy. After some Googling, some mentioned about SNAT of iptables and ip route, but that seems really complicated, and I am really not sure what I should set in this case.

I tried with squid3 -k debug, but I only got something like this in cache.log, not sure if it helps:

2014/06/26 17:16:42.843| comm_calliocallback: 0
2014/06/26 17:16:42.843| event.cc(225) checkEvents
2014/06/26 17:16:42.853| EventDispatcher::dispatch: Running 'MaintainSwapSpace'
2014/06/26 17:16:42.853| storeMaintainSwapSpace: f=1.00, max_scan=500, max_remove=80
2014/06/26 17:16:42.853| UFSSwapDir::maintain: /var/spool/squid3 removed 0/80 f=1.0000 max_scan=500
2014/06/26 17:16:42.853| event.cc(315) schedule: Adding 'MaintainSwapSpace', in 1.00 seconds
2014/06/26 17:16:42.853| comm_iocallbackpending: 0
2014/06/26 17:16:42.853| comm_calliocallback: 0
2014/06/26 17:16:42.853| comm_calliocallback: 0
2014/06/26 17:16:42.863| comm_iocallbackpending: 0
2014/06/26 17:16:42.863| comm_calliocallback: 0

Any help would be very much appreciated.

0

OK, after some further research, I think the answer is source plicy routing.

I followed the steps here:

Can't ping multihomed Linux machine on non-default interface

And it works like charm!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.