Skip to content

Instantly share code, notes, and snippets.

@alvinl
Created April 21, 2012 20:45
Show Gist options
  • Save alvinl/2439505 to your computer and use it in GitHub Desktop.
Save alvinl/2439505 to your computer and use it in GitHub Desktop.
Script to install pptp on Debian 6
#!/bin/bash
apt-get update
apt-get install pptpd -y
echo localip 192.168.240.1 >> /etc/pptpd.conf
echo remoteip 192.168.240.2-9 >> /etc/pptpd.conf
echo ms-dns 8.8.8.8 >> /etc/ppp/pptpd-options
echo ms-dns 8.8.4.4 >> /etc/ppp/pptpd-options
echo "vpn pptpd pass123 *" | tee -a /etc/ppp/chap-secrets
/etc/init.d/pptpd restart
echo net.ipv4.ip_forward=1 >> /etc/sysctl.conf
sysctl -p
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
clear
echo Username: vpn Password: pass123
echo Change this in /etc/ppp/chap-secrets
@alvinl
Copy link
Author

alvinl commented Apr 21, 2012

How to use

Copy the following script to vpn.sh on your server

Fix permissions

chmod +x vpn.sh

Run

./vpn.sh

rc.local

Add the following line to /etc/rc.local

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

*Make sure that the file ends with "exit 0"

Notes

  • Default username: vpn
  • Default pass: pass123
  • Change or add users in /etc/ppp/chap-secrets
  • Make sure port 1723 (tcp) is open

Credit

This script simplifies the steps found here

@jcldavid
Copy link

Should I change the local IP and remote IP to the IP of my server?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment