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:  Bcast:  Mask:

eth1      Link encap:Ethernet  HWaddr 02:1e:10:1f:00:00
          inet addr:  Bcast:  Mask:

route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    0      0        0 eth0   U     0      0        0 eth0 U     0      0        0 eth1

ip route list
default via dev eth0 dev eth0  proto kernel  scope link  src dev eth1  proto kernel  scope link  src

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 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 checkip.dyndns.org

I'm lost at this point on what else to try. Help? Any advice is welcome.

migrated from raspberrypi.stackexchange.com Apr 4 '16 at 22:44

This question came from our site for users and developers of hardware and software for Raspberry Pi.

Your Answer

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

Browse other questions tagged or ask your own question.