beta.blog

Archive for February, 2014

Debian: Install pptpd (script)

by on Feb.18, 2014, under Linux (Ubuntu)

Due to the fact I frequently set up new debian servers (either VPS or rootservers) and often had to install a VPN solution on these servers, here’s another approach of me hopefully going through the hassle of figuring out the entire install process for the very last time.

Download link: Click
1. Download file with wget
2. mv install_pptpd.sh_.txt install_pptpd.sh
3. chmod a+x install_pptpd.sh
4. ./install_pptpd.sh

What it will do:
It will install a pptp server, enable IPv4 forwarding, enable internet access for VPN clients and create a PPTP user called vpnuser with the password vpnpassword. You may afterwards establish a vpn connection to your server with these login credentials.

Please keep in mind that the sysctl and iptables commands are temporary and not bootsafe the way they are used in my script and as such will reset whenever you reboot. In order to access the internet afterwards again, you’d have to call the last 3 lines of the script again (or simply add startup rules for these actions).

apt-get install pptpd -y --force-yes
echo "localip 192.168.1.5" >> /etc/pptpd.conf
echo "remoteip 192.168.1.234-238,192.168.1.245" >> /etc/pptpd.conf
echo "ms-dns 8.8.8.8" >> /etc/ppp/pptpd-options
echo "nobsdcomp" >> /etc/ppp/pptpd-options
echo "noipx" >> /etc/ppp/pptpd-options
echo "mtu 1490" >> /etc/ppp/pptpd-options
echo "mru 1490" >> /etc/ppp/pptpd-options
echo "vpnuser * vpnpassword *" >> /etc/ppp/chap-secrets
/etc/init.d/pptpd restart
sysctl -w net.ipv4.ip_forward=1
sysctl -p
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Make sure to adjust line #9 according to your needs (vpnuser and vpnpassword).

If you’d like to uninstall this again call the following command:

apt-get --purge autoremove pptpd -y --force-yes
Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!