Chapter Three Part Three Section One: How To Build A PPTP VPN

Looking for a simple, stable and significant VPS as your web hosting? Check out DigitalOcean, only $5 per month, and you can get $10 in credit just for signing up now.

PPTP VPN

After connecting to your server via SSH, you can build your own PPTP VPN with the following 8 steps:

1. Install PPTPD

Install the PPTPD package with the following command:

apt-get install pptpd

2. Edit the VPN interface IP addresses

Open the pptpd.conf file with the following code:

nano /etc/pptpd.conf

Press the Enter key, find and uncomment the following 2 lines:

#localip 192.168.0.1
#remoteip 192.168.0.234-238,192.168.0.245

3. Edit DNS addresses

Enter the following command:

nano /etc/ppp/pptpd-options

Find the following codes:

#ms-dns 10.0.0.1
#ms-dns 10.0.0.2

And change them to the following ones:

ms-dns 8.8.8.8
ms-dns 8.8.4.4

4. Add VPN accounts

Enter the following command:

nano /etc/ppp/chap-secrets

Press the Return key and enter the following information:

username pptpd password *

For example:

freenuts pptpd 123456 *

5. Forward IPv4

Enter the following command:

nano /etc/sysctl.conf

Press the Return key, find and uncomment the following line:

#net.ipv4.ip_forward=1

6. Apply the forward

Your forward change won't be active immediately, and you need to apply it with the following commend:

sysctl -p

If everything is correct, then you can see the following result:

net.ipv4.ip_forward = 1

7. Allow the routing

Copy and paste the following command:

iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE

Press the Return key to run the command.

8. Restart PPTPD

Copy and paste the following command:

/etc/init.d/pptpd restart

Press the Return key, then you can use your PPTP VPN with the username and password you've set before.

Spread the love
This entry was posted in E-book and tagged , . Bookmark the permalink.