- Click to see newest VULTR COUPON , GIFTCPDE
Install Packages
Install the pptpd package on your VPS with the following command:
1 2 |
apt-get install pptpd |
Configuration
Insert new settings to /etc/pptpd.conf
and /etc/ppp/pptpd-options
by running the following commands:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
cat >/etc/pptpd.conf <<EOF option /etc/ppp/pptpd-options logwtmp localip 192.168.10.1 remoteip 192.168.10.101-200 EOF cat >/etc/ppp/pptpd-options <<EOF name pptpd refuse-pap refuse-chap refuse-mschap require-mschap-v2 require-mppe-128 proxyarp nodefaultroute lock nobsdcomp ms-dns 8.8.8.8 ms-dns 208.67.222.222 debug dump idle 300 EOF |
Edit /etc/ppp/chap-secrets
to insert VPN users.
1 2 3 |
FIRST_USERNAME pptpd PASSWORD1 * SECOND_USERNAME pptpd PASSWORD2 * |
Restart the pptpd service.
1 2 |
/etc/init.d/pptpd restart |
Enable Forwarding
Run this command to enable IPv4 forwarding. IPv4 forwarding must be enabled for the VPN to work properly.
1 2 |
sed -i 's/#net\.ipv4\.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf |
Make this change permanent.
1 2 |
sysctl -p |
Setup Routing
Create a network startup script to configure iptables.
1 2 |
touch /etc/network/if-pre-up.d/route |
Insert content to the script:
1 2 3 4 5 6 7 |
cat >/etc/network/if-pre-up.d/route <<EOF iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE iptables -I INPUT -s 192.168.10.0/24 -i ppp0 -j ACCEPT iptables --append FORWARD --in-interface eth0 -j ACCEPT EOF |
Setup this script to be executable.
1 2 |
chmod +x /etc/network/if-pre-up.d/route |
Run the script to apply these rules to iptables.
1 2 |
/etc/network/if-pre-up.d/route |
Complete
Now you can connect to your own VPN server from your PC or mobile device.