【问题标题】:Block P2P BitTorrent traffic using nftables使用 nftables 阻止 P2P BitTorrent 流量
【发布时间】:2022-12-09 02:22:16
【问题描述】:

我正在尝试使用 NFTables 拒绝与协议 P2P/Bittorrent 相关的端口 6881 到 6889 上的所有输出流量。任何帮助将不胜感激,因为我不遵守规则。

【问题讨论】:

    标签: linux terminal p2p nftables


    【解决方案1】:

    由于 nftables 目前不支持第 7 层正则表达式匹配,因此无法使用 such regular expressions 来匹配数据包,我将通过过滤端口给你你所要求的。

    在这个例子中,我们阻止了主机本身产生的流量,如果主机充当路由器,我们也会阻止它。

    table inet filter {
        chain output {
            type filter hook output priority filter;
            policy accept;
            jump block_bittorrent
        }
    
        chain forward {
            type filter hook forward priority filter;
            policy accept;
            jump block_bittorrent;
        }
    
        chain block_bittorrent {
            tcp dport 6881-6889 counter drop;
            udp dport 6881-6889 counter drop;
        }
    }
    

    让我提一下,可以在 nftables 中使用 Raw Payload Expressions 来进行匹配,但这需要更多调查。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-10
      • 2014-03-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多