清除所有规则
iptables -F
禁止所有进站/转发 允许所有出站
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
允许已建立的进站 允许PING 允许本机内部环回
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
iptables -A INPUT -i lo -p all -j ACCEPT
允许已建立的转发
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -p udp --dport 2408 -d 162.159.192.1 -j ACCEPT
iptables -t nat -A PREROUTING -p udp --dport 8443 -j DNAT --to-destination 162.159.192.1:2408
iptables -t nat -A POSTROUTING -d 162.159.192.1 -p udp --dport 2408 -j MASQUERADE
sysctl -w net.ipv4.ip_forward=1
允许进站端口
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
iptables -A INPUT -p udp --dport 53 -j ACCEPT
iptables -A INPUT -p udp --dport 8443 -j ACCEPT
iptables -A INPUT -p udp --dport 2408 -j ACCEPT
iptables -A INPUT -p udp --dport 4000 -j ACCEPT
关键词封锁
iptables -A OUTPUT -m string --string "torrent" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string ".torrent" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "peer_id=" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "announce" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "info_hash" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "get_peers" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "find_node" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "BitTorrent" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "announce_peer" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "BitTorrent protocol" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "announce.php?passkey=" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "magnet:" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "xunlei" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "sandai" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "Thunder" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "XLLiveUD" --algo bm --to 65535 -j DROP
热议
2楼 lemonSSS 12小时前
收藏了
3楼 KDE 12小时前
参考
1 Security Guide Red Hat Enterprise Linux 6 _ Red Hat Customer Portal.html
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html-single/security_guide/index#sect-Security_Guide-Firewalls-Using_IPTables
2『原创』iptables 封禁 BT_PT_SPAM(垃圾邮件)和自定义端口_关键词 一键脚本 _ 逗比根据地.html
https://doubibackup.com/tfma58rb.html
4楼 micms 12小时前
优秀mark大佬教程
5楼 hostloc8888 12小时前
既然要禁用,肯定是当梯子才禁;既然当梯子,https://toutyrater.github.io/routing/bittorrent.html
6楼 gavin 4小时前
绑定 收藏
7楼 mywltd 3小时前
可以在母鸡设置吗,防止客户挂bt
8楼 爱国者捣蛋 3小时前
绑定 收藏
9楼 KDE 3小时前
可以在母鸡设置吗,防止客户挂bt
母鸡多IP,然后小鸡分公网公网,这种情况就要在网关设置.
申明:本文内容由网友收集分享,仅供学习参考使用。如文中内容侵犯到您的利益,请在文章下方留言,本站会第一时间进行处理。