不过下面的东西加载后, 打开网页的速度明显变慢, 而且有时候显示无法链接,需要刷新几次才可以。 这是问什么呢?
代码: 全选
#删除原来 iptables 里面已经有的规则
iptables -F
iptables -X
#抛弃所有不符合三种链规则的数据包
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
#设置:本地进程 lo 的 INPUT 和 OUTPUT 链接 ; wlan0的 INPUT链
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i wlan0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i wlan0 -m state --state NEW,INVALID -j LOG
iptables -A OUTPUT -o lo -j ACCEPT
#对其他主要允许的端口的 OUTPUT设置:
# DNS
iptables -A OUTPUT -o wlan0 -p TCP --sport 1024:65535 --dport 53 -j ACCEPT
iptables -A OUTPUT -o wlan0 -p UDP --sport 1024:65535 --dport 53 -j ACCEPT
#HTTP
iptables -A OUTPUT -o wlan0 -p TCP --sport 1024:65535 --dport 80 -j ACCEPT
#HTTPS
iptables -A OUTPUT -o wlan0 -p TCP --sport 1024:65535 --dport 443 -j ACCEPT
#Email 接受 和发送
iptables -A OUTPUT -o wlan0 -p TCP --sport 1024:65535 --dport 110 -j ACCEPT
iptables -A OUTPUT -o wlan0 -p TCP --sport 1024:65535 --dport 25 -j ACCEPT
#DHCP
iptables -A OUTPUT -o wlan0 -p TCP --sport 1024:65535 --dport 68 -j ACCEPT
iptables -A OUTPUT -o wlan0 -p UDP --sport 1024:65535 --dport 68 -j ACCEPT
iptables -A INPUT -i wlan0 -p tcp -j REJECT --reject-with tcp-reset
iptables -A INPUT -i wlan0 -p udp -j REJECT --reject-with icmp-port-unreachable