SQUID CHasto zadavaemye voprosy --------------------------------------------------------------- Original etogo teksta raspolozhen na stranice http://www.atals.net.ru/Squid-faq.html ก http://www.atals.net.ru/Squid-faq.html ---------------------------------------------------------------
Squid - eto keshiruyushchij proksi server, yavlyayushchijsya, na nash vzglyad, naibolee prodvinutym iz svobodno rasprostranyaemyh proksi serverov. |to perevod FAQ po etomu serveru. Nedavno poyavilas' novaya versiya etogo dokumenta. Tem ne menee etot perevod soderzhit otvety na bol'shinstvo vazhnyh voprosov po Squid.
Prisylajte vashi zamechaniya i predlozheniya na ilgam@atlas.net.ru

Perevod na russkij yazyk - Vasil'ev Il'gam, Atlas Netvorks, Copyright © 1997

CHasto zadavaemye voprosy

1 O Squid, etot FAQ, i drugaya informaciya po Squid

1.1 CHto takoe Squid?

Squid eto vysokoproizvoditel'nyj keshiruyushchij proksi dlya web klientov, podderzhivayushchij ftp, gopher, i http. V otlichii ot tradicionnyh keshiruyushchih programm, Squid vse zaprosy vypolnyaet kak odin, neblokiruemyj process vvoda/vyvoda. Squid sohranyaet chasto zaprashivaemye dannye v OZU, keshiruet DNS zaprosy, ne blokiruetsya pri vypolnenii DNS zaprosov, i ne keshiruet neudavshiesya zaprosy. Takzhe podderzhivaet SSL, rasshirennyj kontrol' dostupa i polnuyu registraciyu zaprosov. Ispol'zuya Internet Cache Protocol (ICP), keshi Squid mozhno raspolozhit' ierarhicheski dlya dopolnitel'nogo vyigrysha v propusknoj sposobnosti kanala.

Squid sostoit iz - osnovnoj programmy squid, programmy obrabotki DNS zaprosov dnsserver, programmy skachivaniya ftp dannyh ftpget, a takzhe nekotoryh instrumentov upravleniya. Kogda squid zapuskaetsya, on zapuskaet zadannoe chislo dnsserver-ov, kazhdyj iz kotoryh rabotaet samostoyatel'no, blokiruya tol'ko DNS zaprosy. Takim obrazom umen'shaetsya obshchee vremya ozhidaniya otveta DNS.

Squid beret svoe nachalo s osnovannogo ARPA proekta Harvest. http://harvest.cs.colorado.edu/

1.2 CHto takoe keshirovanie obฎektov internet?

|to sposob hraneniya zaproshennyh iz Internet obฎektov (naprimer, dannyh dostupnyh po http, ftp i gopher protokolam) na servere, nahodyashchemsya blizhe k zaprashivayushchemu komp'yuteru nezheli ishodnyj. Brauzery mogut potom ispol'zovat' Squid kesh kak http proksi-server, umen'shaya kak vremya dostupa, tak i zagruzku kanala.

1.3 Pochemu Squid?

Harris' Lament otvechaet, "All the good ones are taken." - "Vse luchshie nazvaniya uzhe rashvatali"

Nam nuzhno bylo kak-to otlichat'sya ot kesha Harvest. Squid bylo kodovoe nazvanie na nachal'noj stadii razrabotki, a potom ono priliplo.

1.4 Kakaya poslednyaya versiya Squid?

Squid obnovlyaetsya chasto; o poslednih izmeneniyah smotrite zdes' http://squid.nlanr.net/Squid/

1.5 Kto avtor Squid?

Squid eto rezul'tat usilij neskol'kih lyudej iz soobshchestva Internet. Vozglavlyaet proekt Duane Wessels iz National Laboratory for Applied Network Research (osnovannoj National Science Foundation).

1.6 Gde mozhno vzyat' Squid?

Vy mozhete vzyat' po ftp zdes':
ftp://squid.nlanr.net/pub/.
Takzhe mnogo zerkal po vsemu miru:
http://squid.nlanr.net/Squid/mirrors.html

