File: FAQ-5.html

package info (click to toggle)
squid 1.1.21-1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 2,828 kB
  • ctags: 3,705
  • sloc: ansic: 34,400; sh: 1,975; perl: 899; makefile: 559
file content (631 lines) | stat: -rw-r--r-- 24,583 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
<HTML>
<HEAD>
<TITLE>SQUID Frequently Asked Questions: Communication between browsers and Squid</TITLE>
</HEAD>
<BODY>
<A HREF="FAQ-4.html">Previous</A>
<A HREF="FAQ-6.html">Next</A>
<A HREF="FAQ.html#toc5">Table of Contents</A>
<HR>
<H2><A NAME="s5">5. Communication between browsers and Squid</A></H2>

<P>Most web browsers available today support proxying and are easily configured
to use a Squid server as a proxy.  Some browsers support advanced features
such as lists of domains or URL patterns that shouldn't be fetched through
the proxy, or JavaScript automatic proxy configuration.</P>

<H2><A NAME="ss5.1">5.1 Netscape manual configuration</A></H2>

<P>Select <B>Network Preferences</B> from the
<B>Options</B> menu.  On the <B>Proxies</B>
page, click the radio button next to <B>Manual Proxy
Configuration</B> and then click on the <B>View</B>
button.  For each protocol that your Squid server supports (by default,
HTTP, FTP, and gopher) enter the Squid server's hostname or IP address
and put the HTTP port number for the Squid server (by default, 3128) in
the <B>Port</B> column.  For any protocols that your Squid
does not support, leave the fields blank.</P>
<P>Here is a
<A HREF="/Squid/FAQ/navigator.jpg">screen shot</A> of the Netscape Navigator manual proxy
configuration screen.</P>



<H2><A NAME="ss5.2">5.2 Netscape automatic configuration</A></H2>

<P>Netscape Navigator's proxy configuration can be automated with
JavaScript (for Navigator versions 2.0 or higher).  Select
<B>Network Preferences</B> from the <B>Options</B>
menu.  On the <B>Proxies</B> page, click the radio button
next to <B>Automatic Proxy Configuration</B> and then
fill in the URL for your JavaScript proxy configuration file in the
text box.  The box is too small, but the text will scroll to the
right as you go.</P>
<P>Here is a
<A HREF="/Squid/FAQ/navigator-auto.jpg">screen shot</A>
of the Netscape Navigator automatic proxy configuration screen.</P>
<P>You may also wish to consult Netscape's documentation for the Navigator
<A HREF="http://home.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html">JavaScript proxy configuration</A></P>

<P>Here is a sample auto configuration JavaScript from Oskar Pearson:
<HR>
<PRE>
//We (www.is.co.za) run a central cache for our customers that they
//access through a firewall - thus if they want to connect to their intranet
//system (or anything in their domain at all) they have to connect
//directly - hence all the &quot;fiddling&quot; to see if they are trying to connect
//to their local domain.

//Replace each occurrence of company.com with your domain name
//and if you have some kind of intranet system, make sure
//that you put it's name in place of &quot;internal&quot; below.

//We also assume that your cache is called &quot;cache.company.com&quot;, and
//that it runs on port 8080. Change it down at the bottom.

//(C) Oskar Pearson and the Internet Solution (http://www.is.co.za)

    function FindProxyForURL(url, host)
        {
            //If they have only specified a hostname, go directly.
            if (isPlainHostName(host))
                    return &quot;DIRECT&quot;;

            //These connect directly if the machine they are trying to
            //connect to starts with &quot;intranet&quot; - ie http://intranet
            //Connect  directly if it is intranet.*
            //If you have another machine that you want them to
            //access directly, replace &quot;internal*&quot; with that
            //machine's name
            if (shExpMatch( host, &quot;intranet*&quot;)||
                            shExpMatch(host, &quot;internal*&quot;))
                return &quot;DIRECT&quot;;

            //Connect directly to our domains (NB for Important News)
            if (dnsDomainIs( host,&quot;company.com&quot;)||
            //If you have another domain that you wish to connect to
            //directly, put it in here
                            dnsDomainIs(host,&quot;sistercompany.com&quot;))
                return &quot;DIRECT&quot;;

            //So the error message &quot;no such host&quot; will appear through the
            //normal Netscape box - less support queries :)
            if (!isResolvable(host))
                    return &quot;DIRECT&quot;;

            //We only cache http, ftp and gopher
            if (url.substring(0, 5) == &quot;http:&quot; ||
                            url.substring(0, 4) == &quot;ftp:&quot;||
                            url.substring(0, 7) == &quot;gopher:&quot;)

            //Change the &quot;:8080&quot; to the port that your cache
            //runs on, and &quot;cache.company.com&quot; to the machine that
            //you run the cache on
                    return &quot;PROXY cache.company.com:8080; DIRECT&quot;;

            //We don't cache WAIS
            if (url.substring(0, 5) == &quot;wais:&quot;)
                    return &quot;DIRECT&quot;;

            else
                    return &quot;DIRECT&quot;;
        }
</PRE>
<HR>
</P>


<H2><A NAME="ss5.3">5.3 Lynx and Mosaic configuration</A></H2>

<P>For Mosaic and Lynx, you can set environment variables
before starting the application.  For example (assuming csh or tcsh):</P>
<P>
<PRE>
        % setenv http_proxy http://mycache.example.com:3128/
        % setenv gopher_proxy http://mycache.example.com:3128/
        % setenv ftp_proxy http://mycache.example.com:3128/
</PRE>
</P>
<P>For Lynx you can also edit the <EM>lynx.cfg</EM> file to configure
proxy usage.  This has the added benefit of causing all Lynx users on
a system to access the proxy without making environment variable changes
for each user.  For example:
<PRE>
        http_proxy:http://mycache.example.com:3128/
        ftp_proxy:http://mycache.example.com:3128/
        gopher_proxy:http://mycache.example.com:3128/
</PRE>
</P>


<H2><A NAME="ss5.4">5.4 Redundant Auto-Proxy-Configuration</A></H2>

<P>There's one nasty side-effect to using auto-proxy scripts: if you start
the webbrowser it will try and load the auto-proxy-script.</P>

<P>If your script isn't available either because the webserver hosting the
script is down or your workstation can't reach the webserver (e.g.
because you're working off-line with your notebook and just want the
read a previously saved HTML-file) you'll get different errors depending
on the browser you use.</P>

<P>The Netscape browser will just return an error after a timeout (after
that it tries to find the site 'www.proxy.com' if the script you use is
called 'proxy.pac').</P>

<P>The Microsoft Internet Explorer on the other hand won't even start, no
window displays, only after about 1 minute it'll display a window asking
you to go on with/without proxy configuration.</P>

<P>The point is that your workstations always need to locate the
proxy-script. I created some extra redundancy by hosting the script on
two webservers (actually Apache webservers on the proxyservers
themselves) and adding the following records to my primary nameserver:
<PRE>
        proxy   CNAME           proxy1
                CNAME           proxy2
</PRE>

The clients just refer to 'http://proxy/proxy.pac'.  This script looks like this:</P>
<P>
<PRE>
function FindProxyForURL(url,host)
{
        // Hostname without domainname or host within our own domain?
        // Try them directly:
        // http://www.domain.com actually lives before the firewall, so
        // make an exception:
        if ((isPlainHostName(host)||dnsDomainIs( host,&quot;.domain.com&quot;)) &&
                !localHostOrDomainIs(host, &quot;www.domain.com&quot;))
                return &quot;DIRECT&quot;;

        // First try proxy1 then proxy2. One server mostly caches '.com'
        // to make sure both servers are not
        // caching the same data in the normal situation. The other
        // server caches the other domains normally.
        // If one of 'm is down the client will try the other server.
        else if (shExpMatch(host, &quot;*.com&quot;))
                return &quot;PROXY proxy1.domain.com:8080; PROXY proxy2.domain.com:8081; DIRECT&quot;;
        return &quot;PROXY proxy2.domain.com:8081; PROXY proxy1.domain.com:8080; DIRECT&quot;;
}
</PRE>
</P>

<P>I made sure every client domain has the appropriate 'proxy' entry.
The clients are automatically configured with two nameservers using
DHCP.</P>
<P>
<BLOCKQUOTE>
--
<A HREF="mailto:RvdOever@baan.nl">Rodney van den Oever</A></BLOCKQUOTE>
</P>



<H2><A NAME="ss5.5">5.5 Microsoft Internet Explorer configuration</A></H2>

<P>Select <B>Options</B> from the <B>View</B>
menu.  Click on the <B>Connection</B> tab.  Tick the
<B>Connect through Proxy Server</B> option and hit the
<B>Proxy Settings</B> button.  For each protocol that
your Squid server supports (by default, HTTP, FTP, and gopher)
enter the Squid server's hostname or IP address and put the HTTP
port number for the Squid server (by default, 3128) in the
<B>Port</B> column.  For any protocols that your Squid
does not support, leave the fields blank.</P>
<P>Here is a
<A HREF="/Squid/FAQ/msie.jpg">screen shot</A> of the Internet Explorer proxy
configuration screen.</P>
<P>Microsoft is also starting to support Netscape-style JavaScript
automated proxy configuration.  As of now, only MSIE version 3.0a
for Windows 3.1 and Windows NT 3.51 supports this feature (i.e.,
as of version 3.01 build 1225 for Windows 95 and NT 4.0, the feature
was not included).</P>
<P>If you have a version of MSIE that does have this feature, elect
<B>Options</B> from the <B>View</B> menu.
Click on the <B>Advanced</B> tab.  In the lower left-hand
corner, click on the <B>Automatic Configuration</B>
button.  Fill in the URL for your JavaScript file in the dialog
box it presents you.  Then exit MSIE and restart it for the changes
to take effect.  MSIE will reload the JavaScript file every time
it starts.</P>


<H2><A NAME="ss5.6">5.6 Netmanage Internet Chameleon WebSurfer configuration</A></H2>

<P>Netmanage WebSurfer supports manual proxy configuration and exclusion
lists for hosts or domains that should not be fetched via proxy
(this information is current as of WebSurfer 5.0).  Select
<B>Preferences</B> from the <B>Settings</B>
menu.  Click on the <B>Proxies</B> tab.  Select the
<B>Use Proxy</B> options for HTTP, FTP, and gopher.  For
each protocol that enter the Squid server's hostname or IP address
and put the HTTP port number for the Squid server (by default,
3128) in the <B>Port</B> boxes.  For any protocols that
your Squid does not support, leave the fields blank.</P>
<P>Take a look at this
<A HREF="/Squid/FAQ/netmanage.jpg">screen shot</A>
if the instructions confused you.</P>
<P>On the same configuration window, you'll find a button to bring up
the exclusion list dialog box, which will let you enter some hosts
or domains that you don't want fetched via proxy.  It should be
self-explanatory, but you might look at this
<A HREF="/Squid/FAQ/netmanage-exclusion.jpg">screen shot</A>
just for fun anyway.</P>


<H2><A NAME="ss5.7">5.7 Opera 2.12 proxy configuration</A></H2>

<P>Select <EM>Proxy Servers...</EM> from the <EM>Preferences</EM> menu.  Check each
protocol that your Squid server supports (by default, HTTP, FTP, and
Gopher) and enter the Squid server's address as hostname:port (e.g.
mycache.example.com:3128 or 123.45.67.89:3128).  Click on <EM>Okay</EM> to accept the
setup.</P>

<P>Notes:
<UL>
<LI>Opera 2.12 doesn't support gopher on its own, but requires a proxy; therefore 
Squid's gopher proxying can extend the utility of your Opera immensely.</LI>
<LI>Unfortunately, Opera 2.12 chokes on some HTTP requests, for example 
<A HREF="http://spam.abuse.net/spam/">abuse.net</A>.
At the moment I think it has something to do with cookies.  If you have
trouble with a site, try disabling the HTTP proxying by unchecking
that protcol in the <EM>Preferences</EM>|<EM>Proxy Servers...</EM> dialogue.  Opera will
remember the address, so reenabling is easy.</LI>
</UL>
</P>
<P>
<BLOCKQUOTE>
--
<A HREF="mailto:hclsmith@tallships.istar.ca">Hume Smith</A></BLOCKQUOTE>
</P>


<H2><A NAME="ss5.8">5.8 How can I make my users' browsers use my cache without configuring the browsers for proxying?</A></H2>

<P>You can do transparent caching on Linux, Solaris, and BSD derivations.  The trick
is to get the operating system to forward certain IP packets 
to the application.  This document currently contains only instruction
for configuring transparent caching on Linux and Solaris.</P>

<P>Here are the important settings in <EM>squid.conf</EM>:
<PRE>
        http_port               3128
        icp_port                3130
        httpd_accel             virtual 3128
        httpd_accel_with_proxy  on
</PRE>
</P>

