Connect to a PPTP VPN Server from Linux Terminal | Drupal 8

Connect to a PPTP VPN Server from Linux Terminal

Submitted by editor on Wed, 06/13/2018 - 17:55
Question

How to connect to a PPTP VPN Server from Debian (Ubuntu, Linux Mint ...) using linux terminal.

Step 1 : Install pptp client.

sudo apt-get -y install pptp-linux

Step 2 : Setup PPTP Client

Add secret:

File : /etc/ppp/chap-secrets
You can use:
sudo nano /etc/ppp/chap-secrets

Syntax :
<username> <server_name> <password> <ip_address>

Example :
# Secrets for authentication using CHAP
# client        server  secret                  IP addresses
yourname         myvpn YourPassword             *

Step 3 : Create VPN connection:

Example for myvpn
sudo nano /etc/ppp/peers/myvpn

Example:
pty "pptp IP-OR-HOST-NAME --nolaunchpppd"
name yourname
remotename myvpn
require-mppe-128
file /etc/ppp/options.pptp
ipparam myvpn

Step 4 : Create a route script that will get run after the PPP connection establishes.

Create file :
sudo nano /etc/ppp/ip-up.d/99vpnroute
Then add:

#!/bin/bash
if [ "$PPP_IPPARAM" == "myvpn" ]; then
        route add -net 192.168.20.0/24 dev $PPP_IFACE
fi

Then Make the vpn route script executable:

sudo chmod +x /etc/ppp/ip-up.d/99vpnroute

 

Connecting to the PPTP VPN Server

To connect to the remote PPTP VPN server, issue the following command:

sudo pon myvpn
#or
sudo pppd call myvpn

Disconnecting from the PPTP VPN Server

The simplest way to disconnect from the PPP connection is to use the following command:

sudo poff myvpn
#To kill all active PPP connections, you can use the following:
sudo killall pppd
or
sudo kill `cat /var/run/ppp0.pid`

Log:

If the ppp connection doesn’t get established, check the /var/log/FILE log file for errors:

sudo tail -f /var/log/syslog
sudo tail -f /var/log/lastlog
sudo tail -n 25 /var/log/THE_LOG_FILE

 

 

Add new comment