I have recommended how to set up the PPTP VPN service in the article "VPs initial experience and self-built VPN service". This article has made some modifications and supplements based on the original article, and added"
How to connect to pptp vpn on Linux.
The running environment involved in this article: the remote server is configured with low xen VPs on vpslink (note that pptp vpn cannot be installed in openvz VPs), and the Linux system is Ubuntu 9.04, the local server is Ubuntu server 9.10 installed in the virtualbox virtual machine.
1. How to quickly build a VPN (PPTP)
# Install the server software
Apt-Get install pptpd
# Configure the IP address range, edit/etc/pptpd. conf, and add the following address at the end:
Localip 192.168.0.1
Remoteip 192.168.0.234-238,192.168 .0.245
# Set the IP address range that can be obtained after the external computer connects to the VPN through PPTP and the IP address of the server.
# Add a user, edit/etc/PPP/chap-secrets, and add similar entries below:
Username pptpd password *
# Restart the pptpd Service
/Etc/init. d/pptpd restart
# EDIT:/etc/PPP/options. Find the "MS-DNS" project in it:
MS-DNS 8.8.8.8
MS-DNS 8.8.4.4
# Allow forwarding, edit/etc/sysctl. conf, and check whether the net. ipv4.ip _ forward parameter is 1, or directly execute the following command to view
Sysctl net. ipv4.ip _ forward
# If the output is 0, modify net. ipv4.ip _ forward in/etc/sysctl. conf, change 0 to 1, and then run the following command.
Sysctl-P
# Finally, run this command to enable iptables forwarding support:
/Sbin/iptables-T Nat-A postrouting-s 192.168.0.0/24-O eth0-J Masquerade
/Sbin/iptables-I forward-p tcp-syn-I PPP +-J tcpmss-set-MSS 1356
# Add the two to the beginning of exit 0 in/etc/rc. Local. After restart, no execution is required.
# Well, pptp vpn has been set up here. Now you can use the VPN connection tool that comes with windows to connect. This should be very simple. Next I will talk about how to manually configure PPTP VPN connection on Ubuntu.
2. How to connect to pptp vpn on Linux
# Install the PPTP client on Linux
Apt-Get install PPTP-Linux
# Add the following two rows to/etc/rc. Local and put them in front of exit 0.
/Usr/sbin/pptpsetup-createLable-ServerIP-UsernameUsername-PasswordPassword-Encrypt
/Usr/sbin/pppd callLable
# Note: These two commands are the easiest way to establish a PPTP connection.
Label: User-Defined
IP: the IP address of the VPN.
Username and password: the user name and password used to log on to the VPN
# Add the following two lines to/etc/PPP/IP-up, delete the default gateway, and use the VPN Server as the default gateway, that is, change the routing policy, transfer Traffic through the vpn line.
/Sbin/route add default GW 192.168.0.1
/Sbin/route del default GWOriginal Gateway// The original default gateway address can be obtained through the route command
# In addition, if you want to use this server as the gateway server, set the net. ipv4.ip _ forward parameter in the pptp vpn section. Add the following two rows to/etc/rc. Local.
/Sbin/iptables-T Nat-A postrouting-SIntranet IP Address/24-O ppp0-J Masquerade
/Sbin/iptables-I forward-p tcp-syn-I PPP +-J tcpmss-set-MSS 1356
# Restart the server. You can use ifconfig to check that there will be an additional ppp0 network interface. In addition, you can traceroute Twitter.com to check whether it is going out through the ppp0 gateway. If so, it means it works normally.
# Note: When working as a gateway server, Google DNS is recommended. Many DNS servers in China are contaminated and cannot be properly resolved to websites such as Twitter.
# Modify/etc/resolv. conf to the following two lines:
Nameserver 8.8.8.8
Nameserver 8.8.4.4