亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 4757 | 回復(fù): 0
打印 上一主題 下一主題

[proxy] 瀏覽器代理服務(wù)器自動設(shè)置 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2010-08-03 12:01 |只看該作者 |倒序瀏覽
本帖最后由 abc3w 于 2010-08-24 10:40 編輯

利用wpad配置瀏覽器代理服務(wù)器自動檢測

在家與公司里,代理服務(wù)器地址改來改去,麻煩?
代理服務(wù)器用戶驗證需要手工設(shè)置代理服務(wù)器地址?

WPAD是Web Proxy Auto Discovery的縮寫,意思是Web代理服務(wù)器自動發(fā)現(xiàn)。
瀏覽器自動檢測代理服務(wù)器啟用時會查找名稱為wpad的計算機,并從wpad的web服務(wù)下載自動配置腳本。
使用瀏覽器的自動代理服務(wù)器檢測,可以方便計算機在各個使用代理服務(wù)器的網(wǎng)絡(luò)打開網(wǎng)頁,而無需重新配置,并繞過了透明代理不能使用用戶驗證的問題。

以下是一個已經(jīng)通過IE及firefox瀏覽器自動配置的方案.
dhcpd+wins+named+apache+squid

實現(xiàn)過程:
由dhcpd分配dns服務(wù)器地址
wins及named解析wpad地址
apache提供自動代理腳本 proxy.pac 下載
squid提供代理服務(wù),當(dāng)然其它代理服務(wù)器也行

假設(shè)各服務(wù)器IP如下:
aquid:  192.168.1.1   squid.wpad
named:  192.168.1.2   ns1.network.local
apache: 192.168.1.3   wpad
wins:   192.168.1.253
dhcpd:  192.168.1.254

以下配置只包括如何實現(xiàn)瀏覽器自動檢測代理服務(wù)器的部份內(nèi)容,各服務(wù)具體配置請查閱相關(guān)資料.

1) 配置DHCP分配DNS地址
在dhcpd.conf里添加dns服務(wù)器地址:

  1. option domain-name-servers      192.168.1.2;
  2. option netbios-name-servers     192.168.1.253;
  3. option domain-name        "network.rhel";           # 單wpad不會查詢DNS,加入這一條,會就查詢wpad.network.rhel.
復(fù)制代碼
2) 配置named解析wpad
在named.conf里添加

  1. zone "network.rhel" {
  2.         type master;
  3.         file "/etc/network.rhel.zone";
  4. };
復(fù)制代碼
新建文件network.rhel.zone,并添加:

  1. $ttl 36000
  2. wpad.  IN      SOA     ns1.network.rhel. ns@network.rhel. (   #named里已經(jīng)配置ns1.network.local指向本地IP地址.
  3.                         2005090503
  4.                         10800
  5.                         3600
  6.                         604800
  7.                         36000 )

  8. network.rhel.       IN NS      ns1.network.rhel.
  9. network.rhel.       IN NS      ns2.network.rhel.     #如有多個DNS服務(wù)器地址,需同樣在named添加network.rhel.zone記錄及network.rhel.zone數(shù)據(jù)文件.

  10. @                  IN A       192.168.1.2
  11. ns1               IN A        192.168.1.2
  12. ns2               IN A        192.168.1.x      #多臺dns解析服務(wù)器
  13. wpad              IN A       192.168.1.3     #提供wpad解析
  14. squid              IN A       192.168.1.1
  15. squid              IN A       192.168.1.5     #可選,多臺代理服務(wù)器時使用,如果使用了用戶驗證,可能會導(dǎo)致頻繁驗證.
復(fù)制代碼
3) 配置wins,使用win2003的wins服務(wù),添加靜態(tài)映射:        #有哪位能告訴我LINUX有wins服務(wù)嗎?
計算機名稱: wpad
ip地址: 192.168.1.3

4) 配置proxy.pac,由apache提供下載
在apache默認路徑下(默認/var/www/html/,具體位置見httpd.conf配置文件DocumentRoot處)添加proxy.pac文件:
此文件可以squid官方網(wǎng)站下載到,稍做修改如下:

  1. //We (www.is.co.za) run a central cache for our customers that they
  2. //access through a firewall - thus if they want to connect to their intranet
  3. //system (or anything in their domain at all) they have to connect
  4. //directly - hence all the "fiddling" to see if they are trying to connect
  5. //to their local domain.
  6. //
  7. //Replace each occurrence of company.com with your domain name
  8. //and if you have some kind of intranet system, make sure
  9. //that you put it's name in place of "internal" below.
  10. //
  11. //We also assume that your cache is called "cache.company.com", and
  12. //that it runs on port 8080. Change it down at the bottom.
  13. //
  14. //(C) Oskar Pearson and the Internet Solution (http://www.is.co.za)

  15. function FindProxyForURL(url, host)
  16. {
  17.     //If they have only specified a hostname, go directly.
  18.     if (isPlainHostName(host))
  19.             return "DIRECT";

  20.     //These connect directly if the machine they are trying to
  21.     //connect to starts with "intranet" - ie http://intranet
  22.     //Connect  directly if it is intranet.*
  23.     //If you have another machine that you want them to
  24.     //access directly, replace "internal*" with that
  25.     //machine's name
  26.     if (shExpMatch( host, "intranet*")||
  27.                     shExpMatch(host, "internal*"))
  28.         return "DIRECT";

  29.     //Connect directly to our domains (NB for Important News)
  30.     if (dnsDomainIs( host,"127.0.0.1")||               #指定地址或域名不通過代理
  31.     //If you have another domain that you wish to connect to
  32.     //directly, put it in here
  33.                     dnsDomainIs(host,"127.0.0.1"))          #指定地址或域名不通過代理,可使用||符號添加多個
  34.         return "DIRECT";

  35.     //So the error message "no such host" will appear through the
  36.     //normal Netscape box - less support queries :)
  37.     if (!isResolvable(host))
  38.             return "DIRECT";

  39.     //We only cache http, ftp and gopher
  40.     if (url.substring(0, 5) == "http:" ||
  41.                     url.substring(0, 4) == "ftp:"||
  42.                     url.substring(0, 7) == "gopher:")

  43.     //Change the ":8080" to the port that your cache
  44.     //runs on, and "cache.company.com" to the machine that
  45.     //you run the cache on
  46.             return "PROXY squid.wpad:3128; DIRECT";            #此處指明squid服務(wù)器地址,已經(jīng)由squid.wpad解析

  47.     //We don't cache WAIS
  48.     if (url.substring(0, 5) == "wais:")
  49.             return "DIRECT";

  50.     else
  51.             return "DIRECT";
  52. }
復(fù)制代碼
5) 配置squid,無需特別的配置,也可以使用其它代理服務(wù)器(例如ISA),需要端口號一致.
如果squid與apache在一臺服務(wù)器上,并且啟用透明代理,在squid.conf合適位置添加如下幾行,防止不能下載proxy.pac文件.

  1. acl AllowSquidWpad dstdomain wpad wpad. squid.wpad 192.168.1.1     #假設(shè)服務(wù)器地址是192.168.1.1
  2. acl lan_all_ip src 192.168.0.0/16                     #假設(shè)局域網(wǎng)地址范圍是192.168.0.0-192.168.255.255
  3. http_access allow lan_all_ip AllowSquidWpad
復(fù)制代碼
配置完成.

以上服務(wù)可以由一臺服務(wù)器提供,只要把相應(yīng)的IP地址更改。
這只是N種方法中的一種,純個人見解,錯誤之處難免,望大家指正.
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP