簡體   English   中英

使用 nftables 阻止 P2P BitTorrent 流量

[英]Block P2P BitTorrent traffic using nftables

我正在嘗試使用 NFTables 拒絕與協議 P2P/Bittorrent 相關的端口 6881 到 6889 上的所有 output 流量。 任何幫助將不勝感激,因為我不遵守規則。

由於 nftables 目前不支持第 7 層正則表達式匹配,因此無法使用此類正則表達式來匹配數據包,我將通過過濾端口給你你所要求的。

在這個例子中,我們阻止了主機本身產生的流量,如果主機充當路由器,我們也會阻止它。

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 中使用原始有效負載表達式來進行匹配,但這需要更多調查。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM