How To Setup a PPTP VPN in Ubuntu Server ?
By Fahad Ahammed
- 2 minutes read - 331 wordsVPN secures your computer’s internet connection to guarantee that all of the data you’re sending and receiving is encrypted and secured from prying eyes. You can get cheap vpn from many vpn providers. But i will show you how to get a private VPN maintained by yourself by less then 4$.
You will need a kvm. OpenVZ is normally very much painful. You can try but you need to ask your provider for accessing pptp.
After getting that install Ubuntu-12.04 in it. And then let the vpn installation begin :).
First we need to install pptp server using apt-get
Then we need to configure the pptpd.
Add server IP and client IP at the end of the file. You can add like below:
Replace 192.168.0.1 with your server ip. This sets up the PPTP server to use IP 192.168.0.1 while distributing the IP range 192.168.0.100-199
to PPTP clients. Change these as you wish as long as they are private IP addresses and do not conflict with IP addresses already used by your server.
Configure DNS servers to use when clients connect to this PPTP server
Now comment out require-mppe-128 like below
Add Googles Public DNS like below
Now add a VPN user in /etc/ppp/chap-secrets file.
The column is username. Second column is server name, you can put “pptpd” in there. Third column is password. The last column is the IP addresses, you can put * to allow all IP.
Finally start your server
Setup IP Forwarding
To enable IPv4 forward. Change /etc/sysctl.conf file, add forward rule blew.
Uncomnent the line
Then reload the configuration
Add forward rule in iptables
adding to the bottom just before the exit 0
iptables -t nat -A POSTROUTING -o <strong>eth0</strong> -j MASQUERADE
Use venet0 instead of eth0 if you have Openvz .
Now run below command.
FOR Xen/KVM :
FOR OpenVZ :
You are done. Just reboot your server and you should be able to connect to using PPTPD and send all your traffic through this server.