2010-05-29

PPTP VPN 配置注意

前两天配置PPTP VPN,网上有很多中文配置教程,一步一步配置之后客户端却总是连接不上,甚是蹊跷。偶然上poptop官网看Troubleshooting才找到原因。

大部分中文教程关于iptables部分都写到:

iptables -A INPUT -p tcp -dport 1723 -j ACCEPT
iptables -A INPUT -p tcp -dport 47 -j ACCEPT
iptables -A INPUT -p gre -j ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.8.0/24 -o eth0 -j MASQUERADE

其中第二条命令是有错误的。PPTP的FAQ中有如下两条说明:

#2. Server firewall

    Make sure your PPTP server can recieve a connection on port 1723 and that protocol 47 is being allowed or forwarded.

    If your PPTP server has iptables running

    iptables -A INPUT -p tcp --dport 1723 -j ACCEPT
    iptables -A INPUT -p 47 -j ACCEPT

    or if your PPTP server is behind a machine running iptables

    iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 1723 -j DNAT --to SERVER_IP
    iptables -t nat -A PREROUTING -i eth0 -p 47 -j DNAT --to SERVER_IP

#3. Protocol 47 NOT port 47

    This is a simple but extremely common problem. Do not get port 47 confused with protocol 47. Opening port 47 on your firewall is not the same as allowing protocol 47 or gre.
二手资料太可怕。想起一个故事:

民国时期学者古直先生隐居庐山设帐授徒,杜宣等人去拜师求教。古直问他带了什么书,杜宣说只带了一部《辞源》,古直闻听大怒:“怎么我的学生用《辞源》?”杜宣回答:“学生我有不认识的字,不查《辞源》查什么?”古直听了更加愤怒:“怎么我的学生查《辞源》?”后来气氛缓和,古直才说:“做学问,不能靠二手货,不懂的字,要查《说文》、查《尔雅》、查《水经》……要查这个字第一次出现的地方,这样才可靠。《辞源》这一类书是二手货,不可靠的。”

 
 

没有评论: