To connect to PPTP server from command line on Ubuntu/Linux, create file
sudo vi /etc/ppp/peers/honvpn
Here honvpn is name of the connection, this can be anything. Add following content to the file.
pty "pptp 35.154.48.22 --nolaunchpppd" name hostonnet password tpmH7cb@zKHxAD remotename PPTP require-mppe-128
Here 35.154.48.22 is IP of PPTP server.
hostonnet is the PPTP server username.
tpmH7cb@zKHxAD is the PPTP server password.
Now to connect to VPN, run
sudo pppd noauth call honvpn
After connect, you get a ppp0 interface
If you don’t use noauth, you get authentication related error like
boby@hon-pc-01:~ $ sudo pppd call honvpn pppd: The remote system is required to authenticate itself pppd: but I couldn't find any suitable secret (password) for it to use to do so. boby@hon-pc-01:~ $
This can be fixed by editing /etc/ppp/options
sudo vi /etc/ppp/options
Find
# Require the peer to authenticate itself before allowing network # packets to be sent or received. # Please do not disable this setting. It is expected to be standard in # future releases of pppd. Use the call option (see manpage) to disable # authentication for specific peers. auth
Replace “auth” with “noauth”.
To disconnect, you can just kill all pppd processes.
boby@hon-pc-01:~ $ ps aux | grep ppp root 11942 0.0 0.0 33360 2648 ? Ss 23:05 0:00 pppd call honvpn root 11943 0.0 0.0 4508 700 ? S 23:05 0:00 sh -c pptp 35.154.48.203 --nolaunchpppd root 11946 0.0 0.0 6476 792 ? S 23:05 0:00 pptp 35.154.48.203 --nolaunchpppd root 11957 0.0 0.0 6476 124 ? S 23:05 0:00 pptp 35.154.48.203 --nolaunchpppd boby 15344 0.0 0.0 14224 932 pts/20 S+ 23:47 0:00 grep --color=auto ppp boby@hon-pc-01:~ $ sudo kill -9 11942 boby@hon-pc-01:~ $ ps aux | grep ppp boby 15396 0.0 0.0 14224 1016 pts/20 S+ 23:47 0:00 grep --color=auto ppp boby@hon-pc-01:~ $