The instructions below are handy if you only have access to a Linux machine via terminal or just prefer to use it rather than launching it via GUI. While this is written on a Ubuntu machine, the principal are the same throughout all Debian distributions.
Installing PPP daemon.
First of all, you need to make sure that your system has the PPP daemon installed, otherwise you will need to install it for it to work.
Note: You need to run most command as a super user, so please ensure that you have sudo access before proceeding:
sudo modprobe ppp-generic
If there are no error messages, that means the package is already installed on your system. Otherwise, install the required package as below:
sudo apt-get install pptp-linux pptpd ppp curl
Create new PPTP configuration
Once installed, create a new PPTP configuration by using an editor, in this example, we will be using vi:
sudo vi /etc/ppp/peers/mpngbr
Note: You can name the above configuration to anything that you want, but to avoid confusion, we suggest you use the name that correspond to the server that you wish to connect to.
i.e mpngbr for our GBR(UK) service.
Copy the following configuration as below:
---------------------------------------------
pty "pptp gbr.mypn.co --nolaunchpppd" lock noauth nobsdcomp nodeflate name mpnusername remotename gbr require-mppe-128 usepeerdns defaultroute persist
---------------------------------------------
Replace:
gbr.mypn.co
mpnusername with the username you have registered with us.
gbr - we suggest that you put this to something simple and easy to remember, as you will need to ensure this is the same as the server that you will put in later in chap-secrets.
Save and quit the editor.
Configuring Account
Now, enter your login details into the chap-secrets file as below:
sudo vi /etc/ppp/chap-secrets
---------------------------------------------
# Secrets for authentication using CHAP # client server secret IP addresses mpnusername[TAB]gbr[TAB]mpnpassword[TAB]*
---------------------------------------------
Note: Press the [TAB] key to create a spacing between the details above, instead of the [SPACE] key.
Replace mpnusername with your My Private Network Username and mpnpassword with your My Private Network Password.
Save and quit the editor.
Replace Default Route
This script is required so that your Internet traffic is routed through the VPN.
sudo vi /etc/ppp/ip-up.d/routevpn
---------------------------------------------
#!/bin/bash H=`ps aux | grep 'pppd pty' | grep -v grep | awk '{print $14}'` DG=`route -n | grep UG | awk '{print $2}'` DEV=`route -n | grep UG | awk '{print $8}'` route add -host $H gw $DG dev $DEV route del default $DEV route add default dev ppp0
---------------------------------------------
Save and exit the editor. You now need to make the above script executable:
sudo chmod +x /etc/ppp/ip-up.d/routevpn
Connect / Disconnect VPN
To connect to the VPN, simply type in:
sudo pon mpngbr
To confirm if you are indeed connected and getting our VPN IP address, open your browser and head on to My Private Network IP Info page to check your IP address.
You can also check this by typing in ifconfig and see if the ppp0 adapter is running.
To disconnect, simply type in:
sudo poff mpngbr
Problems?
If you are having problems connecting to the VPN but not sure where exactly it's failing, launch another terminal and type in:
tail -f /var/log/syslog
This allows you to see if there is a problem somewhere with the configuration or the VPN is just not routing correctly.
Note: The location of the network connection log might be different depending on your Linux distribution and version, check the manual for more details.