To set up a PPTP VPN server on Ubuntu 22.04, install the pptpd package, configure user credentials in /etc/ppp/chap-secrets, set IP addresses in /etc/pptpd.conf, enable IP forwarding, and adjust firewall rules (UFW or iptables) to allow TCP port 1723 and GRE protocol traffic, then restart the service. While simple, be aware that PPTP is considered insecure and less secure than modern protocols like OpenVPN. 

Server Setup (Manual Method)
Install PPTP Daemon:

bash
sudo apt update && sudo apt install pptpd -y 

Configure IP Addresses:
Edit /etc/pptpd.conf to define your server's local IP and the range for clients.

bash
sudo nano /etc/pptpd.conf
# Add these lines (replace IPs as needed)
localip 192.168.0.1
remoteip 192.168.0.100-200 

Add dns Servers:
Edit /etc/ppp/pptpd-options to assign dns servers (e.g. google).

bash
sudo nano /etc/ppp/pptpd-options
# Uncomment and/or add these lines
ms-dns 8.8.8.8
ms-dns 8.8.4.4 

Create VPN Users:
Edit /etc/ppp/chap-secrets.

bash
sudo nano /etc/ppp/chap-secrets
# Add users like this (use tabs for separation)
# username pptpd password * myuser pptpd mypassword * 

Enable IP Forwarding:
Edit /etc/sysctl.conf and uncomment
net.ipv4.ip_forward=1.

bash
sudo nano /etc/sysctl.conf
# Uncomment: net.ipv4.ip_forward=1 sudo sysctl -p 

Configure Firewall (UFW):
Allow port 1723 (TCP) and GRE protocol (protocol 47) and set up NAT.

bash
sudo ufw allow 1723/tcp
sudo ufw allow 47/gre
# Edit /etc/ufw/before.rules to add NAT rules (replace eth0 with your public interface)
# Add before the *filter section:
*nat :POSTROUTING ACCEPT [0:0] -A POSTROUTING -s 192.168.0.0/24 -o
eth0 -j MASQUERADE COMMIT
sudo ufw enable
# If not already enabled sudo ufw reload 

Restart PPTP Service:

bash
sudo systemctl restart pptpd 

Client Setup (Ubuntu Desktop)

Install client packages:

sudo apt install network-manager-pptp network-manager-pptp-gnome

Go to Network Settings > VPN > + > PPTP.Enter Gateway (server IP/domain), Username, Password, and check "Use MPPE encryption" in Advanced settings. 