How to install PPTP VPN on Rocky Linux 8
PPTP on Rocky Linux is provided by the EPEL repository, so enable EPEL repo by running
dnf install epel-release -y
Install the pptpd package
dnf install -y pptpd
Edit file
vi /etc/pptpd.conf
At end of the file, add
localip 10.0.0.1 remoteip 10.0.0.100-200
Edit file
vi /etc/ppp/options.pptpd
At the end, add
ms-dns 1.1.1.1 ms-dns 8.8.8.8
Start PPTPD VPN
To set PPTPD VPN server to start on boot, run
systemctl enable pptpd
To start VPN
systemctl start pptpd
To stop VPN
systemctl stop pptpd
To check status, run
systemctl status pptpd
Create a VPN user
To create a VPN user, edit the file
vi /etc/ppp/chap-secrets
Inside you can add your VPN user and password. For example
serverok pptpd ooyeegei8Ienai *
This will create a VPN user with the username “serverok” and password “ooyeegei8Ienai”.
After adding a user you need to restart the PPTPD service with the command
systemctl restart pptpd
Confire firewall to allow VPN connection
Install firewalld with command
dnf install firewalld -y
Enable and start firewalld
systemctl enable firewalld systemctl start firewalld systemctl status firewalld
Open ports needed for PPTPD VPN on the firewall
firewall-cmd --permanent --zone=public --add-port=1723/tcp firewall-cmd --permanent --add-rich-rule='rule protocol value="gre" accept' firewall-cmd --permanent --zone=public --add-masquerade firewall-cmd --reload
Enable IP forwarding by editing the file
vi /etc/sysctl.conf
In the file, add
net.ipv4.ip_forward = 1
Run
sysctl -p
See PPTPD VPN