I would love to run all outgoing traffic (particularly torrent and web) through an PPTP VPN connection (to be specific a StrongVPN.com VPN). Everything needed to setup and more important to startup the VPN connection should be done over SSH, so everything needs to be command-line based.

My far set goal is to create a script to achieve an auto-connected always-on VPN script.

Just to be sure: It's not about setting up a PPTP-Server on the pi (there are plenty of tutorials for that) but to connect to a PPTP-Server.

  • how to disconnect? I got the connection established but I don't get how to disconnect.. Apr 7, 2013 at 11:40

1 Answer 1


To start, you will need to install pptpclient, this can be achieved by:

sudo apt-get install pptp-linux

Next, Create a file in /etc/ppp/peers with arbitrary name and the following contents:

pty "pptp $VPNHOSTNAME --nolaunchpppd --debug"
password $PASSWORD
remotename PPTP
maxfail 0

Where $VPNHOSTNAME is your VPN host name, $PASSWORD is your VPN password and $USERNAME is your VPN username.

After you have done that, you should do sudo pon $FILENAME where $FILENAME is the name of the file you saved earlier.

To start your VPN client on boot, you can follow the instructions on http://pptpclient.sourceforge.net/howto-debian.phtml (point 8 or 9, Hand configuration section)

An alternate method to make your VPN client run on boot is to make a script in /etc/init.d containing these contents:

#! /bin/sh

case "$1" in
    pon $/etc/ppp/peers/FILENAME
    echo "PPTP Started"
    poff $/etc/ppp/peers/FILENAME
    echo "PPTP Stopped."
    echo "Usage: /etc/init.d/blah {start|stop}"
    exit 1

exit 0

Then run:

update-rc.d [filename of script] defaults

To make it run at startup.

  • Awsome, you made my day. One followup question: Is there a way to check if connection has been connected inside a script?
    – terman
    Aug 22, 2012 at 18:12
  • @terman Hmm, I don't know, but from reading the docs I think not. However, I discovered a better way to run the VPN on boot, I'll link it right now. Aug 22, 2012 at 18:15
  • awesome it worked for me. Do you know how to make this work with a split tunnel? So that only local requests are put out over the VPN and most of the web surfing is done of the regular connection. I tried removing defaultroute and replacedefaultroute but it didn't work. Do you have any ideas about it?
    – Scoop
    Nov 26, 2012 at 20:38
  • when I run this I get the error In file /etc/ppp/peers/provider: unrecognized option '/dev/modem'
    – user3764
    Dec 13, 2012 at 14:42
  • 3
    You'll need to chmod +x [filename of script] before running update-rc.d
    – faulty
    Jan 9, 2013 at 11:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.