LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-08-2010, 09:06 AM   #1
vonedaddy
Member
 
Registered: Aug 2004
Location: Philadelphia,PA
Posts: 185

Rep: Reputation: 17
Squid with 2 NICs... set gateway


I have a proxy server with two nics, each pointing to a different router and a different internet connection.

example:

eth0 -> 192.168.1.2 -> 192.168.1.1
eth1 -> 10.0.0.2 -> 10.0.0.1

The gateway of the machine itself is 192.168.1.1 and thats how I want it.

but squid is using this for its default path to the internet, and I want it to use 10.0.0.1.

Is this possible without changing the machines gateway?
 
Old 11-08-2010, 11:23 AM   #2
kaushalpatel1982
Member
 
Registered: Aug 2007
Location: INDIA
Distribution: CentOS, RHEL, Fedora, Debian, Ubuntu, LinuxMint, Kali Linux, Raspbian
Posts: 166

Rep: Reputation: 10
You haven't described which is your LAN interface and which is your WAN interface?

You have not required to add default gateway on you LAN interface. Just require to configure it on WAN Interface.
 
Old 11-08-2010, 11:44 AM   #3
vonedaddy
Member
 
Registered: Aug 2004
Location: Philadelphia,PA
Posts: 185

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by kaushalpatel1982 View Post
You haven't described which is your LAN interface and which is your WAN interface?

You have not required to add default gateway on you LAN interface. Just require to configure it on WAN Interface.
Both interfaces (eth0 and eth1) are both LAN and WAN interface. meaning they both have seperate LANs and both are connected to different WANs (internet connections).
 
Old 11-08-2010, 10:50 PM   #4
kaushalpatel1982
Member
 
Registered: Aug 2007
Location: INDIA
Distribution: CentOS, RHEL, Fedora, Debian, Ubuntu, LinuxMint, Kali Linux, Raspbian
Posts: 166

Rep: Reputation: 10
I dont understand how this configuration going to help you? It is good to have squid as your internet gateway.
 
Old 11-09-2010, 06:10 PM   #5
vonedaddy
Member
 
Registered: Aug 2004
Location: Philadelphia,PA
Posts: 185

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by kaushalpatel1982 View Post
I dont understand how this configuration going to help you? It is good to have squid as your internet gateway.
Well here is the problem...

I have a linux box, it serves as an SFTP server for huge files (TIF and PSD files) for external clients. It also servers as proxy server for internal hosts.

There are two routers connected to 2 different ISP's.

ISP1 -> router1 -> eth0

ISP2 -> router2 -> eth1

So right now the ISP on eth1 is not being used. all traffic in and out is going over eth0 because squid is using the default gateway.

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 * 255.255.255.0 U 0 0 0 eth1
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth1
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0


The problem is when people are downloading 50 PSD files at 200MB each the internet really slows down for the folks using the proxy server. And all this time the second ISP is getting NO bandwidth usage.

So if I change the default gateway to eth1, then the people using SFTP can not connect because they come in on eth0, but the box tries to respond on eth1 the new default gateway.

So I need SFTP to work on eth0 and squid to work on eth1.

Did I explain that clear? ANY help would be appreciated.
 
Old 11-10-2010, 04:59 AM   #6
kaushalpatel1982
Member
 
Registered: Aug 2007
Location: INDIA
Distribution: CentOS, RHEL, Fedora, Debian, Ubuntu, LinuxMint, Kali Linux, Raspbian
Posts: 166

Rep: Reputation: 10
This link might help you to resolve your problem.
http://lartc.org/howto/lartc.rpdb.multiple-links.html

Last edited by kaushalpatel1982; 11-10-2010 at 05:02 AM.
 
Old 11-10-2010, 10:23 PM   #7
vonedaddy
Member
 
Registered: Aug 2004
Location: Philadelphia,PA
Posts: 185

Original Poster
Rep: Reputation: 17
For anyone reading this in the future this is how I resolved the issue:

1) Add new table to /etc/iproute2/rt_tables
echo -e "200\tAivilaNet" >> /etc/iproute2/rt_tables

2)Add new route to interface
echo "default table AivilaNet via 10.0.0.1" > /etc/sysconfig/network-scripts/route-eth1

3) Add new rule to interface
echo "from 10.0.0.2 table AivilaNet" > /etc/sysconfig/network-scripts/rule-eth1
 
Old 11-11-2010, 01:48 AM   #8
kaushalpatel1982
Member
 
Registered: Aug 2007
Location: INDIA
Distribution: CentOS, RHEL, Fedora, Debian, Ubuntu, LinuxMint, Kali Linux, Raspbian
Posts: 166

Rep: Reputation: 10
mark this as resolve.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple NICs, different subnets, wrong default gateway being set qwbillings Linux - Networking 1 07-02-2009 09:23 AM
How to Configure two NICs to set setup Squid proxy on RH linux 8.0 latencywala Red Hat 14 01-02-2009 05:01 AM
lm10.0 gateway is set but when I reboot I have to set the gateway rharvey32 Mandriva 8 02-13-2006 01:35 PM
Linux Gateway with 3 NICs pin_bk Linux - Networking 16 03-27-2005 09:57 AM
Setting up Redhat squid gateway with dual NICs wrathyimp Linux - Networking 13 06-12-2003 11:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration