|
#!/bin/bash
echo 1 > /proc/sys/net/ipv4/ip_forward
#首先清除所有规则
iptables -F
iptables -X
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables -t nat -A PREROUTING -i eth1 -p tcp -d ! 192.168.0.0/24 --dport 80 -j REDIRECT --to-port 3128
iptables -P INPUT DROP
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp -i ! ppp0 -j ACCEPT
iptables -A INPUT -j DROP
iptables -P FORWARD DROP
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -p udp --dport 8000 -i ! ppp0 -j DROP
iptables -A FORWARD -p tcp --dport 8000 -i ! ppp0 -j DROP
iptables -A FORWARD -p tcp -i ! ppp0 -j ACCEPT
iptables -A FORWARD -j DROP |
|