@
findwho 你的VPS是ovz还是kvm还是xen, ovz的iptables语法和xen/kvm 不一样。
>n=`ifconfig | grep 'venet0:0' | awk 'NR==1 { print $1}'`
if test "$n" == venet0:0; then
# For OpenVZ
iptables -t nat -D POSTROUTING -s 10.0.0.0/8 -j SNAT --to-source `ifconfig | grep 'inet addr:'| grep -v '127\.0\.0\.' | grep -v '10\.' | grep -v '172\.' | grep -v '192\.' | cut -d: -f2 | awk 'NR==1 { print $1}'`
iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -j SNAT --to-source `ifconfig | grep 'inet addr:'| grep -v '127\.0\.0\.' | grep -v '10\.' | grep -v '172\.' | grep -v '192\.' | cut -d: -f2 | awk 'NR==1 { print $1}'`
else
# For Xen and KVM
iptables -t nat -D POSTROUTING -s 10.0.0.0/8 -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -o eth0 -j MASQUERADE
fi
iptables -D FORWARD -p tcp --syn -s 10.0.0.0/8 -j TCPMSS --set-mss 1356
iptables -A FORWARD -p tcp --syn -s 10.0.0.0/8 -j TCPMSS --set-mss 1356
iptables-save > /etc/iptables.up.rules