A-A+

Setup PPP VPN on Debian/Ubuntu

2014年11月01日 VPS教程 暂无评论

Install Packages
Install the pptpd package on your VPS with the following command:

apt-get install pptpd
Configuration
Insert new settings to /etc/pptpd.conf and /etc/ppp/pptpd-options by running the following commands:

cat >/etc/pptpd.conf <<EOF
option /etc/ppp/pptpd-options
logwtmp
localip 192.168.10.1
remoteip 192.168.10.101-200
EOF

cat >/etc/ppp/pptpd-options <<EOF
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 208.67.222.222
debug
dump
idle 300
EOF
Edit /etc/ppp/chap-secrets to insert VPN users.

FIRST_USERNAME pptpd PASSWORD1 *
SECOND_USERNAME pptpd PASSWORD2 *
Restart the pptpd service.

/etc/init.d/pptpd restart
Enable Forwarding
Run this command to enable IPv4 forwarding. IPv4 forwarding must be enabled for the VPN to work properly.

sed -i 's/#net\.ipv4\.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf
Make this change permanent.

sysctl -p
Setup Routing
Create a network startup script to configure iptables.

touch /etc/network/if-pre-up.d/route
Insert content to the script:

cat >/etc/network/if-pre-up.d/route <<EOF
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE
iptables -I INPUT -s 192.168.10.0/24 -i ppp0 -j ACCEPT
iptables --append FORWARD --in-interface eth0 -j ACCEPT
EOF
Setup this script to be executable.

chmod +x /etc/network/if-pre-up.d/route
Run the script to apply these rules to iptables.

/etc/network/if-pre-up.d/route
Complete
Now you can connect to your own VPN server from your PC or mobile device.

标签:
  • 版权所有:©2012-2016 主机测评. All rights reserved
  • 内容来源:"优惠信息"为站长翻译官方信息,“测评”,“商家介绍”,“教程”等为站长原创
  • 安全提醒:购买请仔细阅读商家条款,阅读本站网友评论、或加群咨询,谨慎交易,自担风险
  • 联系站长: QQ 20510761,支持主机代购、代付等
  • 邮件订阅点击此处,订阅“主机测评”
  • QQ群聊:486721,第一手热门资讯及时获取,欢迎任何健康的交流内容。

给我留言