首页 > 安全 > 杀毒防毒 >

OpenWrt路由器iptables防火墙设置

2012-11-30

OpenWrt自带防火墙有点复杂,自己根据需要重新配置了下iptables,可满足一般用户需求。#/bin/bash#OpenWrt防火墙,适用于RG100AAiptables -Fiptables -Xiptables -Ziptables -P INPUT DROPiptables -P O...

OpenWrt自带防火墙有点复杂,自己根据需要重新配置了下iptables,可满足一般用户需求。

#/bin/bash
#OpenWrt防火墙,适用于RG100AA
iptables -F
iptables -X
iptables -Z
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i br-lan -j ACCEPT
#iptables -A INPUT -m string --algo bm --string "sex" -j DROP
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
#iptables -A FORWARD -m string --algo bm --string "sex" -j DROP
iptables -A FORWARD -i br-lan -o pppoe-wan -j ACCEPT
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
#iptables -A FORWARD -p tcp --dport 12488 -j ACCEPT
#iptables -A FORWARD -p udp --dport 12488 -j ACCEPT
iptables -t nat -F
iptables -t nat -X
iptables -t nat -Z
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P POSTROUTING ACCEPT
iptables -t nat -P OUTPUT ACCEPT
iptables -t nat -A POSTROUTING -i br-lan -o pppoe-wan -j MASQUERADE
#iptables -t nat -A PREROUTING -p tcp --dport 12488 -j DNAT --to-destination 192.168.1.6
#iptables -t nat -A PREROUTING -p udp --dport 12488 -j DNAT --to-destination 192.168.1.6
#iptables -t mangle -F
#iptables -t mangle -X
#iptables -t mangle -Z
#iptables -t mangle -A PREROUTING -i pppoe-wan -j TTL --ttl-inc 1
#iptables -t mangle -A POSTROUTING -o pppoe-wan -j TTL --ttl-set 128
#iptables -t mangle -A POSTROUTING -o pppoe-wan -j IPID --ipid-pace 1
#iptables -I FORWARD -p tcp --tcp-flags RST RST -j DROP

相关文章
最新文章
热点推荐