1.7 Gde podpisat'sya na spisok rassylki Squid?

Arhivy razlichnyh spiskov rassylki dostupny na http://squid.nlanr.net/Mail-Archive/squid-users/

1.8 Web stranicy posvyashchennye Squid.

Zdes' informaciya po programme Squid http://squid.nlanr.net/Squid/, a zdes' http://www.nlanr.net/Cache/ dopolnitel'naya informaciya po keshirovaniyu voobshche.

1.9 Kakoj oficial'nyj status Squid?

Iz distributiva Squid, fajl README:
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.š See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

1.10 Rasprostraniteli Squid FAQ

Jonathan Larmour <JLarmour@origin-at.co.uk>
Cord Beermann <cord@cc.fh-lippe.de>
Tony Sterrett <tony@nlanr.net>
Gerard Hynes <ghynes@compusult.nf.ca>
<tkatayam@pi.titech.ac.jp>
Duane Wessels <wessels@nlanr.net>
K Claffy <kc@nlanr.net>
Paul Southworth <pauls@etext.org>

Pozhalujsta shlite ispravleniya, obnovleniya i kommentarii na: squid-faq@nlanr.net.


2 Installyaciya

2.1 Kakie fajly sleduet brat'?

Neobhodimo skachat' arhiv ishodnikov sleduyushchego vida squid-x.y.z-src.tar.gz (naprimer, squid-1.1.6-src.tar.gz) s http://squid.nlanr.net/Squid/. Soderzhanie razlichij mezhdu versiyami dostupno dlya apgrejda, kotorye primenyayutsya programmoj patch, kotoruyu mozhno vzyat' zdes' ftp://prep.ai.mit.edu/pub/gnu/.

2.2 Kak mne ustanovit' Squid?

Prezhde vsego neobhodimo raspakovat' ishodnyj arhiv, sleduyushchim obrazom:

% gzip -dc squid-x.y.z-src.tar.gz | tar xvf -

Zatem nuzhno otkonfigurirovat', otkompilirovat' i ustanovit'

% cd squid-x.y.z
% ./configure
% make all
% make install

Luchshe vsego ispol'zovat' GNU C (gcc) kompilyator. Poslednie versii imeyut format ANSI C, tak chto starye kompilyatory mogut ne rabotat'. GNU C kompilyator dostupen na ftp://prep.ai.mit.edu/pub/gnu/. Mozhno zadat' neskol'ko parametrov konfiguracionnogo skripta. Naibolee poleznyj --prefix dlya ustanovki v druguyu direktoriyu. Po umolchaniyu eto /usr/local/squid.CHtoby pomenyat' sleduet sdelat' sleduyushchee:

% cd squid-x.y.z
% ./configure --prefix=/some/other/directory/squid

2.3 Na kakih operacionnyh sistemah rabotaet Squid?

|to PO razrabatyvalos' dlya raboty na lyubyh sovremennyh Unix sistemah, i izvestno chto rabotaet na AIX, FreeBSD, HP-UX, IRIX, Linux, OSF/1, Solaris, i SunOS. Esli Vy obnaruzhili specifichnye dlya dannoj platformy problemy, pozhalujsta dajte nam znat' po email: squid-bugs@nlanr.net.

2.4 Dlya chego nuzhen fajl squid.conf?

Fajl squid.conf zadaet konfiguraciyu squid. Konfiguraciya vklyuchaet v sebya (no ne ogranichivaetsya etim) nomer porta HTTP , nomer porta dlya ICP zaprosov, prihodyashchie i ishodyashchie zaprosy, informaciyu o dostupe k brandmaueru, i znacheniya razlichnyh tajmautov.

2.5 A est' li primer squid.conf?

Da, posle togo kak Vy uspeshno prodelali make install, primer fajla squid.conf budet nahodit'sya v poddirektorii "etc" instalyacionnoj direktorii Squid. Primer squid.conf soderzhit kommentarii obฎyasnyayushchie kazhduyu opciyu.

2.6 Kak mne zapustit' squid?

Posle redaktirovaniya konfiguracionnogo fajla, mozhno zapustit' squid iz skripta RunCache. Esli Vy ustanavlivali v direktoriyu po umolchaniyu to komanda dlya zapuska budet sleduyushchej:

