Do you need to connect to a Windows VPN from Linux command line? It’s simple even though the Point-to-Point Tunneling Protocol (PPTP) is proprietary. First, install the pptp client for the linux command line:

sudo apt-get install pptp-linux

Then create a new file called chap-secrets, inside /etc/ppp:

sudo vim /etc/ppp/chap-secrets

This file is where your VPN username and password will be kept. Add this line to it:

your_username      PPTP    your_password        *

Apparently, you need to change ‘your_username’ and ‘your_password’ to your own. The ‘PPTP’ is just a name you give to remote server. You might want to change it to something else. It doesn’t really matter.

Next, create the basic configuration file for pptp-linux. This file must be kept inside /etc/ppp/peers but you can name it anyway you want. Let’s say, you name it ‘cnc’:

sudo vim /etc/ppp/peers/cnc

Inside the new file, add the following lines:

pty "pptp REMOTE_SERVER_IP --nolaunchpppd" 
name your_username    #use the same name you used in chap-secrets
remotename PPTP       #use the same remote name you used in chap-secrets
ipparam cnc           #use the same name you used in naming this file
require-mppe-128      #encrypt all traffic using 128-bit encryption
file /etc/ppp/options.pptp #use standard PPP options when connecting

Apparently, you need to change REMOTE_SERVER_IP to the IP address of your VPN server.

Finally, create a new script inside /etc/ppp/ip-up.d to route traffic through the new ppp0 device. This script will be running every time ppp is up. Use any filename you like. I used ‘my_traffic’.

sudo vim /etc/ppp/ip-up.d/my_traffic

As you see in this example, I use to force the kernel to route all packets directed to the IP range – to go through PPTP:

route add -net dev ppp0

Apparently, you need to change the ‘’ part with the IP range of your remote network.

That’s all! Connect with this simple command:

sudo pon cnc

In parallel, you can watch for PPTP messages with

tail -f /var/log/syslog

You need to see something like that:

Sep 14 02:09:30 vaio pppd[4516]: local IP address
Sep 14 02:09:30 vaio pppd[4516]: remote IP address 10.49.217.

This means that you have acquired a VPN IP and you are probably OK. Check ifconfig to be sure.

If you manage to connect to your VPN, you will be able to ping to the above IP range, ssh to them, etc, just like as you were in office.

When you are done, disconnect with this command:

sudo poff cnc