LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Redirect Squid to another gateway (https://www.linuxquestions.org/questions/linux-networking-3/redirect-squid-to-another-gateway-799233/)

wazh 03-31-2010 05:52 PM

Redirect Squid to another gateway
 
Hi All,

I have recently just got another internet connection at home via cable as well as my exisiting DSL connection. I was wanting all my web browsing that I did via squid to be redirected down the cable connection. The box has a single nic at the moment and the default route sends it via the dsl connection for the mail server that is also running on the box.

I was hoping that anything that hit squid would go down the cable connection that is plugged into a router and thus I can route to 172.16.2.251 and everything will go out via cable.

I was reading about iproute2 and marking the packets and is wondering whether this is the way to go?

Some input would really help.

Thanks

devwatchdog 04-03-2010 09:25 AM

Are you intending to add another NIC for the cable connection, or are you going to utilize the existing NIC for this traffic? It is possible to use the same NIC for both I imagine, although I have to admit I've never tried it. Are you going to use a switch or something to connect your DSL and cable connections to your system?

What I am thinking is defining a virtual interface on the existing NIC, and then sending the traffic to the cable modem via that interface.

I recall working with someone on something similar not long ago here. In that situation, the system was using two interfaces to connect to the corresponding WAN connections, but the concept would be the same. They were using a squid server and wanted to send traffic via a secondary WAN interface.

I'll see if I can track down that tread.

****EDIT:

Found it:

http://www.linuxquestions.org/questi...-links-787973/

That problem looks similar to yours.

wazh 04-03-2010 06:30 PM

Hi,

Thanks so much for the response. That thread did help a great deal. However a couple of things. At this stage I dont have a second nic in the box and was hoping to use the exisiting nic and not have to worry about second nics and just send the packets to another gateway. If this is more trouble than its worth then certainly I will add the second nic. At the moment I have a router plugged into the cable modem which goes to a switch that the dsl is plugged into. The dsl has a gateway and the cable has a gateway. Depending on which route I wish to take I choose those gateways. Highly inflexible.

Any help would be greatly appreciated

wazh 04-04-2010 05:37 AM

OK,

So I bit the bullet and put the second nic in today as I was having no joy on making it work out the primary interface.

So the cable network is on 192.168.0.x and is plugged via the router into the second nic.. which oddly came up as eth2 but what the hell.

The primary network is on 172.16.2.x

I added tcp_outgoing_address 192.168.0.254 which is the default gateway that the router gave to eth2 via dhcp. (edit) this appears to be my error and should be the ip of the interface. Will change this to be 192.168.0.101

I added to rt_tables 200 squid.

I did two entries

ip rule add from 172.16.2.0/24 table squid
ip route add default via 192.168.0.254 table squid

of course when I add the second entry I loose all connectivity. Which means I have a problem.

Anyone got any answers?

Thanks so much


All times are GMT -5. The time now is 04:51 AM.