/usr/local/squid/bin/RunCache &

2.7 Kak mne uznat' chto Squid zapushchen?

Dlya etogo est' programma client:

% client http://www.netscape.com/ > test

Sushchestvuyut i drugie HTTP programmy-klienty rabotayushchie v komandnoj stroke. |ti dve Vy mozhete najti poleznymi:url_get, po adresu ftp://ftp.pasteur.fr/pub/Network/url_get/, iechoping, po adresu ftp://ftp.pasteur.fr/pub/Network/echoping/. Takzhe prover'te naibolee vazhnye fajly access.log icache.log.

2.8 Kak ispol'zovat' patchi?

Neobhodima programma patch. Obychno dostatochno:
ššš cd squid-1.1.x
ššš patch < /tmp/fixes.patch

No vremya ot vremeni mogut popadat'sya patchi sozdannye iz direktorii 'src', togda nuzhno:
ššš cd squid-1.1.x/src
ššš patch < /tmp/fixes.patch

Esli programma patch budet chem-to nedovol'na i budet otkazyvat'sya rabotat' nado budet vzyat' bolee novuyu versiyu, naprimer zdes' GNU FTP site.š






3 Konfigurirovanie

3.1 Kak sdelat' ierarhiyu proksi?

CHtoby razmestit' kesh v ierarhii, nuzhno vospol'zovat'sya cache_host direktivoj v squid.conf, chtoby ukazat' roditel'skij i bratskij (ili sestrinskij :) - t.e. odnogo urovnya) uzel.

Naprimer, privedennyj nizhesquid.conf na childcache.example.com skonfigurirovan tak, chto ego kesh poluchaet dannye s odnogo roditel'skogo i s dvuh bratskih keshej:

ššššššš #š squid.conf - On the host: childcache.example.com
ššššššš #
ššššššš #š Format is: hostnameš typeš http_portš udp_port
ššššššš #
ššššššš cache_host parentcache.example.comšš parentš 3128 3130
ššššššš cache_host childcache2.example.comšš sibling 3128 3130
ššššššš cache_host childcache3.example.comšš sibling 3128 3130
Direktiva cache_host_domain pozvolyaet ukazyvat' dlya kazhdogo domena kak bratskij, tak i roditel'skij kesh:
ššššššš #š squid.conf - On the host: sv.cache.nlanr.net
ššššššš #
ššššššš #š Format is: hostnameš typeš http_portš udp_port
ššššššš #

ššššššš cache_host electraglide.geog.unsw.edu.au parent 3128 3130
ššššššš cache_host cache1.nzgate.net.nzššššššššš parent 3128 3130
ššššššš cache_host pb.cache.nlanr.netšš parent 3128 3130
ššššššš cache_host it.cache.nlanr.netšš parent 3128 3130
ššššššš cache_host sd.cache.nlanr.netšš parent 3128 3130
ššššššš cache_host uc.cache.nlanr.netšš sibling 3128 3130
ššššššš cache_host bo.cache.nlanr.netšš sibling 3128 3130
ššššššš cache_host_domain electraglide.geog.unsw.edu.au .au
ššššššš cache_host_domain cache1.nzgate.net.nzšš .au .aq .fj .nz
ššššššš cache_host_domain pb.cache.nlanr.netšššš .uk .de .fr .no .se .it
ššššššš cache_host_domain it.cache.nlanr.netšššš .uk .de .fr .no .se .it
ššššššš cache_host_domain sd.cache.nlanr.netšššš .mx .za .mu .zm
Vysheprivedennaya konfiguraciya opisyvaet, chto kesh budet ispol'zovat' pb.cache.nlanr.net i it.cache.nlanr.net dlya domenov uk, de, fr, no, se i it, sd.cache.nlanr.net dlya domenov mx, za, mu i zm, i cache1.nzgate.net.nz dlya domenov au, aq, fj, i nz.

3.2 Kak mne podklyuchit'sya k ierarhii NLANR?

Sushchestvuet prostoj nabor pravil podklyucheniya k ierarhii keshej NLANR.

3.3 Pochemu ya dolzhen podklyuchat'sya k ierarhii NLANR?

Ierarhiya NLANR mozhet yavlyat'sya nachal'nym istochnikom roditel'skih i bratskih keshej. Podklyuchenie k sisteme global'nyh keshej NLANR chashche vsego soprovozhdaetsya povysheniem proizvoditel'nosti.

3.4 Kak mne zaregistrirovat' svoj kesh na NLANR?

Prosto vklyuchite eti opcii v svoem squid.conf i vse:
cache_announce 24
announce_to sd.cache.nlanr.net:3131

Primechanie: anonsirovanie kesha eto ne tozhe samoe chto vstuplenie v ierarhiyu NLANR. Vy mozhete vstupit' v ierarhiyu NLANR bez registracii, i mozhno zaregistrirovat'sya bez vstupleniya v ierarhiyu keshej NLANR.

3.5 Kak mne najti blizhajshie ko mne keshi i organizovat' roditel'skie/dochernie/bratskie otnosheniya s nimi?

Posetite NLANR registraconnuyu BD keshej i poishchite blizhajshij. Da, i pomnite, chto esli kesh zaregistrirovan v baze eto eshche ne znachit chto on zahochet byt' Vashim roditelem/docher'yu/bratom. No sprosit' vsegda mozhno...

3.6 CHto takoe rezhim httpd-uskoritelya?

CHasto lyudi ispytyvayut trudnosti v ponimanii uskoritelej i keshiruyushchih proksi, obychno privodyashchih k putanice v ponimanii "prihodyashchih" i "ishodyashchih" dannyh. Rassmotrim eto v terminah zaprosov (naprimer, ishodyashchij zapros - eto s lokal'noj mashiny v bol'shoj plohoj Internet) Dannye prinimaemye v otvet - eto prihodyashchij. Obratnyj smysl poluchaetsya esli ego rassmatrivat' kak "zapros dlya prihodyashchih dannyh".

Uskoritel' keshiruet prihodyashchie zaprosy dlya ishodyashchih dannyh (naprimer, teh chto Vy opublikovali na svoem servere). Tem samym on zabiraet zagruzku s Vashego HTTP servera i vnutrennej seti. Vy ubiraete server s 80 porta (ili kakoj on u Vas tam), i podstavlyaete uskoritel', kotoryj probrasyvaet HTTP dannye s "real'nogo" HTTP servera (tol'ko uskoritel' dolzhen znat' gde real'nyj server). Vneshnij mir ne vidit ni kakoj raznicy (krome razve uvelicheniya skorosti dostupa).

Krome razgruzki real'nogo web servera, uskoritel' mozhet nahodit'sya snaruzhi brandmauera ili lyubogo drugogo uzkogo mesta v seti i obshchat'sya s HTTP serverami vnutri, umen'shaya traffik cherez uzkoe mesto i uproshchaya konfiguraciyu. Dva ili bolee uskoritelya soedinennye cherez ICP mogut uvelichit' skorost' i ustojchivost' web servera k lyubomu odinochnomu sboyu.

Redirektor Squid mozhet zastavit' uskoritel' rabotat' kak odnu svyaznuyu mashinu dlya neskol'kih serverov. Esli Vam nuzhno perenesti chasti Vashej fajlovoj sistemy s odnogo servera na drugoj, ili esli otdel'no administriruemye HTTP servera dolzhny logicheski poyavlyat'sya pod edinoj URL ierarhiej, uskoritel' sdelaet eto.

Esli Vy hotite lish' keshirovat' "ostal'noj mir" dlya uvelicheniya effektivnosti dostupa lokal'nyh pol'zovatelej v Internet, to rezhim uskoritelya sleduet otklyuchit'. Kompanii, kotorye derzhat svoj web-server ispol'zuyut uskoritel' dlya povysheniya effektivnosti dostupa k nemu. Te zhe, komu vazhen effektivnyj dostup lokal'nyh pol'zovatelej v Internet ispol'zuyut keshiruyushchij proksi. Mnogie, i my v tom chisle pol'zuyutsya i tem i etim.

Sravnenie kesha Squid i ego analoga Harvest pokazyvaet uvelichenie na poryadok proizvoditel'nosti pervogo po sravneniyu s CERN i drugimi shiroko rasprostrannenymi keshiruyushchimi programmami. |to preimushchestvo pozvolyaet keshu rabotat' kak httpd uskoritelyu, keshu skonfigurirovannomu kak glavnyj web-server (na 80 portu), perenapravlyaya nepravil'nye ssylki na real'nyj httpd (na 81 port).

V takoj konfiguracii administrator web uzla perenosit vse ne podlezhashchie keshirovaniyu URL na 81 port httpd. Kesh obsluzhivaet ssylki na keshiruemye obฎekty, takie kak HTML stranicy i GIF-y, a real'nyj httpd (na 81 portu) - vse nekeshiruemye, naprimer zaprosy i cgi-bin programmy. Esli pol'zovanie serverom napryamuyu zavisit ot keshiruemyh obฎektov, to takaya konfiguraciya mozhet sushchestvenno snizit' zagruzku web-servera.

Pri etom pomnite, chto luchshe vsego ne zapuskat' squid kak httpd-uskoritel' i kak keshiruyushchij proksi odnovremenno, tak kak oni imeyut razlichnye rabochie rezhimy. Bolee vysokuyu proizvoditel'nost' Vy poluchite zapuskaya ih na raznyh mashinah. Vse zhe Squid mozhet odnovremenno rabotat' i kak httpd-uskoritel' i kak keshiruyushchij proksi, esli naprotiv httpd_accel_with_proxy Vy postavite on v svoem squid.conf.

3.7 Kak mne zadat', chtoby Squid rabotal za brandmauerom?

Kogda Vy nahodites' za brandmauerom Vy ne mozhete napryamuyu soedinyat'sya s vneshnim mirom, tak chto neobhodimo ispol'zovat' roditel'skij kesh. Squid ne ispol'zuet ICP zaprosy esli on za brandmauerom, ili esli tol'ko odin roditel'.

Nuzhno vospol'zovat'sya direktivoj inside_firewall v squid.conf chtoby zadat' spisok vnutrennih po otnosheniyu k brandmaueru domenov. Naprimer:

inside_firewall example.com

Mozhno zadat' neskol'ko:

inside_firewall example.com example.org example.net

Ispol'zovanie inside_firewall privodit k dvum putyam vybora servera. Obฎekty ne podpadayushchie ni pod odin iz perechislennyh domenov budut rassmatrivat'sya vne brandmauera. Dlya etogo zhe sluchaya:

V osobom sluchae mozhno ukazat' v kachestve domena none chtoby vse zaprosy obsluzhivalis' bratskimi ili roditel'skimi keshami.

3.8 U menya neskol'ko dnsserver processov, kotorye ne ispol'zuyutsya, mogu ya umen'shit' ih chislo v squid.conf?

Processy dnsserver ispol'zuyutsya squid iz-za togo, chto process preobrazovaniya imen hostov v IP-adresa (gethostbyname(3)) blokiruetsya (to est' etot process dolzhen dozhdat'sya otveta). Tak kak process squid odin, to kazhdyj, kto k obrashchaetsya k keshu dolzhen zhdat' kazhdyj raz vremya neobhodimoe na preobrazovanie. Vot pochemu dnsserver eto otdel'nyj process, tak chto on mozhet blokirovat'sya bez blokirovki samogo squid.

Poetomu ochen' vazhno chtoby bylo dostatochno dnsserver processov chtoby obrabotat' kazhdoe obrashchenie, v protivnom sluchaesquid mozhet neozhidanno povisat'. Na praktike nado opredelit' maksimal'noe chislo dnsserver-ov, kotorye mogut ponadobit'sya squid, i dobavit' eshche dva na vsyakij sluchaj. Drugimi slovami, esli Vy videli v rabote tol'ko tri dnsserver processa, ostav'te kak minimum pyat'. I pomnite, chtodnsserver malen'kij i pri prostoe osobo ne zagruzhaet sistemu.

3.9 My by hoteli ispol'zovat' Squid, no nam nuzhno ispol'zovat' socks dlya podklyucheniya k vneshnemu miru. Podderzhivaet li Squid Socks?

From: carson@lehman.com
Date: Sat, 25 Jan 1997 11:50:59 -0500
Subject: Re: SOCKS

CHtoby pol'zovat'sya socks5, ne trebuetsya nikak izmenenij koda Squid. Vse chto nado, eto dobavit' stroku -Dbind=SOCKSbind etc v stroku kompilyacii i -lsocks v stroku linkov.

3.10 Kak Squid reshaet kogda obnovit' obฎekt kesha?

Kolics Bertold sdelal prekrasnuyu blok-shemu izobrazhayushchuyu etot process.š

4 Squid i brauzery

Bol'shinstv dostupnyh web brauzerov podderzhivayut proksi i legko konfiguriruyutsya dlya podderzhki Squid v kachestve proksi. Nekotorye iz nih podderzhivayut rasshirennye vozmozhnosti takie kak spisok domenov ili URL shablony kotorye ne sleduet keshirovat', ili JavaScript dlya avtomaticheskoj nastrojki.

4.1 Ruchnaya nastrojka Netscape

Vyberite Network Preferences iz menyu Options. Na zakladke Proxies, shchelknite na Manual Proxy Configuration a zatem na knopke View. Dlya kazhdogo protokola kotoryj podderzhivaet Vash Squid (po umolchaniyu, HTTP, FTP, i gopher) vvedite imya ili IP adres Squid i nomer porta (po umolchaniyu 3128) v kolonke Port. Dlya teh protokolov, kotorye Vash Squid ne podderzhivaet ostav'te polya pustymi.

Zdes' vid ekrana ruchnoj nastrojki proksi Netscape Navigator.

4.2 Avtomaticheskaya nastrojka Netscape

Nastrojka proksi Netscape Navigator mozhet byt' atomatizirovana pri pomoshchi JavaScript (dlya versij Navigator 2.0 ili vyshe). Vyberite Network Preferences iz menyu Options. Na zakladke Proxies, shchelknite na Automatic Proxy Configuration i vpishite URL Vashego fajla JavaScript konfiguracii proksi.

Zdes' vid ekrana avtomaticheskoj nastrojki proksi Netscape Navigator. Vy takzhe mozhete obratit'sya k dokumentacii Netscape po sisteme konfiguracii proksi Navigator pri pomoshchi JavaScript po adresu http://home.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html

Zdes' primer avtokonfiguracii na JavaScript ot Oskar Pearson:

//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 "fiddling" 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 "internal" below.

//We also assume that your cache is called "cache.company.com", 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 "DIRECT";
ššššššššššš //These connect directly if the machine they are trying to
ššššššššššš //connect to starts with "intranet" - ie http://intranet
ššššššššššš //Connectš directly if it is intranet.*
ššššššššššš //If you have another machine that you want them to
ššššššššššš //access directly, replace "internal*" with that
ššššššššššš //machine's name
ššššššššššš if (shExpMatch( host, "intranet*")||
ššššššššššššššššššššššššššš shExpMatch(host, "internal*"))
ššššššššššššššš return "DIRECT";
ššššššššššš //Connect directly to our domains (NB for Important News)
ššššššššššš if (dnsDomainIs( host,"company.com")||
ššššššššššš //If you have another domain that you wish to connect to
ššššššššššš //directly, put it in here
ššššššššššššššššššššššššššš dnsDomainIs(host,"sistercompany.com"))
ššššššššššššššš return "DIRECT";
ššššššššššš //So the error message "no such host" will appear through the
ššššššššššš //normal Netscape box - less support queries :)
ššššššššššš if (!isResolvable(host))
ššššššššššššššššššš return "DIRECT";
ššššššššššš //We only cache http, ftp and gopher
ššššššššššš if (url.substring(0, 5) == "http:" ||
ššššššššššššššššššššššššššš url.substring(0, 4) == "ftp:"||
ššššššššššššššššššššššššššš url.substring(0, 7) == "gopher:")
ššššššššššš //Change the ":8080" to the port that your cache
ššššššššššš //runs on, and "cache.company.com" to the machine that
ššššššššššš //you run the cache on
ššššššššššššššššššš return "PROXY cache.company.com:8080; DIRECT";
ššššššššššš //We don't cache WAIS
ššššššššššš if (url.substring(0, 5) == "wais:")
ššššššššššššššššššš return "DIRECT";
ššššššššššš else
ššššššššššššššššššš return "DIRECT";
ššššššš }

4.3 Nastrojka Lynx i Mosaic

Dlya Mosaic i Lynx, nado zadat' peremennye okruzheniya pered zapuskom. Naprimer (dlya csh ili tcsh):

% setenv http_proxy http://mycache.example.com:3128/
% setenv gopher_proxy http://mycache.example.com:3128/
% setenv ftp_proxy http://mycache.example.com:3128/

Dlya Lynx nastrojki proksi mozhno sdelat' v fajle lynx.cfg. Pri takoj nastrojke vse pol'zovateli Lynx smogut pol'zovat'sya proksi bez dopolnitel'nogo zadaniya okruzheniya dlya kazhdogo pol'zovatelya. Naprimer:

ššššššš http_proxy:http://mycache.example.com:3128/
ššššššš ftp_proxy:http://mycache.example.com:3128/
ššššššš gopher_proxy:http://mycache.example.com:3128/

4.4 Nastrojka Microsoft Internet Explorer

Vyberite Options iz menyu View. SHCHelknite na zakladke Connection. Vyberite Connect through Proxy Server i nazhmite knopku Proxy Settings. Dlya kazhdogo protokola kotoryj podderzhivaet Vash Squid (po umolchaniyu, HTTP, FTP, i gopher) vvedite imya ili IP adres Squid i nomer porta (po umolchaniyu 3128) v kolonke Port. Te protokoly, kotorye Vash Squid ne podderzhivaet ostav'te zti polya pustymi.

Zdes' vid ekrana nastrojki proksi Internet Explorer.

Microsoft takzhe sobiraetsya podderzhivat' kak u Netscape avtomaticheskuyu nastrojku proksi cherez JavaScript. Sejchas, tol'ko MSIE versii 3.0a dlya Windows 3.1 i Windows NT 3.51 podderzhivaet etu vozmozhnost' (naprimer, v versii 3.01 build 1225 dlya Windows 95 i NT 4.0, ee net).

Esli Vasha versiya MSIE podderzhivaet takuyu vozmozhnost', vyberite Options iz menyu View. SHCHelknite na zakladke Advanced i v levom nizhnem uglu shchelknite na knopke Automatic Configuration. Vpishite URL Vashego fajla JavaScript. Potom perezapustite MSIE. MSIE budet pereschityvat' fajl JavaScript kazhdyj raz pri zapuske.

4.5 Nastrojka Netmanage Internet Chameleon WebSurfer

Netmanage WebSurfer podderzhivaet ruchnuyu nastrojku proksi i spisok isklyuchenij hostov ili domenov ne podlezhashchih keshirovaniyu (informaciya po versii WebSurfer 5.0). Vyberite Preferences iz menyu Settings. SHCHelknite na zakladke Proxies. Vyberite opciyu Use Proxy dlya HTTP, FTP, i gopher. Zatem dlya kazhdogo protokola vvedite imya ili IP adres Squid i nomer porta (po umolchaniyu, 3128) v pole Port. Ostal'nye polya ostav'te pustymi.

Vid ekrana prilagaetsya.

V etom zhe okne est' knopka vyzyvayushchaya okno isklyuchenij, gde mozhno zadat' hosty ili domeny, kotrye ne nado keshirovat'. Zdes' vid ekrana.

4.6 Kak sdelat', chtoby pol'zovateli brauzerov pol'zovalis' keshem bez ih nastrojki?

Mozhno sdelat' prozrachnoe keshirovanie na Linux, Solaris, i BSD versiyah. Smysl v tom, chto operacionnaya sistema perenapravlyaet nekotorye IP pakety prilozheniyu. |tot dokument na dannyj moment soderzhit instrukcii po nastrojke prozrachnogo keshirovaniya na Linux i Solaris.

