LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 11-27-2006, 04:16 PM   #1
dansif
LQ Newbie
 
Registered: Sep 2006
Posts: 8

Rep: Reputation: 0
Squid Proxy Server Multiple Nics


Hi, I have a squid proxy server with 2 NIC cards and a different set of IP addresses on each card. Each NIC card has a different gateway.

I was able to set it up to use the main NIC card's addresses as proxy IPs, but the second NIC cards IPs don't work.

Here's part of squid.conf:
Code:
http_port 208.***.**.194:8080
http_port 208.***.**.195:8081
http_port 208.***.**.196:8082
http_port 208.***.**.197:8083
http_port 208.***.**.198:8084
http_port 208.***.**.199:8085
http_port 208.***.**.200:8086
http_port 208.***.**.201:8087   
http_port 208.***.**.202:8088
http_port 208.***.**.203:8089
http_port 208.***.**.204:8090
http_port 208.***.**.205:8091
http_port 208.***.**.206:8092

http_port 208.***.**.178:8100
http_port 208.***.**.179:8101
http_port 208.***.**.180:8102
http_port 208.***.**.181:8103
http_port 208.***.**.182:8104 
http_port 208.***.**.183:8105
http_port 208.***.**.184:8106
http_port 208.***.**.185:8107
http_port 208.***.**.186:8108
http_port 208.***.**.187:8109
http_port 208.***.**.188:8110
http_port 208.***.**.189:8111
http_port 208.***.**.190:8112

tcp_outgoing_address 208.***.**.194 ip1 port1
tcp_outgoing_address 208.***.**.195 ip2 port2
tcp_outgoing_address 208.***.**.196 ip3 port3
tcp_outgoing_address 208.***.**.197 ip4 port4
tcp_outgoing_address 208.***.**.198 ip5 port5
tcp_outgoing_address 208.***.**.199 ip6 port6
tcp_outgoing_address 208.***.**.200 ip7 port7
tcp_outgoing_address 208.***.**.201 ip8 port8
tcp_outgoing_address 208.***.**.202 ip9 port9
tcp_outgoing_address 208.***.**.203 ip10 port10
tcp_outgoing_address 208.***.**.204 ip11 port11
tcp_outgoing_address 208.***.**.205 ip12 port12
tcp_outgoing_address 208.***.**.206 ip13 port13

tcp_outgoing_address 208.***.**.178 ip21 port21
tcp_outgoing_address 208.***.**.179 ip22 port22
tcp_outgoing_address 208.***.**.180 ip23 port23
tcp_outgoing_address 208.***.**.181 ip24 port24
tcp_outgoing_address 208.***.**.182 ip25 port25
tcp_outgoing_address 208.***.**.183 ip26 port26
tcp_outgoing_address 208.***.**.184 ip27 port27
tcp_outgoing_address 208.***.**.185 ip28 port28
tcp_outgoing_address 208.***.**.186 ip29 port29
tcp_outgoing_address 208.***.**.187 ip30 port30
tcp_outgoing_address 208.***.**.188 ip31 port31
tcp_outgoing_address 208.***.**.189 ip32 port32
tcp_outgoing_address 208.***.**.190 ip33 port33
Where ***.** represents parts of the IP addresses that I don't want to give out. So, IPs 208.***.**.178 - 208.***.**.190 work fine, but IPs 208.***.**.194 - 208.***.**.206 don't work as proxy IPs.

How can I make this work with both IP blocks?
 
Old 11-27-2006, 05:05 PM   #2
chort
Senior Member
 
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 69
Why on earth are you using different ports for each IP? You can have squid use the same port for each IP it binds to SFAIK.
 
Old 11-28-2006, 07:19 AM   #3
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
Can you please post the output of
#ip rou ls table all ??
 
Old 11-28-2006, 09:12 AM   #4
dansif
LQ Newbie
 
Registered: Sep 2006
Posts: 8

Original Poster
Rep: Reputation: 0
Here is the contents of
#ip route

Code:
208.***.**.176/28 dev eth1  proto kernel  scope link  src 208.***.**.178  metric 10 
208.***.**.192/28 dev eth0  proto kernel  scope link  src 208.***.**.194  metric 10 
208.***.**.0/24 dev eth0  proto kernel  scope link  src 208.***.**.195 
208.***.**.0/24 dev eth1  proto kernel  scope link  src 208.***.**.179 
default 
        nexthop via 208.***.**.193  dev eth0 weight 1
        nexthop via 208.***.**.177  dev eth1 weight 1
default dev eth1  scope link  metric 10
The default is eth1 which contains the IPs that work. The IPs on eth0 don't work as proxies.

BTW. I didn't realize you could use the same port for all of the proxies. How would squid know which IP to use as the outgoing address if all of the traffic came in on the same port?
 
Old 11-28-2006, 09:35 AM   #5
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
Quote:
Originally Posted by dansif
Here is the contents of
#ip route

Code:
208.***.**.176/28 dev eth1  proto kernel  scope link  src 208.***.**.178  metric 10 
208.***.**.192/28 dev eth0  proto kernel  scope link  src 208.***.**.194  metric 10 
208.***.**.0/24 dev eth0  proto kernel  scope link  src 208.***.**.195 
208.***.**.0/24 dev eth1  proto kernel  scope link  src 208.***.**.179 
default 
        nexthop via 208.***.**.193  dev eth0 weight 1
        nexthop via 208.***.**.177  dev eth1 weight 1
default dev eth1  scope link  metric 10
The default is eth1 which contains the IPs that work. The IPs on eth0 don't work as proxies.

BTW. I didn't realize you could use the same port for all of the proxies. How would squid know which IP to use as the outgoing address if all of the traffic came in on the same port?
Read the last post of this thread --> http://www.linuxquestions.org/questi...d.php?t=493819
It is emphasized on how can you route packets with squid + source address routing.
 
Old 11-28-2006, 01:08 PM   #6
dansif
LQ Newbie
 
Registered: Sep 2006
Posts: 8

Original Poster
Rep: Reputation: 0
This simply does not give enough information. What is in table1 and table2? What kind of tables are table1 and table2? Where do you do the routing (I use IPTables)? Pre-routing, post-routing, forward? Please give me a little more information.

Quote:
Read the last post of this thread --> http://www.linuxquestions.org/questi...d.php?t=493819
It is emphasized on how can you route packets with squid + source address routing.
 
Old 11-28-2006, 01:42 PM   #7
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
Quote:
Originally Posted by dansif
This simply does not give enough information. What is in table1 and table2? What kind of tables are table1 and table2? Where do you do the routing (I use IPTables)? Pre-routing, post-routing, forward? Please give me a little more information.
Table1 & Table2 are the arbitirary tables which can be replaced by any numeric nos less than 253 or if you want to refer them by any name then you got to edit /etc/iproute2/rt_tables to mention a table name & a numeric id (<253).

I'll give you a broader picture of the overall concept.

We use SQUID to generate packets get out with specific source IPs(on basis on clientsets).
And then as we have packets for which we know the source ip & hence we do source ip based routing.
Now we use ip rule to create rules so that this source ip based routing could be implemented.
with
Code:
ip rule from YOUR-SOURCE-IP1 table 200
ip rule from YOUR-SOUCE-IP2 table 201
will act like if then condition rules.

So ip rule stand prior to the routing decision part & then ip rule fetch packets into different routing tables(with numeric ids)

Now you'll ask about how are these routing tables are different from the rest & how do we specify them.
Code:
ip rou add default via gateway1 table 200
ip rou add default via gateway2 table 201
So in one way we organize packtes & then after finding out where to forward these packets (from ip rule command) we forward them to tables(routes) which process them prior to the default routes.

For example
:
With squid we generated a packet to get out with source ip of 201.200.100.101; then the next thing will the decision taken by ip rule entries. ip rule will determine that we got to forward packets with these source ip to table 101(arbit) & then table 101 has some route; with which these packets get traverse & goes OUT.

We dont use IPTABLES in it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
squid proxy server configuration & distribution of internet without proxy gaurav_gupta082 Linux From Scratch 2 07-31-2010 11:25 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
proxy server setup, 2 NICs in same PC gjhicks Linux - Networking 4 04-06-2005 06:38 AM
2 nics and a squid proxy mssucks Linux - Networking 4 03-06-2002 04:29 AM
Multiple NICs Server Setup swa1 Linux - Software 2 07-26-2001 09:43 PM


All times are GMT -5. The time now is 08:16 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration