星期三, 二月 08, 2012

linux pptpd iptables规则设置

假设xx.xx.xx.xx是vpn server 的内网ip,即pptpd.conf中的localip,yy.yy.yy.0/24 是此vpn server 分配给客户端的ip段,即romoteip。以下为正确的iptables 设置,保证能够访问外网:
sudo iptables -A INPUT -p tcp -m state --state NEW --dport 1723 -j ACCEPT sudo iptables -A INPUT -p gre -j ACCEPT sudo iptables -A OUTPUT -p gre -j ACCEPT sudo iptables -A INPUT -p tcp --sport 1723 -s xx.xx.xx.xx -j ACCEPT sudo iptables -A OUTPUT -p tcp --dport 1723 -d xx.xx.xx.xx -j ACCEPT
sudo iptables -t nat -A POSTROUTING -s yy.yy.yy.0/24 -o eth0 -j MASQUERADE