<P>Note, <B>virtual</B> is the magic word here!  You don't necessarily need to use port
80, but the examples below assume that you will.</P>

<H3>Transparent proxying for Solaris, SunOS, and BSD systems</H3>

<P>See the
<A HREF="http://cheops.anu.edu.au/~avalon/ip-filter.html">IP Filter package</A> pages.</P>

<H3>Transparent proxying for Linux</H3>

<P>by 
<A HREF="mailto:Rodney.van.den.Oever@tip.nl">Rodney van den Oever</A></P>

<P><B>Note:</B> Transparent proxying does NOT work with Linux&nbsp2.0.30!
Linux&nbsp2.0.29 is known to work well.</P>

<P><B>Warning:</B> this technique has several significant shortcomings!
<OL>
<LI><B>The <EM>access.log</EM> will not show hostnames in the URLs.</B></LI>
<LI>Instead it prints raw IP addresses.  This is because the
destination address is determined with the <CODE>getsockname(2)</CODE>
system call.  This means the use of a parent or sibling doesn't
work correctly anymore.  The parent or sibling itself logs the URL
by name not by IP address.  These URLs are different so no cache
HIT occurs.  This means that you lose the benefit of reducing
traffic in a caching hierarchy if you do transparent caching.</LI>
<LI><B>This method only supports the HTTP protocol, not gopher or FTP</B></LI>
<LI>Since the browser wasn't set up to use a proxy server, it uses
the FTP protocol (with destination port 21) and not the required
HTTP protocol.  You can't setup a redirection-rule to the proxy
server since the browser is speaking the wrong protocol.  A similar
problem occurs with gopher.  Normally all proxy requests are
translated by the client into the HTTP protocol, but since the
client isn't aware of the redirection, this never happens.</LI>
</OL>
</P>

<P>If you can live with the side-effects, go ahead and compile your
kernel with firewalling and redirection support.  Here are the
important parameters from <EM>/usr/src/linux/.config/</EM>:</P>
<P>
<PRE>
        #
        # Code maturity level options
        #
        CONFIG_EXPERIMENTAL=y
        #
        # Networking options
        #
        CONFIG_FIREWALL=y
        # CONFIG_NET_ALIAS is not set
        CONFIG_INET=y
        CONFIG_IP_FORWARD=y
        # CONFIG_IP_MULTICAST is not set
        CONFIG_IP_FIREWALL=y
        # CONFIG_IP_FIREWALL_VERBOSE is not set
        CONFIG_IP_MASQUERADE=y
        CONFIG_IP_TRANSPARENT_PROXY=y
        CONFIG_IP_ALWAYS_DEFRAG=y
        # CONFIG_IP_ACCT is not set
        CONFIG_IP_ROUTER=y
</PRE>
</P>

<P>Go to the
<A HREF="http://www.xos.nl/linux/ipfwadm/">Linux IP Firewall and Accounting</A> page,
obtain the source distribution to <EM>ipfwadm</EM> and install it.
Older versions of <EM>ipfwadm</EM> may not work.  You might need
at least version <B>2.3.0</B>.
You'll use <EM>ipfwadm</EM> to setup the redirection rules.  I
added this rule to the script that runs from <EM>/etc/rc.d/rc.inet1/</EM>
(Slackware) which sets up the interfaces at boot-time. The redirection
should be done before any other Input-accept rule.  To really make
sure it worked I disabled the forwarding (masquerading) I normally
do.</P>
<P><EM>/etc/rc.d/rc.firewall/</EM>:</P>
<P>
<PRE>
        #!/bin/sh
        # rc.firewall   Linux kernel firewalling rules
        FW=/sbin/ipfwadm

        # Flush rules, for testing purposes
        for i in I O F # A      # If we enabled accouting too
        do
                ${FW} -$i -f
        done

        # Default policies:
        ${FW} -I -p rej         # Incoming policy: reject (quick error)
        ${FW} -O -p acc         # Output policy: accept
        ${FW} -F -p den         # Forwarding policy: deny

        # Input Rules:

        # Loopback-interface (local access, eg, to local nameserver):
        ${FW} -I -a acc -S localhost/32 -D localhost/32

        # Local Ethernet-interface:
    
        # Redirect to Squid proxy server:
        ${FW} -I -a acc -P tcp -D default/0 80 -r 80

        # Accept packets from local network:
        ${FW} -I -a acc -P all -S localnet/8 -D default/0 -W eth0

        # Only required for other types of traffic (FTP, Telnet):

        # Forward localnet with masquerading (udp and tcp, no icmp!):
        ${FW} -F -a m -P tcp -S localnet/8 -D default/0
        ${FW} -F -a m -P udp -S localnet/8 -D default/0
