Ubuntu配置pptp Vpn

1.安装

apt-get install pptpd pptp-linux ppp

2.编辑/etc/ppp/pptpd-options

name pptpd
#refuse-pap
#refuse-chap
#refuse-mschap
require-mschap-v2
require-mppe-128
proxyarp
nodefaultroute
lock
nobsdcomp
ms-dns 8.8.8.8
ms-dns 4.4.4.4

3.编辑/etc/pptpd.conf

option /etc/ppp/pptpd-options
localip 192.168.0.1
remoteip 192.168.0.2-245

4.添加vpn用户,编辑/etc/ppp/chap-secrets

# client        server  secret     IP addresses
netcec1  pptpd   123456    *
netcec2  pptpd   123456    *
netcec3  pptpd   123456    *
netcec4  pptpd   123456    *
netcec5  pptpd   123456    *

5.编辑/etc/sysctl.conf
找到net.ipv4.ip_forward=1 把前面的#去掉

sysctl -p

6.防火墙

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -I POSTROUTING -j MASQUERADE
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE
iptables-save > /etc/iptables.pptp