Setup PPP VPN on Debian/Ubuntu

Install Packages

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

apt-get install pptpd


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

cat >/etc/pptpd.conf <<EOFoption /etc/ppp/pptpd-optionslogwtmplocalip >/etc/ppp/pptpd-options <<EOFname pptpdrefuse-paprefuse-chaprefuse-mschaprequire-mschap-v2require-mppe-128proxyarpnodefaultroutelocknobsdcompms-dns 300EOF

Edit /etc/ppp/chap-secrets to insert VPN users.


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 <<EOFiptables -t nat -A POSTROUTING -o eth0 -j MASQUERADEiptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADEiptables -I INPUT -s -i ppp0 -j ACCEPTiptables --append FORWARD --in-interface eth0 -j ACCEPTEOF

Setup this script to be executable.

chmod +x /etc/network/if-pre-up.d/route

Run the script to apply these rules to iptables.



Now you can connect to your own VPN server from your PC or mobile device.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article

No comments

Powered by Blogger.