In Vultr VPS, the entire pptp vpn process is manually built using Debian 8 i386 (jessie) as the operating system platform.
Update the server and install the PPTP Service
Apt-get update
Apt-get upgrade
Apt-get install pptpd
Edit/etc/pptpd. conf
Find # localip and # remoteip, delete # And set the ip address
Localip 172.16.31.254
Remoteip 172.16.31.234-238
Edit/etc/sysctl. conf
Remove # net. ipv4.ip _ forward = 1 and enable ipv4 forward.
Run sysctl-p after modification.
Edit/etc/ppp/pptpd-options
Modify dns server address
ms-dns 8.8.8.8
ms-dns 8.8.4.4
Edit/etc/ppp/chap-secrets
Add a PPTP account
[Note
Format:
Username1 pptpd password *
Username2 pptpd password 172.16.31.234
The first column is the user name, and the second column is the server name (pptpd by default, which must be consistent with the value of the name row in the/etc/ppp/pptpd-options file)
The third column is the password, and the fourth column is the IP limit (not limited)
The format of the first line is not fixed Client IP address, and the format of the second line is fixed Client IP Address
]
Use iptables to create NAT
Install iptablesapt-get install iptables
Add a rule to the nat table
iptables -t nat -A POSTROUTING -s 172.16.31.0/24 -o eth0 -j MASQUERADE
[Note
Eth0 is the name of the network card. You can view it through ifconfig.
]
Set MTU
iptables -I FORWARD -p tcp --syn -i ppp+ -j TCPMSS --set-mss 1356
[Note
Recommended Vultr
Note:We recommend grouping ing a MTU of 1450 on your private network. Using a larger MTU will result in poor performance.
]
Iptables rules will be cleared at the next restart. To prevent iptables loss after the machine is restarted, run
Iptables-save>/etc/iptables-rules
Edit the/etc/network/interfaces File
Find eth0 and add the following sentence at the end of eth0 settings:
Pre-up iptables-restore </etc/iptables-rules
In this way, when the network adapter eth0 is loaded, it will automatically load the configuration we saved with iptables-save in advance..
Restart PPTP Service
/Etc/init. d/pptpd restart
Edit/etc/rc. local
Add boot start
/Etc/init. d/pptpd restart
Thank you for your ideas and code!
Refer to the blog post in no particular order:
Debian vpn-time travel lazy cat-blog Park
Build a VPN In Debian
Debian pptp vpn configuration tutorial-reizhi