</PRE>
</P>

<P>Here all traffic from the local LAN with any destination gets redirected to
the local port 80.  Rules can be viewed like this:
<PRE>
        IP firewall input rules, default policy: reject
        type  prot source               destination          ports
        acc   all  127.0.0.1            127.0.0.1            n/a
        acc/r tcp  10.0.0.0/8           0.0.0.0/0            * -&gt; 80 =&gt; 80
        acc   all  10.0.0.0/8           0.0.0.0/0            n/a
        acc   tcp  0.0.0.0/0            0.0.0.0/0            * -&gt; *
</PRE>
</P>

<P>I did some testing on Windows 95 with both Microsoft Internet
Explorer 3.01 and Netscape Communicator pre-release and it worked
with both browsers with the proxy-settings disabled.</P>

<P>At one time <EM>squid</EM> seemed to get in a loop when I pointed the
browser to the local port 80.  But this could be avoided by adding a
reject rule for client to this address:
<PRE>
        ${FW} -I -a rej -P tcp -S localnet/8 -D hostname/32 80

        IP firewall input rules, default policy: reject
        type  prot source               destination          ports
        acc   all  127.0.0.1            127.0.0.1            n/a
        rej   tcp  10.0.0.0/8           10.0.0.1             * -&gt; 80
        acc/r tcp  10.0.0.0/8           0.0.0.0/0            * -&gt; 80 =&gt; 80
        acc   all  10.0.0.0/8           0.0.0.0/0            n/a
        acc   tcp  0.0.0.0/0            0.0.0.0/0            * -&gt; *
</PRE>
</P>

<P><EM>NOTE on resolving names</EM>:  Instead of just
passing the URLs to the proxy server, the browser itself has to
resolve the URLs.  Make sure the workstations are setup to query
a local nameserver, to minimize outgoing traffic.</P>
<P>If you're already running a nameserver at the firewall or proxy server
(which is a good idea anyway IMHO) let the workstations use this
nameserver.</P>

<P>Additional notes from
<A HREF="mailto:RichardA@noho.co.uk">Richard Ayres</A></P>
<P>
<BLOCKQUOTE>
<P>I'm using such a setup. The only issues so far have been that:</P>
<P>
<OL>
<LI>It's fairly useless to use my service providers parent caches
(cache-?.www.demon.net) because by proxying squid only sees IP addresses,
not host names and demon aren't generally asked for IP addresses by other
users;
</LI>
<LI>Linux kernel 2.0.30 is a no-no as transparent proxying is broken (I use
2.0.29);
</LI>
<LI>Client browsers must do host name lookups themselves, as they don't know
they're using a proxy;
</LI>
<LI>The Microsoft Network won't authorize its users through a proxy, so I
have to specifically *not* redirect those packets (my company is a MSN
content provider).</LI>
</OL>
</P>
<P>Aside from this, I get a 30-40% hit rate on a 50MB cache for 30-40 users and
am quite pleased with the results.</P>
</BLOCKQUOTE>
</P>

<H3>Transparent proxying with Cisco</H3>

<P>by 
<A HREF="mailto:John.Saunders@scitec.com.au">John Saunders</A></P>

<P>This works with at least IOS 11.1 and later I guess. Possibly earlier,
as I'm no CISCO expert I can't say for sure. If your router is doing
anything more complicated that shuffling packets between an ethernet
interface and either a serial port or BRI port, then you should work
through if this will work for you.</P>

<P>First define a route map with a name of proxy-redirect (name doesn't
matter) and specify the next hop to be the machine Squid runs on.
<PRE>
        !
        route-map proxy-redirect permit 10
         match ip address 110
         set ip next-hop 203.24.133.2
        !
</PRE>

Define an access list to trap HTTP requests. The first line allows
the Squid host direct access so an routing loop is not formed.
<PRE>
        !
        access-list 110 deny   tcp host 203.24.133.2 any eq www
        access-list 110 permit tcp any any eq www
        !
</PRE>

Apply the route map to the ethernet interface.
<PRE>
        !
        interface Ethernet0
         ip policy route-map proxy-redirect
        !
