Installation
Installthe pptpd package.
Configuration
Tip:Configuration examples can be found in the /usr/share/doc/pptpd directory.Atypical configuration may look like:
/etc/pptpd.conf
# Read man pptpd.conf, see samples in /usr/share/doc/pptpd# and write your pptpd configuration here# pppd options file. By default, /etc/ppp/options is usedoption/etc/ppp/options.pptpd# Server IP in local networklocalip192.168.1.2# IP address ranges used to assign IPs to new connecting clients# Here we define two ranges for our 192.168.1.* subnet: 234-238 and 245remoteip192.168.1.234-238,192.168.1.245Nowcreate the pppd options file, in our example this is /etc/ppp/options.pptpd:
/etc/ppp/options.pptpd
# Read man pppd to see the full list of available options# The name of the local system for authentication purposesnamepptpd# Refuse PAP, CHAP or MS-CHAP connections but accept connections with# MS-CHAPv2 or MPPE with 128-bit encryption
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128
# Add entry to the ARP system table
proxyarp
# For the serial device to ensure exclusive access to the device
lock
# Disable BSD-Compress and Van Jacobson TCP/IP header compression
nobsdcomp
novj
novjccomp
# Disable file logging
nolog
# DNS servers for Microsoft Windows clients. Using Google's public servers herems-dns8.8.8.8ms-dns8.8.4.4Note:Ensure the file ends with a newline to prevent possible parsing issues.Nowcreate credentials file for authenticating users:
/etc/ppp/chap-secrets
# Secrets for authentication using CHAP# client server secret IP addresses user2 pptpd 123 *Nowyou can be authenticated with user2 as username and 123 for password.Createa sysctl configuration file /etc/sysctl.d/30-ipforward.conf and enable kernel packet forwarding that allow connecting clients to have access to your subnet (see also Internet Share#Enable packet forwarding):
/etc/sysctl.d/30-ipforward.conf
net.ipv4.ip_forward=1Nowapply changes to let the sysctl configuration take effect:# sysctl --systemiptablesfirewall configurationConfigureyour iptables settings to enable access for PPTP Clients# Accept all packets via ppp* interfaces (for example, ppp0)iptables-A INPUT -i ppp+ -j ACCEPTiptables-A OUTPUT -o ppp+ -j ACCEPT# Accept incoming connections to port 1723 (PPTP)iptables-A INPUT -p tcp --dport 1723 -j ACCEPT# Accept GRE packetsiptables-A INPUT -p 47 -j ACCEPTiptables-A OUTPUT -p 47 -j ACCEPT# Enable IP forwardingiptables-F FORWARDiptables-A FORWARD -j ACCEPT# Enable NAT for eth0 on ppp* interfacesiptables-A POSTROUTING -t nat -o eth0 -j MASQUERADEiptables-A POSTROUTING -t nat -o ppp+ -j MASQUERADENote:Ensure that "eth0" is replaced with the actual ethernet interface connected to the server.Nowsave the new iptables rules with:# iptables-save > /etc/iptables/iptables.rulesToload /etc/iptables/iptables.rules automatically after boot, enable the iptables.service unit.ReadIptables for more information.UFWfirewall configurationConfigureyour ufw settings to enable access for PPTP Clients.Youmust change default forward policy in /etc/default/ufw
/etc/default/ufw
DEFAULT_FORWARD_POLICY="ACCEPT"Nowchange /etc/ufw/before.rules, add following code after header and before *filter line
/etc/ufw/before.rules
# nat Table rules
*nat
:POSTROUTING ACCEPT [0:0]
# Allow traffic from clients to eth0-APOSTROUTING -s 192.168.1.0/24 -o eth0 -j MASQUERADE# commit to apply changes
COMMIT
AllowGRE packets (protocol 47) in /etc/ufw/before.rules, find the line with: # drop INVALID packets and add rule:
/etc/ufw/before.rules
# drop INVALID packets (logs these in loglevel medium and higher)-Aufw-before-input -p 47 -i $iface -j ACCEPT-Aufw-before-input -m conntrack --ctstate INVALID -j ufw-logging-deny-Aufw-before-input -m conntrack --ctstate INVALID -j DROPOpenpptp port 1723ufwallow 1723Restartufw for good measureufwdisableufwenableStartthe serverNowyou can start and enable your PPTP Server using pptpd.service.
Troubleshooting
Aswith any service, see Systemd#Troubleshooting to investigate errors.Error619 on the client sideSearchfor the logwtmp option in /etc/pptpd.conf and comment it out. When this is enabled, wtmp will be used to record client connections and disconnections.#logwtmppptpd[xxxxx]:Long config file line ignoredAdda blank line at the end of /etc/pptpd.conf. [1]ppp0:ppp: compressor dropped pktIfyou have this error while a client is connected to the server, add the following script to /etc/ppp/ip-up.d/mppefixmtu.sh:#!/bin/shCURRENT_MTU="`ip link show $1 | grep -Po '(?<=mtu )([0-9]+)'`"FIXED_MTU="`expr $CURRENT_MTU + 4`"iplink set $1 mtu $FIXED_MTUMakethe script executable.Seealso: [2]