I managed to find a solution for you, yorbs8.
I have been futzing around with routes, created custom routing tables, iptables rules, all sorts of things.
But, those aren't the solution.
I ran across something here:
http://www.experts-exchange.com/Soft..._23091996.html
Which discussed load balancing, but the key to that was the 'tcp_outgoing_address' option.
Did a quick search on it to turn up a web page, which after looking at it is nothing more than information quoted from the squid.conf file.
This is the pertinent info:
Code:
# 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/24
# acl good_service_net src 10.0.2.0/24
# tcp_outgoing_address 10.1.0.1 normal_service_net
# tcp_outgoing_address 10.1.0.2 good_service_net
# tcp_outgoing_address 10.1.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.
#
#Default:
# none
tcp_outgoing_address 10.42.159.20
Well, upon further testing, you also will need to add a routing table to more or less associate outbound traffic to WAN 1. If you don't add the following routing configuration, the traffic will still exit the default gateway (WAN 2), the difference being now it will have the IP address of WAN 1.
The rule:
tcp_outgoing_address 10.42.159.20
will have to be added to your squid.conf file, with the proper IP used. Just search for the proper section in the squid.conf file (which is what I'm showing above) and add it there.
To add the routing table, you will have to follow these steps:
You should have an iproute2 package installed on your system. You should have a file:
/etc/iproute2/rt_tables
edit and add something to the effect of:
Code:
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
200 T1
You can use whatever you want for the name of the rule, mine being 'T1'. If a table already uses the 200 value, use something else.
Now you will have to add a few routes to that table. This is what I used to set up my system:
Code:
ip rule add from 10.42.159.0/24 table T1
ip route add default via 10.42.159.10 table T1
The 10.42.159.0/24 would be changed to the network definition for WAN 1 on your system. Change 10.42.159.10 to the default route for that interface.
These are not permanent changes to the routing table. You will have to add these configuration settings somewhere in your config scripts.