Skip to content

Instantly share code, notes, and snippets.

@freizl
Last active April 10, 2019 10:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save freizl/5991115 to your computer and use it in GitHub Desktop.
Save freizl/5991115 to your computer and use it in GitHub Desktop.
PPTPD VPN in CentOS 6

Install packages

yum install ppp iptables
rpm -Uvh http://poptop.sourceforge.net/yum/stable/rhel6/pptp-release-current.noarch.rpm
yum install pptpd

Route config

  • vi /etc/sysctl.conf
  • net.ipv4.ip_forward = 1
  • verify it: /sbin/sysctl -p

ppp config

/etc/ppp/options.pptpd

update dns config with google dns

ms-dns 8.8.8.8
ms-dns 8.8.4.4

/etc/pptpd.conf

localip 10.8.8.1
remoteip 10.8.8.2-245

/etc/ppp/chap-secrets

add pptpd login account, e.g. buddy pptpd "mypassword" *

start pptpd

  • chkconfig pptpd on
  • service pptpd start

iptables

add following rules then /etc/init.d/iptables restart

/sbin/iptables -A INPUT -p tcp --dport 1723 -j ACCEPT
/sbin/iptables -A INPUT -p tcp --dport 47 -j ACCEPT
/sbin/iptables -A INPUT -p gre -j ACCEPT
iptables -A POSTROUTING -t nat -s 10.8.8.0/24 -o eth0 -j MASQUERADE

PS: the last rule seems not correct thus I change following to rules config file NAS part directly

  • -I POSTROUTING -s 10.8.8.0/24 -o eth0 -j MASQUERADE

Reference

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