PPTP VPN with CentOS 7 + firewalld

I've recently tried to install PPTP VPN server on CentOS 7 but still having some issues. After spending sometime we figured out a way let the service properly working with firewalld.

A detailed instruction is presented by Digital Ocean: https://www.digitalocean.com/community/questions/how-to-install-pptp-vpn-on-centos-7

To make it working with firewalld, we've made a few updates, and the script is pasted here: gist


# Install pptpd
rpm -Uvh http://download.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-1.noarch.rpm
yum -y install ppp pptpd

# pptpd settings
echo 'localip' >> /etc/pptpd.conf
echo 'remoteip' >> /etc/pptpd.conf
echo 'ms-dns' >> /etc/ppp/options.pptpd
echo 'ms-dns' >> /etc/ppp/options.pptpd
echo 'USERNAME pptpd PASSWORD *' >> /etc/ppp/chap-secrets

# system ipv4 forward
if grep -xq 'net.ipv4.ip_forward' $sysctl_file; then
sed -i.bak -r -e "s/^.*net.ipv4.ip_forward.*/net.ipv4.ip_forward = 1/" $sysctl_file
echo 'net.ipv4.ip_forward = 1' >> $sysctl_file
sysctl -p

# firewalld
firewall-cmd --permanent --new-service=pptp
cat >/etc/firewalld/services/pptp.xml<

firewall-cmd --permanent --zone=$zone --add-service=pptp
firewall-cmd --permanent --zone=$zone --add-masquerade
firewall-cmd --reload

# start pptpd
systemctl start pptpd
systemctl enable pptpd.service