</PRE>
</P>

<H3>Transparent proxying with LINUX 2.0.29 and CISCO IOS 11.1</H3>

<P>Just for kicks, here's an email message posted to squid-users
on how to make transparent proxying work with a Cisco router
and Squid running on Linux.</P>

<P>by 
<A HREF="mailto:signal@shreve.net">Brian Feeny</A></P>

<P>Here is how I have Transparent proxying working for me, in an enviroment
where my router is a Cisco 2501 running IOS 11.1, and Squid machine is
running Linux 2.0.33.</P>

<P>Many thanks to the following individules and the squid-users list for
helping me get redirection and transparent proxying working on my
Cisco/Linux box.</P>
<P>
<UL>
<LI>Lincoln Dale    </LI>
<LI>Riccardo Vratogna</LI>
<LI>Mark White       </LI>
<LI>Henrik Nordstrom </LI>
</UL>
</P>

<P>First, here is what I added to my Cisco, which is running IOS 11.1.  In
IOS 11.1 the route-map command is "process switched" as opposed to the
faster "fast-switched" route-map which is found in IOS 11.2 and later.
You may wish to be running IOS 11.2.  I am running 11.1, and have had no
problems with my current load of about 150 simultaneous connections to
squid.:
<PRE>
        !
        interface Ethernet0
         description To Office Ethernet
         ip address 208.206.76.1 255.255.255.0
         no ip directed-broadcast
         no ip mroute-cache
         ip policy route-map proxy-redir
        !
        access-list 110 deny   tcp host 208.206.76.44 any eq www
        access-list 110 permit tcp any any eq www
        route-map proxy-redir permit 10
         match ip address 110
         set ip next-hop 208.206.76.44
</PRE>
</P>

<P>So basically from above you can see I added the "route-map" declaration,
and an access-list, and then turned the route-map on under int e0 "ip
policy route-map proxy-redir"</P>

<P>ok, so the Cisco is taken care of at this point.  The host above:
208.206.76.44, is the ip number of my squid host.</P>

<P>My squid box runs Linux, so I had to do the following on it:</P>

<P>my kernel (2.0.33) config looks like this:
<PRE>
        #
        # Networking options
        #
        CONFIG_FIREWALL=y
        # CONFIG_NET_ALIAS is not set
        CONFIG_INET=y
        CONFIG_IP_FORWARD=y
        CONFIG_IP_MULTICAST=y
        CONFIG_SYN_COOKIES=y
        # CONFIG_RST_COOKIES is not set
        CONFIG_IP_FIREWALL=y
        # CONFIG_IP_FIREWALL_VERBOSE is not set
        CONFIG_IP_MASQUERADE=y
        # CONFIG_IP_MASQUERADE_IPAUTOFW is not set
        CONFIG_IP_MASQUERADE_ICMP=y
        CONFIG_IP_TRANSPARENT_PROXY=y
        CONFIG_IP_ALWAYS_DEFRAG=y
        # CONFIG_IP_ACCT is not set
        CONFIG_IP_ROUTER=y
</PRE>
</P>

<P>You will need Firewalling and Transparent Proxy turned on at a minimum.</P>

<P>Then some ipfwadm stuff:
<PRE>
        # Accept all on loopback
        ipfwadm -I -a accept -W lo
        # Accept my own IP, to prevent loops (repeat for each interface/alias)
        ipfwadm -I -a accept -P tcp -D 208.206.76.44 80
        # Send all traffic destinated to port 80 to Squid on port 3128
        ipfwadm -I -a accept -P tcp -D 0/0 80 -r 3128
</PRE>
</P>
<P>it accepts packets on port 80 (redirected from the Cisco), and redirects
them to 3128 which is the port my squid process is sitting on.  I put all
this in /etc/rc.d/rc.local</P>

<P>I am using 
<A HREF="/Squid/1.1/1.1.20/">v1.1.20 of Squid</A> with 
<A HREF="http://hem.passagen.se/hno/squid/squid-1.1.20.host_and_virtual.patch">Henrik's patch</A>
installed.  You will want to install this patch if using a setup similar
to mine.</P>



<HR>
<A HREF="FAQ-4.html">Previous</A>
<A HREF="FAQ-6.html">Next</A>
<A HREF="FAQ.html#toc5">Table of Contents</A>
</BODY>
</HTML>