[root@s2 ~]# cat ipt.sh
IPT=''/sbin/iptables''
OUT_IP="192.168.40.1"
OUT_IF="eth0"
LAN_NET=''192.168.0.0-192.168.3.255''
$IPT -F
$IPT -t nat -F
$IPT -t mangle -F
$IPT -t raw -F
$IPT -X
$IPT -P INPUT DROP
$IPT -P FORWARD DROP
$IPT -P OUTPUT ACCEPT
/sbin/sysctl -w net.ipv4.ip_forward=1
$IPT -A INPUT -p tcp --dport 3128 -i ! eth0 -j ACCEPT
$IPT -A INPUT -p tcp --dport 3000 -j ACCEPT
$IPT -A INPUT -p icmp -j ACCEPT
$IPT -A INPUT -s 192.168.40.14 -p udp --dport 161 -j ACCEPT
$IPT -A INPUT -s 192.168.1.100 -p tcp --dport 22 -j ACCEPT
$IPT -A FORWARD -s 192.168.1.100 -d 192.168.40.0/24 -p tcp -j ACCEPT
$IPT -A FORWARD -m iprange --src-range $LAN_NET -p udp -m multiport --dport 53,67 -j ACCEPT
$IPT -A FORWARD -p icmp -j ACCEPT
$IPT -A FORWARD -m iprange --src-range $LAN_NET -p tcp -m multiport --dport 25,80,110,143 -j ACCEPT
$IPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPT -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPT -t nat -A PREROUTING -i ! $OUT_IF -m iprange --src-range $LAN_NET -p tcp --dport 80 -j REDIRECT --to-ports 3128
$IPT -t nat -A POSTROUTING -m iprange --src-range $LAN_NET -o $OUT_IF -j SNAT --to-source $OUT_IP
[root@s2 ~]#
[root@s2 ~]# . ipt.sh
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
net.ipv4.ip_forward = 1
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
[root@s2 ~]#