实例教你如何架设层次代理服务器
在一般的网络规模中,在近客户端,使用一台性能较好的Cache代理服务器,就可以满足内部用户的需求,减缓出口线路的拥堵问题。但如果内部网络已扩张到相当庞杂,用户机器数量达到数万台,同一时间的URL请求可能达到上万个,这种情况下极有可能造成单台代理服务
在一般的网络规模中,在近客户端,使用一台性能较好的Cache代理服务器,就可以满足内部用户的需求,减缓出口线路的拥堵问题。但如果内部网络已扩张到相当庞杂,用户机器数量达到数万台,同一时间的URL请求可能达到上万个,这种情况下极有可能造成单台代理服务器无法及时处理,甚至瘫痪,代理服务器反而会成为新的瓶颈。为了有效解决此类情况,我们可以在内部网络中布置多台代理服务器,代理服务器之间构成Hierarchies(层次),协同工作,减缓负载,减轻线路压力。
具体配置方法
下面结合我校的实际情况,说明层次代理服务器的架设方法。

图1
图1是校园网的拓扑结构,内部网通过路由器,由两个出口线路分别接入CERNET和CHINANET,最终汇入Internet。大多数的高校现在都采用这种多出口的方法,因为CERNET虽然可以给予高校合法的IP地址,但它多采用出国流量计费或包月制,费用较高且带宽有限;而CHINANET、CNCNET等运营商的线路的包月费用相对较低,出口访问速度较快。所以一般情况下使用CERNET作入口访问及必要的出口访问(如访问教育资源),而使用CHINANET、CNCNET作大部分的出口访问。
我校校园网在地理上分为多个区域,有图书馆及教学区、行政办公区、学生宿舍区等,我们只拿出这三个区域做为例子。在这三个区域中分别放置一台代理服务器,其域名分别为lib.Cache.lyac.edu.cn 、adm.Cache.lyac.edu.cn 、stu.Cache.lyac.edu.cn 。
其中,因为图书馆购买的学术期刊论文数据库必须是合法IP(有的要求固定IP)才能访问查询,并且校园网也需要访问CERNET上的许多教育资源,所以把它的默认出口线路放到CERNET上,使用合法IP地址;其它两个区域的默认出口线路都放到CHINANET上,ISP通常不会给学校提供合法的IP,所以我们一般在这样的Cache上使用两块网卡,一块使用内网虚地址,另一块使用ISP提供的虚地址,这样就可以连接到ISP,再由其转发。
Cache Server可以是在一台普通的服务器加上Cache软件构成,也有由专用的软硬件系统构成的商业Cache服务器(如CacheFlow)。我校的代理服务器使用Squid。Squid代理服务器使用Squid.conf作为配置文件,单台代理服务器的应用配置――特别是ACL和http_access的配合使用方法,有很多参考资料,这里不再赘叙,我们只讲squid.conf文件中和Cache层次有关的常用配置选项,其详细用法参看squid文档。
下面列出三个区域Cache中的只有和层次有关的配置内容,其中结合ACL的配置方法多种多样,例如可以使用icp_access、 miss_access控制外部Cache的请求权限;有些配置选项的使用结果也是相似的。“#”号开头的为注释。
(1) 图书馆及教学区Cache的配置
http_port 3128
icp_port 3130
#定义其它两个区域的Cache和自己的关系
Cache_peer adm.Cache.lyac.edu.cn sibling 3128 3130
Cache_peer stu.Cache.lyac.edu.cn sibling 3128 3130
#设定只有非.edu.cn域的URL自己没有时才请求其它两个区域的Cache帮助
Cache_peer_domain adm.Cache.lyac.edu.cn !.edu.cn
Cache_peer_domain stu.Cache.lyac.edu.cn !.edu.cn
#10.10.0.0/16是校园网使用的内网虚地址
acl LocalNetIPVIR src 10.10.0.0/16
#210.44.48.0/20是校园网使用的合法IP地址
acl LocalNetIPTRUE src 210.44.48.0/20
#.lyac.edu.cn是校园网的域
acl LocalDomain srcdomain .lyac.edu.cn
acl all src 0.0.0.0/0.0.0.0
Cache_peer_access adm.Cache.lyac.edu.cn allow LocalNetIPVIR
Cache_peer_access adm.Cache.lyac.edu.cn allow LocalNetIPTRUE
Cache_peer_access adm.Cache.lyac.edu.cn allow srcdomain
Cache_peer_access stu.Cache.lyac.edu.cn allow LocalNetIPVIR
Cache_peer_access stu.Cache.lyac.edu.cn allow LocalNetIPTRUE
Cache_peer_access stu.Cache.lyac.edu.cn allow srcdomain
Cache_peer_access adm.Cache.lyac.edu.cn deny all
Cache_peer_access stu.Cache.lyac.edu.cn deny all
#设定只为本校的Cache提供层次服务,以防被局域网外的Cache非法利用
icp_access allow LocalNetIPVIR
icp_access allow LocalNetIPTRUE
icp_access allow srcdomain
icp_access deny all
(2)行政办公区Cache的配置(Cache_peer_access的访问控制列表同行政办公区)
http_port 3128
icp_port 3130
Cache_peer lib.Cache.lyac.edu.cn parent 3128 3130
Cache_peer stu.Cache.lyac.edu.cn sibling 3128 3130
#设定缓存中没有.edu.cn的object时才请求lib.Cache.lyac.edu.cn协助抓取
Cache_peer_domain lib.Cache.lyac.edu.cn .edu.cn
Cache_peer_domain stu.Cache.lyac.edu.cn !.edu.cn
(3)学生宿舍区Cache的配置内容大致同行政办公区,从略。
外部网络上有一些免费的可用来组成层次的Cache,如图1所示,可以申请代理服务器D(CERNET上)和E(Internet上)作为您的parent 或sibling,在申请获得通过后就可以在本地Cache上设置peer关系得到object。
层次代理服务器有效解决了局域网规模太大时多台代理服务器的协调工作问题,更加有效地节约带宽,优化网络中的信息流动,保障网络的正常健康运行。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics
![WLAN expansion module has stopped [fix]](https://img.php.cn/upload/article/000/465/014/170832352052603.gif?x-oss-process=image/resize,m_fill,h_207,w_330)
If there is a problem with the WLAN expansion module on your Windows computer, it may cause you to be disconnected from the Internet. This situation is often frustrating, but fortunately, this article provides some simple suggestions that can help you solve this problem and get your wireless connection working properly again. Fix WLAN Extensibility Module Has Stopped If the WLAN Extensibility Module has stopped working on your Windows computer, follow these suggestions to fix it: Run the Network and Internet Troubleshooter to disable and re-enable wireless network connections Restart the WLAN Autoconfiguration Service Modify Power Options Modify Advanced Power Settings Reinstall Network Adapter Driver Run Some Network Commands Now, let’s look at it in detail

This article will introduce the solution to the problem that the globe symbol is displayed on the Win10 system network but cannot access the Internet. The article will provide detailed steps to help readers solve the problem of Win10 network showing that the earth cannot access the Internet. Method 1: Restart directly. First check whether the network cable is not plugged in properly and whether the broadband is in arrears. The router or optical modem may be stuck. In this case, you need to restart the router or optical modem. If there are no important things being done on the computer, you can restart the computer directly. Most minor problems can be quickly solved by restarting the computer. If it is determined that the broadband is not in arrears and the network is normal, that is another matter. Method 2: 1. Press the [Win] key, or click [Start Menu] in the lower left corner. In the menu item that opens, click the gear icon above the power button. This is [Settings].

1. Check the wifi password: Make sure the wifi password you entered is correct and pay attention to case sensitivity. 2. Confirm whether the wifi is working properly: Check whether the wifi router is running normally. You can connect other devices to the same router to determine whether the problem lies with the device. 3. Restart the device and router: Sometimes, there is a malfunction or network problem with the device or router, and restarting the device and router may solve the problem. 4. Check the device settings: Make sure the wireless function of the device is turned on and the wifi function is not disabled.

In network data transmission, IP proxy servers play an important role, helping users hide their real IP addresses, protect privacy, and improve access speeds. In this article, we will introduce the best practice guide on how to build an IP proxy server with PHP and provide specific code examples. What is an IP proxy server? An IP proxy server is an intermediate server located between the user and the target server. It acts as a transfer station between the user and the target server, forwarding the user's requests and responses. By using an IP proxy server

The role of a DHCP relay is to forward received DHCP packets to another DHCP server on the network, even if the two servers are on different subnets. By using a DHCP relay, you can deploy a centralized DHCP server in the network center and use it to dynamically assign IP addresses to all network subnets/VLANs. Dnsmasq is a commonly used DNS and DHCP protocol server that can be configured as a DHCP relay server to help manage dynamic host configurations in the network. In this article, we will show you how to configure dnsmasq as a DHCP relay server. Content Topics: Network Topology Configuring Static IP Addresses on a DHCP Relay D on a Centralized DHCP Server

In daily life and work, we often need to share files and folders between different devices. Windows 11 system provides convenient built-in folder sharing functions, allowing us to easily and safely share the content we need with others within the same network while protecting the privacy of personal files. This feature makes file sharing simple and efficient without worrying about leaking private information. Through the folder sharing function of Windows 11 system, we can cooperate, communicate and collaborate more conveniently, improving work efficiency and life convenience. In order to successfully configure a shared folder, we first need to meet the following conditions: All devices (participating in sharing) are connected to the same network. Enable Network Discovery and configure sharing. Know the target device

Apple rolled out the iOS 17.4 update on Tuesday, bringing a slew of new features and fixes to iPhones. The update includes new emojis, and EU users will also be able to download them from other app stores. In addition, the update also strengthens the control of iPhone security and introduces more "Stolen Device Protection" setting options to provide users with more choices and protection. "iOS17.3 introduces the "Stolen Device Protection" function for the first time, adding extra security to users' sensitive information. When the user is away from home and other familiar places, this function requires the user to enter biometric information for the first time, and after one hour You must enter information again to access and change certain data, such as changing your Apple ID password or turning off stolen device protection.

What should I do if I can’t enter the game when the epic server is offline? This problem must have been encountered by many friends. When this prompt appears, the genuine game cannot be started. This problem is usually caused by interference from the network and security software. So how should it be solved? The editor of this issue will explain I would like to share the solution with you, I hope today’s software tutorial can help you solve the problem. What to do if the epic server cannot enter the game when it is offline: 1. It may be interfered by security software. Close the game platform and security software and then restart. 2. The second is that the network fluctuates too much. Try restarting the router to see if it works. If the conditions are OK, you can try to use the 5g mobile network to operate. 3. Then there may be more
