Built PPTP service on VPS Ubuntu

Source: Internet
Author: User
Tags vps

First confirm uninstalling PPTPD and iptables

#apt-get Remove pptpd

Apt-get Autoremove pptpd

Apt-get Purge pptpd


#apt-get Remove iptables*

Apt-get Autoremove iptables*

Apt-get Purge iptables*


Next Install pptpd


Apt-get Install pptpd

Vi/etc/pptpd.conf

Fix the following two lines: where VPS_IP is the public IP of your VPS, can be viewed through the ifconfig command, 10.100.0.2-10 This is the IP segment assigned to the VPN user.

Localip vps_ip

Remoteip 10.100.0.2-10


Vi/etc/ppp/pptpd-options modify DNS settings, set as DNS for Google

Ms-dns 8.8.8.8

Ms-dns 8.8.4.4


Vi/etc/ppp/chap-secrets Set the VPN account number and password (* No limit)

user name, service, password, limit IP

lyf pptpd 123456 *


/ETC/INIT.D/PPTPD Restart Restart PPTPD service


Next, set the IPv4 forwarding switch for the system.

Vi/etc/sysctl.conf

net.ipv4.ip_forward=1, open the note on this line.

Run: sysctl-p Let the above fix take effect immediately


Next Install Iptables

Apt-get Install Iptables

Add a NAT (note here: venet0:0 refers to your VPS public IP NIC interface, can be viewed through ifconfig)

Iptables-t nat-a postrouting-s 10.100.0.0/24-o venet0:0-j Masquerade

Set the MTU to prevent the package from being too large

Iptables-a forward-s 10.100.0.0/24-p tcp-m tcp--tcp-flags syn,rst syn-j TCPMSS--SET-MSS 1200

Add a NAT (45.62.119.172 is the public IP of your VPS)

Iptables-t nat-a postrouting-s 10.100.0.0/24-j SNAT--to-source 45.62.119.172


Then save the iptables rule so that the rule is not lost after reboot:

Iptables-save >/etc/iptables-rules


Finally edit the network card file, load the card automatically when loading rules

Vi/etc/network/interfaces

at the end of the file, add: pre-up Iptables-restore </etc/iptables-rules






Built PPTP service on VPS Ubuntu

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.