How to setup VPN server on Ubuntu VPS

Setup VPN on a Ubuntu VPS (I’m using Linode)

1. Install PPTP
sudo apt-get install pptpd

2. Modify /etc/pptpd.conf

localip 192.168.0.1
remoteip 192.168.0.234-238,192.168.0.245

3. Modify /etc/ppp/pptpd-options

#refuse-mschap
require-mschap-v2 #for iPhone
ms-dns 8.8.8.8
ms-dns 8.8.4.4

4. Setup VPN account
Modify /etc/ppp/chap-secrets, add an account like:

USERNAME pptpd PASSWORD *

5. Restart PPTP
/etc/init.d/pptpd restart

6. Enable IP forwarding
Modify /etc/sysctl.conf, uncomment

net.ipv4.ip_forward=1

7. Run sysctl -p to make change effective

8. Add forwarding rule
iptables -A FORWARD -s 192.168.0.0/24 -j ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE

image_pdf

Leave a Reply

Your email address will not be published. Required fields are marked *