屏蔽 BT

iptables -A OUTPUT -m string --string "torrent" --algo bm -j DROP
iptables -A OUTPUT -m string --string ".torrent" --algo bm -j DROP
iptables -A OUTPUT -m string --string "peer_id=" --algo bm -j DROP
iptables -A OUTPUT -m string --string "announce" --algo bm -j DROP
iptables -A OUTPUT -m string --string "info_hash" --algo bm -j DROP
iptables -A OUTPUT -m string --string "get_peers" --algo bm -j DROP
iptables -A OUTPUT -m string --string "find_node" --algo bm -j DROP
iptables -A OUTPUT -m string --string "BitTorrent" --algo bm -j DROP
iptables -A OUTPUT -m string --string "announce_peer" --algo bm -j DROP
iptables -A OUTPUT -m string --string "BitTorrent protocol" --algo bm -j DROP
iptables -A OUTPUT -m string --string "announce.php?passkey=" --algo bm -j DROP
iptables -A OUTPUT -m string --string "magnet:" --algo bm -j DROP
iptables -A OUTPUT -m string --string "xunlei" --algo bm -j DROP
iptables -A OUTPUT -m string --string "sandai" --algo bm -j DROP
iptables -A OUTPUT -m string --string "Thunder" --algo bm -j DROP
iptables -A OUTPUT -m string --string "XLLiveUD" --algo bm -j DROP

屏蔽挖矿

iptables -A OUTPUT -m string --string "ethermine.com" --algo bm -j DROP
iptables -A OUTPUT -m string --string "antpool.one" --algo bm -j DROP
iptables -A OUTPUT -m string --string "antpool.com" --algo bm -j DROP
iptables -A OUTPUT -m string --string "pool.bar" --algo bm -j DROP
iptables -A OUTPUT -m string --string "get_peers" --algo bm -j DROP
iptables -A OUTPUT -m string --string "announce_peer" --algo bm -j DROP
iptables -A OUTPUT -m string --string "find_node" --algo bm -j DROP
iptables -A OUTPUT -m string --string "seed_hash" --algo bm -j DROP
  • -A OUTPUT: 将规则附加到 OUTPUT 链(出站流量)。
  • -m string: 使用 string 模块进行匹配。
  • --string "example": 匹配数据包内容中包含 “example” 字符串的包。
  • --algo bm: 使用 Boyer-Moore 算法进行字符串匹配。
  • -j DROP: 丢弃匹配的数据包。

挖矿池域名:ethermine.com antpool.one antpool.com pool.bar 其他挖矿池域名:

nicehash.com
slushpool.com
minergate.com
nanopool.org
f2pool.com
hashflare.io
prohashing.com
kano.is
coinotron.com

P2P 网络通信相关的字符串:get_peers announce_peer find_node seed_hash

阻止主机与已知的挖矿池进行通信,阻止与 P2P 网络相关的通信。但需要注意这些字符串匹配不会误伤到正常业务流量。

使用 iptables 屏蔽已知的挖矿池域名和相关通信,只能阻止矿池通信行为、访问恶意域名,而不能完全防止本地挖矿程序对系统资源的消耗

屏蔽测速站

iptables -A OUTPUT -m string --string ".speed" --algo bm -j DROP
iptables -A OUTPUT -m string --string "speed." --algo bm -j DROP
iptables -A OUTPUT -m string --string ".speed." --algo bm -j DROP
iptables -A OUTPUT -m string --string "fast.com" --algo bm -j DROP
iptables -A OUTPUT -m string --string "speedtest.net" --algo bm -j DROP
iptables -A OUTPUT -m string --string "speedtest.com" --algo bm -j DROP
iptables -A OUTPUT -m string --string "speedtest.cn" --algo bm -j DROP
iptables -A OUTPUT -m string --string "test.ustc.edu.cn" --algo bm -j DROP
iptables -A OUTPUT -m string --string "10000.gd.cn" --algo bm -j DROP
iptables -A OUTPUT -m string --string "db.laomoe.com" --algo bm -j DROP
iptables -A OUTPUT -m string --string "jiyou.cloud" --algo bm -j DROP
iptables -A OUTPUT -m string --string "ovo.speedtestcustom.com" --algo bm -j DROP
iptables -A OUTPUT -m string --string "speed.cloudflare.com" --algo bm -j DROP
iptables -A OUTPUT -m string --string "speedtest" --algo bm -j DROP