2008年11月23日 星期日

Settup a Squid proxy server which can be accessed by multiple IP domain

Proxy是很常見的服務,經常拿來作為建立連線分享控管之後,我們也可以藉由建立Proxy的方式,讓使用者存取另一條專線。在學術網路中,因為對國外頻寬不足,連線大陸或其他國家網站速度相當的慢,因此有申請另外一條中華電信的線路做備援或者是存取國外網站。

最基本的需求是兩張網路卡,一張連接Hinet線路,IP為158.95.100.100,另外一張則是連接學術網路140.120.1.100,同時我們希望140.120.1-4.0都能存取這台Proxy。

在這裡最大的問題是我們必須設定Hinet的Gateway為Default Gateway,這樣才能在學術網路出問題時由外連進學網內。但當我們設定Hinet為Default Gateway後,學術網路的IP變成Local IP Domain,只有同一IP Domain的才能存取,因此我們必須額外設定route連線至學網。

我們使用ubuntu server作為我們的OS。
先安裝squid http proxy
yum install squid

接著設定能夠存取這台Proxy的ACL
acl NCHU1 src 140.120.1.0/255.255.255.0
acl NCHU2 src 140.120.2.0/255.255.255.0
acl NCHU3 src 140.120.3.0/255.255.255.0
acl NCHU4 src 140.120.4.0/255.255.255.0

在設定允許允許這些IP能存取HTTP服務
http_access allow NCHU1
http_access allow NCHU2
http_access allow NCHU3
http_access allow NCHU4


最後需要設定啟動的網路設定腳本,檔案在/etc/network/interface
auto eth0
iface eth0 inet static
address 140.120.1.100
netmask 255.255.255.0
network 140.120.1.0
broadcast 140.120.1.255
dns-nameservers 140.120.1.2
dns-search nchu.edu.tw
up route add -net 140.120.2.0 netmask 255.255.255.0 gw 140.120.31.254 dev eth0
up route add -net 140.120.3.0 netmask 255.255.255.0 gw 140.120.31.254 dev eth0
up route add -net 140.120.4.0 netmask 255.255.255.0 gw 140.120.31.254 dev eth0
up route add -net 140.120.0.0 netmask 255.255.0.0 gw 140.120.31.254 dev eth0
up route add -net 140.0.0.0 netmask 255.0.0.0 gw 140.120.31.254 dev eth0

auto eth1
iface eth1 inet static
address 168.09.1.100
netmask 255.255.255.0
network 168.95.1.0
broadcast 168.95.1.255
gateway 168.95.1.254


接著設定Proxy.pac,讓校內之間的連線都不使用Proxy,存取各種期刊也不使用Proxy。
function FindProxyForURL(url, host)
{
reip = /^\d+\.\d+\.\d+\.\d+$/g;
if ((host == "localhost") ||
(shExpMatch(host, "localhost.*")) ||
(host == "127.0.0.1")) {
return "DIRECT";
}

else if (reip.test(host)) {
if( isInNet(host, "10.0.0.0", "255.0.0.0") ||
isInNet(host, "192.168.0.0", "255.255.0.0") ||
isInNet(host, "172.16.0.0", "255.240.0.0") )
return "DIRECT";
else if (isInNet(host, "140.120.0.0", "255.255.0.0"))
return "DIRECT";
}


else if( isInNet(myIpAddress(), "140.120.1.0", "255.255.255.0") ||
isInNet(myIpAddress(), "140.120.2.0", "255.255.255.0") ||
isInNet(myIpAddress(), "140.120.3.0", "255.255.255.0") ||
isInNet(myIpAddress(), "140.120.4.0", "255.255.255.0") )
{

if (isPlainHostName(host) ||
dnsDomainIs(host, ".edu.tw") ||
dnsDomainIs(host, ".com.tw") ||
dnsDomainIs(host, ".gov.tw") ||
dnsDomainIs(host, ".yahoo.com") ||
dnsDomainIs(host, ".yimg.com") ||
dnsDomainIs(host, ".hinet.net") ||
dnsDomainIs(host, ".acm.org") ||
dnsDomainIs(host, ".ieee.org")
)
return "DIRECT";

else if (
shExpMatch(host,"*.idealibrary.com") ||
shExpMatch(host,"*.ieee.org") ||
shExpMatch(host,"*.ihs.com") ||
shExpMatch(host,"*.academicpress.com") ||
shExpMatch(host,"*.apcatalog.com") ||
shExpMatch(host,"*.hbuk.co.uk") ||
shExpMatch(host,"*.harcourt.com") ||
shExpMatch(host,"*.mkp.com") ||
shExpMatch(host,"*.johnsmith.co.uk") ||
shExpMatch(host,"*.heffers.co.uk") ||
shExpMatch(host,"*.infolearning.com") ||
shExpMatch(host,"*.grolier.com") ||
shExpMatch(host,"*.shop.barnesandnoble.com") ||
shExpMatch(host,"*.akamaitech.net") ||
shExpMatch(host,"*.harcourtbrace.com") ||
shExpMatch(host,"*.apnet.net") ||
shExpMatch(host,"*.epnet.com") ||
shExpMatch(host,"*.epnet.net") ||
shExpMatch(host,"*.springer.de") ||
shExpMatch(host,"*.springer-ny.com") ||
shExpMatch(host,"*.siam.org") ||
shExpMatch(host,"*.stic.gov.tw") ||
shExpMatch(host,"*.umi.com") ||
shExpMatch(host,"e-lib.nctu.edu.tw") ||
shExpMatch(host,"*.ams.org") ||
shExpMatch(host,"*.aip.org") ||
shExpMatch(host,"*.asme.org") ||
shExpMatch(host,"*.ejournal.ascc.net") ||
shExpMatch(host,"*.swetsnetnavigator.com") ||
shExpMatch(host,"*.swetsnetnavigator.nl") ||
shExpMatch(host,"*.apcatalog.com") ||
shExpMatch(host,"www.scienceonline.org") ||
shExpMatch(host,"www.nature.com") ||
shExpMatch(host,"jcrweb.com") ||
shExpMatch(host,"*.oclc.org") ||
shExpMatch(host,"*.cnki.net") ||
shExpMatch(host,"*.read.com.tw") ||
shExpMatch(host,"*.ncl.edu.tw") ||
shExpMatch(host,"*.ei.org") ||
shExpMatch(host,"*.csa.com") ||
shExpMatch(host,"www.ibisworld.com.tw") ||
shExpMatch(host,"www.wanfangduta.com.tw") ||
shExpMatch(host,"www.chemnetbase.com") ||
shExpMatch(host,"www.engnetbase.com") ||
shExpMatch(host,"www.cabi.org") ||
shExpMatch(host,"www.cabsubsets.org") ||
shExpMatch(host,"infotrac.galegroup.com") ||
shExpMatch(host,"*.catchword.com") ||
shExpMatch(host,"catchword.com") ||
shExpMatch(host,"*.interscience.wiley.com") ||
shExpMatch(host,"*.iop.org") ||
shExpMatch(host,"*.acs.org") ||
shExpMatch(host,"*.highwire.org") ||
shExpMatch(host,"*.netlibrary.com") ||
shExpMatch(host,"www.groveart.com") ||
shExpMatch(host,"www.grovemusic.com") ||
shExpMatch(host,"www.sciamarchive.org") ||
shExpMatch(host,"www.refworks.com.tw") ||
shExpMatch(host,"cjn.csis.com.tw") ||
shExpMatch(host,"www.genomebiology.com") ||
shExpMatch(host,"www.sciencedirect.com") ||
shExpMatch(host,"www.iospress.nl") ||
shExpMatch(host,"www.genome.org") ||
shExpMatch(host,"rsc.org") ||
shExpMatch(host,"www2.elsevier.co.uk") ||
shExpMatch(host,"www.worldscientific.com.sg") ||
shExpMatch(host,"www.journals.uchicago.edu") ||
shExpMatch(host,"physiolgenomics.org") ||
shExpMatch(host,"ovid.digilib.nctu.edu.tw") ||
shExpMatch(host,"*.jjap.or.jp") ||
shExpMatch(host,"*.engineeringvillage2.org") ||
shExpMatch(host,"*.metapress.com") ||
shExpMatch(host,"*.tandf.co.uk") ||
shExpMatch(host,"*.ebsco.com") ||
shExpMatch(host,"*.windeal.com.tw") ||
shExpMatch(host,"gateway.ovid.com") ||
shExpMatch(host,"gateway1.ovid.com") ||
shExpMatch(host,"gateway2.ovid.com") ||
shExpMatch(host,"gateway3.ovid.com") ||
shExpMatch(host,"gateway.ut.ovid.com") ||
shExpMatch(host,"*.isiknowledge.com") ||
shExpMatch(host,"mic.iii.org.tw") ||
shExpMatch(host,"www.journals.uchicago.edu") ||
shExpMatch(host,"web2.westlaw.com") ||
shExpMatch(host,"heinonline.org") ||
shExpMatch(host,"*.sciencemag.org") ||
shExpMatch(host,"swproxy.swetswise.com") ||
shExpMatch(host,"www.taiwantrade.com.tw") ||
shExpMatch(host,"news.taiwantrade.com.tw") ||
shExpMatch(host,"mi.compustst.com") ||
shExpMatch(host,"www.hinet.org.tw") ||
shExpMatch(host,"www.pubmedcentral.gov") ||
shExpMatch(host,"www.twpat.com") ||
shExpMatch(host,"www.swetswise.com") ||
shExpMatch(host,"www.springerlink.com") ||
shExpMatch(host,"www.haworthpress.com") ||
shExpMatch(host,"isi4.newisiknowledge.com") ||
shExpMatch(host,"isiknowledge.com") ||
shExpMatch(host,"www.dekker.com") ||
shExpMatch(host,"cnki.csis.com.tw") ||
shExpMatch(host,"kmw.ctgin.com") ||
shExpMatch(host,"Journals.Cambridge.org") ||
shExpMatch(host,"www.greatman.com.tw") ||
shExpMatch(host,"www.anb.org") ||
shExpMatch(host,"iospress.metapress.com") ||
shExpMatch(host,"www.ingenta.com") ||
shExpMatch(host,"www.blackwell-synergy.com") ||
shExpMatch(host,"www.lawbank.com.tw") ||
shExpMatch(host,"www.land.moi.gov.tw") ||
shExpMatch(host,"www.eduref.org") ||
shExpMatch(host,"www.biomedcentral.com") ||
shExpMatch(host,"www.wordpedia.com") ||
shExpMatch(host,"www.cabdirect.org") ||
shExpMatch(host,"srda.sinica.edu.tw") ||
shExpMatch(host,"www.ceps.com.tw") ||
shExpMatch(host,"www.thomastelford.com") ||
shExpMatch(host,"www.mycologia.org") ||
shExpMatch(host,"www.csa.com") ||
shExpMatch(host,"www.cna.com.tw") ||
shExpMatch(host,"heronpublishing.com") ||
shExpMatch(host,"www.poultryscience.org") ||
shExpMatch(host,"www.jbc.org") ||
shExpMatch(host,"www.genesdev.org") ||
shExpMatch(host,"pcift.chadwyck.com") ||
shExpMatch(host,"eebo.chadwyck.com") ||
shExpMatch(host,"www.lexisnexis.com") ||
shExpMatch(host,"www.lexis.com") ||
shExpMatch(host,"*.ingentaselect.com") ||
shExpMatch(host,"online.ttsgroup.com.tw") ||
shExpMatch(host,"*.infolinker.com.tw") ||
shExpMatch(host,"www.cwk.com.tw") ||
shExpMatch(host,"wisenews.wisers.net") ||
shExpMatch(host,"npmhost.npm.gov.tw") ||
shExpMatch(host,"*.jstor.org") ||
shExpMatch(host,"tie.tier.org.tw") ||
shExpMatch(host,"www3.oup.co.uk") ||
shExpMatch(host,"erl.sinica.edu.tw") ||
shExpMatch(host,"pqdd.sinica.edu.tw") ||
shExpMatch(host,"www.sinica.edu.tw") ||
shExpMatch(host,"srda.sinica.edu.tw") ||
shExpMatch(host,"twp.apipa.org.tw") ||
shExpMatch(host,"online.sfib.org.tw") ||
shExpMatch(host,"iris.emeraldinsight.com") ||
shExpMatch(host,"elvira.emeraldinsight.com") ||
shExpMatch(host,"tafs.allentrack.net") ||
shExpMatch(host,"aslo.org") ||
shExpMatch(host,"www.ingentaconnect.com") ||
shExpMatch(host,"csa.e-lib.nctu.edu.tw") ||
shExpMatch(host,"laumt.lib.cyut.edu.tw") ||
shExpMatch(host,"demo.ebookmatrix.net") ||
shExpMatch(host,"*.silverplatter.com") ||
shExpMatch(host,"www.credit.com.tw") ||
shExpMatch(host,"journals.cambridge.org") ||
shExpMatch(host,"web26.epnet.com") ||
shExpMatch(host,"afs.allenpress.com") ||
shExpMatch(host,"ejournals.ebsco.com") ||
shExpMatch(host,"MCB.ASM.ORG") ||
shExpMatch(host,"vnweb.hwwilsonweb.com") ||
shExpMatch(host,"www.aacr.org") ||
shExpMatch(host,"www.nature.com") ||
shExpMatch(host,"www.pdkintl.org") ||
shExpMatch(host,"ssreader.igroupnet.com.tw") ||
shExpMatch(host,"epublish.nict.gov.tw") ||
shExpMatch(host,"epublish.hyweb.com.tw") ||
shExpMatch(host,"www.scopus.com") ||
shExpMatch(host,"www.aslo.org") ||
shExpMatch(host,"ejournals.ebsco.com") ||
shExpMatch(host,"journals.mup.man.ac.uk") ||
shExpMatch(host,"www.embase.com") ||
shExpMatch(host,"www.the-aps.org") ||
shExpMatch(host,"physiology.org") ||
shExpMatch(host,"oupjournals.org") ||
shExpMatch(host,"*.oxfordjournals.org") ||
shExpMatch(host,"www.cellpress.com") ||
shExpMatch(host,"www.thieme-chemistry.com") ||
shExpMatch(host,"*.safaribooksonline.com") ||
shExpMatch(host,"www.ipap.jp") ||
shExpMatch(host,"journals.mup.man.ac.uk") ||
shExpMatch(host,"mup.mcc.ac.uk") ||
shExpMatch(host,"www.csa1.co.uk") ||
shExpMatch(host,"www.ingentaconnect.com") ||
shExpMatch(host,"www.rsc.org") ||
shExpMatch(host,"www.tunnelsonline.info") ||
shExpMatch(host,"estuaries.olemiss.edu") ||
shExpMatch(host,"afs.allenpress.com") ||
shExpMatch(host,"www.publish.csiro.au") ||
shExpMatch(host,"www.asme.org") ||
shExpMatch(host,"members.ift.org") ||
shExpMatch(host,"inpractice.bvapublications.com") ||
shExpMatch(host,"www.mycologia.org") ||
shExpMatch(host,"www.rsnz.org") ||
shExpMatch(host,"www.emeraldinsight.com") ||
shExpMatch(host,"muse.jhu.edu") ||
shExpMatch(host,"ser10.lib.nchu.edu.tw") ||
shExpMatch(host,"www.jaaha.org ") ||
shExpMatch(host,"www.jwildlifedis.org") ||
shExpMatch(host,"www.jvetintmed.org") ||
shExpMatch(host,"*.wisers.net") ||
shExpMatch(host,"www.cnsonline.com.tw") ||
shExpMatch(host,"nchu.lib.apabi.com") ||
shExpMatch(host,"www.informaworld.com") ||
shExpMatch(host,"www-cal.csa.com") ||
shExpMatch(host,"gateway.proquest.com") ||
shExpMatch(host,"www.mcponline.org") ||
shExpMatch(host,"www.asbmb.org") ||
shExpMatch(host,"www.electronicipc.com") ||
shExpMatch(host,"www.ashs.org") ||
shExpMatch(host,"*.sgmjournals.org") ||
shExpMatch(host,"www.atypon-link.com") ||
shExpMatch(host,"www.degruyter.de") ||
shExpMatch(host,"www.phycologia.org") ||
shExpMatch(host,"www.aiaa.org") ||
shExpMatch(host,"www.astm.org") ||
shExpMatch(host,"www.liebertonline.com") ||
shExpMatch(host,"jvdi.org") ||
shExpMatch(host,"cmr.asm.org") ||
shExpMatch(host,"dx.doi.org") ||
shExpMatch(host,"www.plantphysiol.org") ||
shExpMatch(host,"www.aviationweek.com") ||
shExpMatch(host,"caliber.ucpress.net") ||
shExpMatch(host,"www.palgrave-journals.com") ||
shExpMatch(host,"avmajournals.avma.org") ||
shExpMatch(host,"www.iahr.net") ||
shExpMatch(host,"www.foreignpolicy.com") ||
shExpMatch(host,"www.iijournals.com") ||
shExpMatch(host,"www2.us.elsevierhealth.com") ||
shExpMatch(host,"www.vetclinpathjournal.org") ||
shExpMatch(host,"www.jcb.org") ||
shExpMatch(host,"www.mapress.com") ||
shExpMatch(host,"www.cfapubs.org") ||
shExpMatch(host,"www.jstage.jst.go.jp") ||
shExpMatch(host,"mcfarland.metapress.com") ||
shExpMatch(host,"veterinaryrecord.bvapublications.com") ||
shExpMatch(host,"endo.endojournals.org") ||
shExpMatch(host,"www.jcronline.org") ||
shExpMatch(host,"www.mlajournals.org") ||
shExpMatch(host,"www.hljournals.org") ||
shExpMatch(host,"www.envplan.com") ||
shExpMatch(host,"www.biochemj.org") ||
shExpMatch(host,"www.istructe.org.uk") ||
shExpMatch(host,"www.radicalphilosophy.com") ||
shExpMatch(host,"www.manchesteruniversitypress.co.uk") ||
shExpMatch(host,"www.mitpressjournals.org") ||
shExpMatch(host,"www.esajournals.org") ||
shExpMatch(host,"www.jlr.org") ||
shExpMatch(host,"www.biolreprod.org") ||
shExpMatch(host,"www.jimmunol.org") ||
shExpMatch(host,"jn.nutrition.org") ||
shExpMatch(host,"www.fisheries.org") ||
shExpMatch(host,"ajp.amjpathol.org") ||
shExpMatch(host,"www.amjbot.org") ||
shExpMatch(host,"www.botany.org") ||
shExpMatch(host,"pubs.nrc-cnrc.gc.ca") ||
shExpMatch(host,"www.chemistry.or.jp") ||
shExpMatch(host,"engrwww.usask.ca") ||
shExpMatch(host,"www.electrochem.org") ||
shExpMatch(host,"www.coatingstech.org") ||
shExpMatch(host,"www.biotechniques.com") ||
shExpMatch(host,"jdt.osa.org") ||
shExpMatch(host,"www.mrs.org") ||
shExpMatch(host,"www.businessweek.com") ||
shExpMatch(host,"www.nacestore.com") ||
shExpMatch(host,"europa.eu") ||
shExpMatch(host,"www.biochemsoctrans.org") ||
shExpMatch(host,"www.sagamorepub.com") ||
shExpMatch(host,"www.reproduction-online.org") ||
shExpMatch(host,"wwwsoc.nii.ac.jp") ||
shExpMatch(host,"hk.wanfangdata.com") ||
shExpMatch(host,"bankscope.bvdep.com") ||
shExpMatch(host,"osiris.bvdep.com") ||
shExpMatch(host,"arjournals.annualreviews.org") ||
shExpMatch(host,"www.kdp.org") ||
shExpMatch(host,"sloanreview.mit.edu") ||
shExpMatch(host,"avdi.allenpress.com") ||
shExpMatch(host,"jjap.ipap.jp") ||
shExpMatch(host,"www.discoverygate.com") ||
shExpMatch(host,"www.hytung.com.tw") ||
shExpMatch(host,"tci.gcscholar.com") ||
shExpMatch(host,"www.lawdata.com.tw") ||
shExpMatch(host,"www.topology.com.tw") ||
shExpMatch(host,"reading.udn.com") ||
shExpMatch(host,"collections.chadwyck.co.uk") ||
shExpMatch(host,"www.spiedl.org") ||
shExpMatch(host,"www.geotechnique-ice.com") ||
shExpMatch(host,"www.concrete-research.com") ||
shExpMatch(host,"www.rsc.org") ||
shExpMatch(host,"www.aiaa.org") ||
shExpMatch(host,"*.uwpress.org") ||
shExpMatch(host,"newleftreview.org") ||
shExpMatch(host,"dukejournals.org") ||
shExpMatch(host,"www.rockefeller.edu") ||
shExpMatch(host,"www.journals.asm.org") ||
shExpMatch(host,"www.bloodjournal.org") ||
shExpMatch(host,"www.jgp.org") ||
shExpMatch(host,"mansci.journal.informs.org") ||
shExpMatch(host,"orgsci.journal.informs.org") ||
shExpMatch(host,"harvardbusinessonline.hbsp.harvard.edu") ||
shExpMatch(host,"www.internationaljournalofadvertising.com") ||
shExpMatch(host,"msom.journal.informs.org") ||
shExpMatch(host,"www.mineralogicalassociation.ca") ||
shExpMatch(host,"www.eje.cz") ||
shExpMatch(host,"www.msafungi.org") ||
shExpMatch(host,"www.genetics.org") ||
shExpMatch(host,"www.jleukbio.org") ||
shExpMatch(host,"www.aaap.info") ||
shExpMatch(host,"www.edpsciences.org") ||
shExpMatch(host,"www.rsmpress.co.uk") ||
shExpMatch(host,"www.vetpathology.org") ||
shExpMatch(host,"www.libraryjournal.com") ||
shExpMatch(host,"www.publishersweekly.com") ||
shExpMatch(host,"www.aspbs.com") ||
shExpMatch(host,"www.duncker-humblot.de") ||
shExpMatch(host,"*.ipap.jp") ||
shExpMatch(host,"*.sagepub.com") ||
shExpMatch(host,"www.aviationnow.com") ||
shExpMatch(host,"horttech.ashspublications.org") ||
shExpMatch(host,"apt.allenpress.com") ||
shExpMatch(host,"jas.fass.org") ||
shExpMatch(host,"*.dukejournals.org") ||
shExpMatch(host,"www.journalhydraulicresearch.com") ||
shExpMatch(host,"www.ajcp.com") ||
shExpMatch(host,"www.wipsglobal.com") ||
shExpMatch(host,"lion.chadwyck.co.uk") ||
shExpMatch(host,"www.avs.org") ||
shExpMatch(host,"spiedigitallibrary.aip.org") ||
shExpMatch(host,"asmedl.aip.org") ||
shExpMatch(host,"www.imaging.org") ||
shExpMatch(host,"hanchi.ihp.sinica.edu.tw") ||
shExpMatch(host,"enterprise.astm.org") ||
shExpMatch(host,"edo.tw") ||
isInNet(host,"211.20.11.205","255.255.255.255") ||
isInNet(host,"203.73.116.138","255.255.255.255") ||
isInNet(host,"163.29.141.191","255.255.255.255") ||
isInNet(host,"192.192.58.96","255.255.255.255") ||
isInNet(host,"61.218.52.75","255.255.255.255") ||
isInNet(host,"203.85.10.214","255.255.255.255") ||
isInNet(host,"203.70.141.50","255.255.255.255") ||
isInNet(host,"140.120.80.21","255.255.255.255") ||
isInNet(host,"140.120.80.2","255.255.255.255") ||
isInNet(host,"140.120.81.240","255.255.255.255") ||
isInNet(host,"204.179.122.*","255.255.255.255") ||
isInNet(host,"72.164.152.*","255.255.255.255") ||
isInNet(host,"211.21.109.118","255.255.255.255") ||
shExpMatch(host,"*.epnet.com") ||
shExpMatch(host,"*.ebscohost.com") ||
shExpMatch(host,"*.acm.org") ||
shExpMatch(host,"cancerres.aacrjournals.org") ||
shExpMatch(host,"udndata.com") ||
shExpMatch(host,"www.fasebj.org") ||
shExpMatch(host,"dbonline.igroupnet.com") ||
shExpMatch(host,"journals.cambridge.org") ||
shExpMatch(host,"jcs.biologists.org") ||
shExpMatch(host,"ejournals.ebsco.com") ||
shExpMatch(host,"jcl.sagepub.com") ||
shExpMatch(host,"www.oxfordreference.com") ||
shExpMatch(host,"www.oxford-digitalreference.com") ||
shExpMatch(host,"www.oxfordscholarship.com") ||
shExpMatch(host,"www.oed.com") ||
shExpMatch(host,"www.groveart.com") ||
shExpMatch(host,"www.grovemusic.com") ||
shExpMatch(host,"www.oxforddnb.com") ||
shExpMatch(host,"www.oxfordaasc.com") ||
shExpMatch(host,"ildc.oxfordlawreports.com") ||
shExpMatch(host,"pao.chadwyck.co.uk") ||
shExpMatch(host,"infoweb.newsbank.com") ||
shExpMatch(host,"siamdl.aip.org") ||
shExpMatch(host,"www.pnas.org")
)
return "DIRECT";

else if (url.substring(0, 5) == "http:")
return "PROXY cache.nchu.edu.tw:3128; DIRECT";

else
return "DIRECT";
}
else {
return "EIRECT";
}
}



大致如此,按照自己的需求修改,應該就沒問題了,Squid各版本的設定應該大同小異。
自己也曾在系上Switch出問題時,透過Hinet備援線路連回系上進行維護,少跑了一趟。

沒有留言:

張貼留言