4.6.1 Prozrachnyj proksi dlya Solaris, SunOS, i BSD sistem

Ishchite zdes' http://cheops.anu.edu.au/~avalon/ip-filter.html

4.6.2 Prozrachnyj proksi dlya Linux

[Contributed by Rodney van den Oever <Rodney.van.den.Oever@tip.nl>]

Warning: this technique has several significant shortcomings!

V fajle access.log ne otobrazhayutsya imena hostov v URL.
Vmesto etogo pechatayutsya ishodnye IP adresa. |to iz-za togo, chto adres naznacheniya opredelyaetsya sistemnym vyzovom getsockname(2). |to znachit, chto roditel'skij ili bratskij kesh rabotayut ne korrektno. Sami eti keshi pishut v URL'e imena, a ne IP adresa. |ti URL'y raznye i ne proishodit popadaniya v kesh pri povtornom zaprose. |to znachit, chto Vy teryaete preimushchestvo ot ierarhicheskogo proksi, esli ispol'zuete prozrachnoe keshirovanie.
Dannyj metod podderzhivaet tol'ko HTTP protokol, i ne podderzhivaet gopher ili FTP
Tak kak v brauzere ne ustanovlena podderzhka proksi, to on ispol'zuet FTP protokol (s 21 portom naznacheniya), a ne trebuemyj HTTP. Nel'zya zadat' pravila perenapravleniya na proksi, tak kak brauzer ispol'zuet drugoj protokol. Ta zhe situaciya i s gopher. Obychno vse zaprosy k proksi transliruyutsya klientom v HTTP protokol, no raz klient nichego ne znaet o perenapravlenii, to nichego ne proishodit.
Esli Vas takaya situaciya ustraivaet, vpered k kompilyacii yadra s podderzhkoj brandmauera i perenapravleniya. Zdes' privedeny vazhnye parametry iz /usr/src/linux/.config:
ššš #
ššš # 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
Zdes' http://www.xos.nl/linux/ipfwadm/ voz'mite ishodniki ipfwadm i ustanovite ego. Ipfwadm ponadobitsya dlya zadaniya pravil perenapravleniya. YA dobavil eti pravila v skript zapuskaemyj iz /etc/rc.d/rc.inet1 (Slackware) kotoryj ustanavlivaet interfejs v moment zagruzki. Perenapravlenie dolzhno byt' zaversheno do zadaniya lyubyh vhodnyh pravil. CHtoby ubedit'sya, chto eto rabotaet ya otklyuchil forwarding (masquerading).

/etc/rc.d/rc.firewall:

#!/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


Ves' traffik lokal'noj seti s lyubym adresom naznacheniya perenapravlyaetsya na lokal'nyj 80 port. Pravila mozhno posmotret' i oni budut vyglyadet' kak-to tak:
ššš 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ššššššššššš * -> 80 => 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ššššššššššš * -> *
Zdes' vazhnye ustanovki v squid.conf:
ššš http_portšššššššššššššš 80
ššš icp_portššššššššššššššš 3130
ššš httpd_accelšššššššššššš virtual 80
ššš httpd_accel_with_proxyš on
Vnimanie, virtual eto magicheskoe slovo zdes'!

YA protestiroval na Windows 95 kak s Microsoft Internet Explorer 3.01 tak i Netscape Communicator i eto rabotaet s oboimi s otklyuchennymi ustanovkami proksi.

Odin raz squid kazhetsya zaciklilsya kogda ya ukazal brauzeru na lokal'nyj 80 port. No etogo mozhno izbezhat' dobaviv stroku:

ššš ${FW} -I -a rej -P tcp -S localnet/8 -D dec/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šššššššššššš * -> 80
ššš acc/r tcpš 10.0.0.0/8šššššššššš 0.0.0.0/0ššššššššššš * -> 80 => 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ššššššššššš * -> *
Zamechanie o preobrazovanii imen: Vmesto togo, chtoby prosto peredat' URL proksi, brauzer sam preobrazovyvaet ih. Udo