Instantly share code, notes, and snippets.

@yyang /
Last active Oct 11, 2018

What would you like to do?
centos 7 pptpd firewalld
# pptpd installation script on my own CentOS 7 box.
# inspired by:
# and
# Author: 2015 Steve Yang <>
# The script comes with ABSOLUTELY NO WARRANTY.
# Install pptpd
rpm -Uvh
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<<EOF
<?xml version="1.0" encoding="utf-8"?>
<port protocol="tcp" port="1723"/>
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

This comment has been minimized.

blueandhack commented Oct 23, 2015

The first command doesn't work
So you can change that to rpm -Uvh


This comment has been minimized.

wanyancan commented Mar 17, 2016

the firewalld part works perfectly for me on Centos 7.


This comment has been minimized.

voron commented Mar 25, 2016

There is no protocol 47(GRE) accept. for example


This comment has been minimized.

amanualt commented Nov 8, 2017

is there any other settings on centos 7?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment