I've searched for details on how to do this but I've been unsuccessful - I wondered if someone could offer up some advice.
I have 2 network cards (LAN and 3G in my case), LAN is my main interface (static) and 3G is dynamic.
I have custom proxy server installed on the machine, and is accessible over LAN's static external IP on port 19000. It works but it's routed over my main LAN interface and I need to route this proxy traffic over 3G interface.
Here's how my interfaces and routing table looks like:
eth0 Link encap:Ethernet HWaddr 0e:93:9f:f1:98:10 inet addr:10.100.9.35 Bcast:10.100.9.255 Mask:255.255.255.0 eth1 Link encap:Ethernet HWaddr 02:1e:10:1f:00:00 inet addr:10.226.59.139 Bcast:10.226.59.143 Mask:255.255.255.248 route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 10.100.9.1 0.0.0.0 UG 0 0 0 eth0 10.100.9.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 10.226.59.136 0.0.0.0 255.255.255.248 U 0 0 0 eth1 ip route list default via 10.100.9.1 dev eth0 10.100.9.0/24 dev eth0 proto kernel scope link src 10.100.9.35 10.226.59.136/29 dev eth1 proto kernel scope link src 10.226.59.139
Interface eth0 is my LAN card and interface eth1 is my 3G card. The problem is also that 3G interface IP keep changing every time it reconnects to the mobile internet, so IP is different every time on eth1.
So, let's say with squid proxy is possible to config http_port to tcp_outgoing_address, but what address should be set if eth1 address will change every time?
http_port 19000 tcp_outgoing_address ?
I did a small test with adding one external web IP to the routing table and then accessed it over proxy and it was routed properly over 3G eth1.
ip route replace 184.108.40.206 dev eth1
But in that case I should add to my proxy server to add every single accessed IP to my routing table and to force it over eth1, but that can end with tons of IPs in the routing table...
Also with curl and interface name packets are going through over eth1, but with eth1 interface IP I get connection timeout:
curl --interface eth1 checkip.dyndns.org curl --interface 10.226.59.139 checkip.dyndns.org
I'm lost at this point on what else to try. Help? Any advice is welcome.