Squid Web Cache Wiki

Squid Web Cache 文档

🔗 过滤 BitTorrent

作者:Yuri Voinov

🔗 目录

Torrent 过滤是一个棘手的问题,无法轻易解决。为了让用户更难做到这一点,您可以首先禁止下载 .torrent 文件。

🔗 用法

您也可以使用路由器中的 NBAR 协议发现(DPI 功能)来强制执行此任务(ISR G-2 及以上 29xx Cisco 系列或类似设备)。仅靠 Squid 无法完全阻止您想要的 torrent。

🔗 Squid 配置文件

将此粘贴到您的 squid.conf 文件中。然后重新配置 squid。

# Block torrent files
acl TorrentFiles rep_mime_type -i mime-type application/x-bittorrent
http_reply_access deny TorrentFiles
deny_info TCP_RESET TorrentFiles

这可以防止用户通过浏览器下载 .torrent 文件。

🔗 Cisco 路由器配置

您可以使用 Cisco 路由器有效地强制阻止 torrent,如下所示:

!
!ip nbar protocol-pack flash0:pp-adv-isrg2-155-3.M1-23-15.0.0.pack
ip nbar protocol-pack flash0:/pp-adv-isrg2-155-3.M2-23-22.0.0.pack 
!
class-map match-any torrent
 match protocol bittorrent
 match protocol bittorrent-networking
 match protocol encrypted-bittorrent
 match protocol encrypted-emule
 match protocol webthunder
 match protocol edonkey
 match protocol edonkey-static
 match protocol gnutella
 match protocol goboogy
 match protocol fasttrack-static
 match protocol winmx
 match protocol winny
 match protocol ares
 match protocol Konspire2b
 match protocol filetopia
 match protocol manolito
 match protocol networking-gnutella
 match protocol perfect-dark
 match protocol poco
 match protocol ppstream
 match protocol share
 match protocol songsari
 match protocol sopcast
 match protocol soulseek
 match protocol tomatopang
 match protocol xunlei-kankan
 match protocol dht
 match protocol torrentz
!
policy-map Net_Limit
 class torrent
  drop
 class class-default
  bandwidth remaining percent 15 
!
interface GigabitEthernet0/0
! This is external router interface
 ip nbar protocol-discovery
 service-policy output Net_Limit
!

此配置,取决于您指定的 P2P 协议,将完全终止边界路由器/防火墙上的所有 torrent 会话。

:warning: 您需要实际的 NBAR2 协议包才能做到这一点。为此,您需要订阅 Cisco 的服务,并拥有支持 DPI 的路由器,例如 ISR-G2 路由器(2901 或类似型号)。然后,您可以使用 Squid 强制通过 HTTP/HTTPS 拒绝下载 .torrent 文件。这两种方法都可以让您几乎完全阻止 torrent。

:warning: 另外请注意,要过滤加密的 P2P 协议,在大多数 Cisco 设备上,您需要激活 SECURITY 技术包或拥有支持安全功能的 iOS 版本。


⚠️ Disclaimer: Any example presented here is provided "as-is" with no support
or guarantee of suitability. If you have any further questions about
these examples please email the squid-users mailing list.

类别: ConfigExample

导航:网站搜索网站页面分类🔼 向上