Page 1 of 1

PPTP VPN Server configuration

Posted: 2023 May 03, 21:15
by Mihai
Install pptpd server and ppp service

Code: Select all

[root @ centos ~] yum install -y pptpd ppp
Enable ipv4 forward
Method #1

Code: Select all

[root @ centos ~] echo 1 > /proc/sys/net/ipv4/ip_forward
Method #2

Code: Select all

[root @ centos ~] nano /etc/sysctl.conf
Edit line

Code: Select all

net.ipv4.ip_forward = 0
to

Code: Select all

net.ipv4.ip_forward = 1
Reload sysctl settings

Code: Select all

[root @ centos ~] sysctl -p /etc/sysctl.conf
net.ipv4.ip_forward = 1
Configure pptpd

Code: Select all

[root @ centos ~] nano /etc/pptpd.conf
option /etc/ppp/options.pptpd
logwtmp
bcrelay eth1
connections 10
localip 192.168.30.1
remoteip 192.168.30.2-254
Where eth1 is the LAN interface and eth0 is the WAN interface.

Configure chap-secrets with users, passwords and reserved ip addressees

Code: Select all

[root @ centos ~] nano /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
"user1" "pptpd" "password1" "192.168.60.2"
"user2" "pptpd" "password2" "*"
Firewall configuration for clients using VPN connection via LAN interface

Code: Select all

[root @ centos ~] iptables -A INPUT -i eth+ -p tcp -m multiport --dport 1723,47 -j ACCEPT
[root @ centos ~] iptables --table nat -A POSTROUTING -o eth0 -j MASQUERADE
[root @ centos ~] iptables -A FORWARD -p tcp -s 192.168.60.0/24 -j TCPMSS --syn --set-mss 1356
Start pptpd server

Code: Select all

[root @ centos ~] service pptpd start
or

Code: Select all

[root @ centos ~] /etc/init.d/pptpd start