# [Solved] Dual WAN and routing

## Dr.Drake

Greetings!

I've been struggling with my routing for couple of days and I haven't been able to find a solution on my own... so I thought maybe someone here could give me a hand.

I have two internet connections, one is low latency and low bandwidth (WAN1) and another is high latency and high bandwidth (WAN2). And then there is LAN too. I have basics set up, and everything gets routed from LAN via WAN1 smooth and nicely. I wish I could route all traffic that goes through Squid proxy through the high bandwidth route, but I haven't really been able to get this work. I've set tcp_outgoing_address in squid to 192.168.2.2 and netstat says it really is the origin of the proxys outgoing traffic. However it gets routed through the WAN1 also. I've tried to create route from 192.16.8.2.2 via 192.16.8.2.1 gateway by using 

```
ip route add 192.168.2.1 dev eth1 src 192.168.2.2
```

Obviously this doesn't work  :Embarassed: 

My network structure is like this:

WAN1 <-- eth0 ---> Router <-- eth1 ---> WAN2

WAN1 (eth0) - the default route:

IP: 10.2.3.7

NM: 255.255.255.0

GW: 10.2.3.1

WAN2 (eth1) - the route I would like to squid use.

IP: 192.168.2.2

NM: 255.255.255.0

(GW: 192.168.2.1)

LAN (eth2):

IP: 192.168.0.1

NM: 255.255.255.0

My Kernel IP routing table looks like this by default when I fire up the router:

```
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

default         10.2.3.1        0.0.0.0         UG    100    0        0 eth0

10.2.3.0        *               255.255.255.0   U     0      0        0 eth0

192.168.0.0     *               255.255.255.0   U     0      0        0 eth2

192.168.2.0     *               255.255.255.0   U     0      0        0 eth1

```

iptables script I have, that allows traffic from LAN to WAN1:

```
iptables --flush

iptables --table nat --flush

iptables --delete-chain

iptables --table nat --delete-chain

iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE

iptables --append FORWARD --in-interface eth2 -j ACCEPT

```

Last edited by Dr.Drake on Tue Jun 25, 2013 11:40 am; edited 1 time in total

----------

## papahuhn

Have a look here http://lartc.org/howto/lartc.rpdb.multiple-links.html

----------

## Dr.Drake

It's been a while but thanks. I got it working with assistance of the page you provided.

----------

