As we all know, VPN is very important and widely used in our organizations and in daily work, the security and privacy of the internet is more and more important. For example, I have a iphone case website which is located in Japan, I must use VPN to visit it. Here, I will use Linode VPS as example to describe how to build a PPTP VPN server in Debian/Ubuntu Linux environment.This tutorial also applies to Debian / Ubuntu Linux VPS / server based, has also been passed testing on DiaHosting, VPSYOU, Oplink, If you have any questions, welcome feedback.
Preparatory work:
A Xen-based VPS, at present few OpenVZ VPS support PPTP. Remote SSH tools, putty or XShell.
1, install PPTP server
apt-get update
apt-get install pptpd
2.Configuring PPTP server
After the installation complete, use the editor which you are familiar with, such as vi, nano or visual management tool winscp to configure: edit/etc/pptpd.conf
Look for the following code:
#localip 192.168.0.1
#remoteip 192.168.0.234-238,192.168.0.245
Replace with:
localip 192.168.217.1
remoteip 192.168.217.234-238,192.168.217.245
3. Add PPTP VPN users
Edit: /etc/ppp/chap-secrets
add the following:
username pptpd password *
Where "username" is the user name of the account which you want to add to VPN, "password" is the password for your VPN account.
4. Modify the DNS server
Edit: /etc/ppp/options, add the following:
ms-dns 8.8.8.8
ms-dns 8.8.4.4
5. Open IPv4 forwarding
Edit /etc/sysctl.conf file, remove the note "#" before net.ipv4.ip_forward = 1
Run the following command to make configuration changes to take effect
sysctl-p
Restart pptpd service
/etc/init.d/pptpd restart
6. Install iptables
7. Open iptables forwarding
iptables -t nat -A POSTROUTING -s 192.168.217.0/24 -o eth0 -j MASQUERADE
iptables-save > /etc/iptables.pptp
8. Create iptables file in the directory/etc/network/if-up.d/, content as follows:
#! /bin/sh
iptables-restore
0 comments:
Post a Comment