Knowledgebase
Sarail Net > Support Ticket > Knowledgebase

Search help:


How to Install VPN PPTP in ubuntu 16.04

Solution

You can configure pptp VPN server and client from the terminal using these steps:

VPN Server Setup:

Install and update the VPN server and client packages:

$ sudo apt-get install pptpd ppp pptp-linux

Four files has to be configured for the server:

  • /etc/pptpd.conf
  • /etc/ppp/pptpd-options
  • /etc/ppp/options
  • /etc/chat-secrets)

/etc/pptpd.conf:

option /etc/ppp/pptpd-options
logwtmp
localip 192.168.23.20
remoteip 192.168.23.30-39

/etc/ppp/pptpd-options:

name pptpd
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128
proxyarp
nodefaultroute
lock
nobsdcomp
noipx ## you don’t need IPX
mtu 1490 ## may help your linux client from disconnecting
mru 1490 ## may help your linux client from disconnecting

/etc/ppp/options:

lock

/etc/ppp/chap-secrets:

# Secrets for authentication using CHAP
# client    server  secret  IP addresses

[username]  pptpd [userpass] *

(The [username] and [userpass] are entries without the brackets.)

Now restart the server with:

$ sudo service pptpd restart

VPN Client Setup:

Four configuration files are involved:

  • /etc/ppp/peers/myvpn
  • /etc/ppp/options.pptp
  • /etc/ppp/chap-secrets
  • /etc/ppp/ip-up.local

/etc/ppp/peers/myvpn:

# replace the bracket paramters with the host name of the VPN server and VPN user
remotename myvpn
linkname myvpn
ipparam myvpn
pty "pptp [vpn server] --nolaunchpppd "
name [username]
usepeerdns
require-mppe
refuse-eap
noauth

# adopt defaults from the pptp-linux package
file /etc/ppp/options.pptp

/etc/ppp/options.pptp:

lock
noauth
refuse-pap
refuse-eap
refuse-chap
refuse-mschap
nobsdcomp
nodeflate

/etc/ppp/chap-secrets:

# Secrets for authentication using CHAP
# client    server  secret  IP addresses
username myvpn password *

/etc/ppp/ip-up.local:

#!/bin/sh
network=`echo $IPREMOTE | awk -F\. '{print $1"."$2"."$3".0/24"}'`
route add -net $network $IFNAME

Configure routing with iptables:

 

iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 1723 -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.23.0/24 -j MASQUERADE
service iptables save
service iptables start

Connect the VPN client with:

$ sudo pon myvpn

End the VPN connection with:

$ sudo poff myvpn
 
Was this article helpful? yes / no
Related articles Mikrotik v7.x VRRP explained
Basic Iptables Firewall on Centos 6
How to Install Apache, MySQL and PHP on Ubuntu 16.04
Article details
Article ID: 9
Category: Knowledgebase
Rating (Votes): Article rated 3.3/5.0 (14)

 
« Go back

 
Powered by Help Desk Software HESK, in partnership with SysAid Technologies