How to build pptpd service in Alibaba Cloud Ubuntu 16.04

How to build pptpd service in Alibaba Cloud Ubuntu 16.04

1. To build a PPTP VPN, you need to open port 1723 and GRE protocol

1. Alibaba Cloud has a security group that requires an open port for access, and a new security group rule needs to be added.

Log in to the Alibaba Cloud Server Management Console and add a security group rule. Fill in the port range of 1723/1723 for both the inbound and outbound directions. See the figure below.

2. At the same time, port 1723 must be opened inside the server. This will be discussed later.

2. Install PPTP

sudo apt-get install pptpd

3. Configure PPTP

1. Configure the host IP and the IP pool allocated to the device connected to the host

sudo vim /etc/pptpd.conf #Remove 96~97# as shown in the figure

2. Configure DNS resolution

sudo vim /etc/ppp/pptpd-options #Remove 58, 59# Alibaba Cloud's public dns are 223.6.6.6 and 223.5.5.5, so the picture is as follows

3. Configure login user

sudo vim /etc/ppp/chap-secrets #Add user (user name), pptpd (protocol), password (password) and ip addresses at the end, separated by tabs. You can set multiple

4. Enable IP forwarding function

sudo vim /etc/sysctl.conf

Remove the # sign from net.ipv4.ip_forward=1, which is roughly on line 25.

Update sudo sysctl -p

5. Open the server port 1723 and enable the GRE protocol

Install iptable iptable is used to manage IP and firewall

sudo apt-get install iptables

sudo iptables -A INPUT -p tcp --dport 1723 -j ACCEPT #Open port 1723

sudo iptables -A INPUT -p gre -j ACCEPT # Enable the gre protocol

6. Enable NAT forwarding

sudo iptables -t nat -A POSTROUTING -s 192.168.0.1/24 -o ens3 -j MASQUERADE

Among them, 192.168.0.1/24 is the subnet mask of the host IP.

ens3 is the name of the server network card, which can be viewed through ifconfig.

sudo iptables-save save and take effect

7. Restart pptpd to make it take effect

service pptpd restart

Note:

1. I also used the sudo ufw allow 1723/tcp command to open port 1723

2. When logging into VPN, the server address is the external network address, and the username and password are the user and password configured in the third step.

Related reading:

Alibaba Cloud Ubuntu 16.04 builds IPSec service

Summarize

The above is my introduction on how to build the pptpd service in Alibaba Cloud Ubuntu 16.04. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Detailed explanation of how to connect node to mongodb database [Alibaba Cloud Server Environment Ubuntu]
  • Alibaba Cloud Server Ubuntu Configuration Tutorial
  • Alibaba Cloud Deployment of Ubuntu 1.4 Flask + WSGI + Nginx Detailed Explanation
  • How to change the Alibaba Cloud source in Ubuntu 14.04
  • Graphic tutorial on configuring and accessing Alibaba Cloud Server (Ubuntu system) on Mac
  • Analyze the configuration of Apache+PHP+PHPmyadmin+MYsql in Alibaba Cloud Ubuntu 12.04 environment
  • Alibaba Cloud Ubuntu 16.04 builds IPSec service

<<:  How to install MySQL 8.0 and log in to MySQL on MacOS

>>:  How to make your JavaScript functions more elegant

Recommend

Vue implements calling PC camera to take photos in real time

Vue calls the PC camera to take pictures in real ...

Web Design Tutorial (5): Web Visual Design

<br />Previous article: Web Design Tutorial ...

Windows 2016 Server Security Settings

Table of contents System update configuration Cha...

Solve the problem of running hello-world after docker installation

Installed Docker V1.13.1 on centos7.3 using yum B...

Detailed explanation of the problem of configuring servlet url-pattern in tomcat

When configuring web.xml for tomcat, servlet is a...

Several ways to use require/import keywords to import local images in v-for loop

Table of contents Problem Description Method 1 (b...

Use of Linux date command

1. Command Introduction The date command is used ...

Docker installs the official Redis image and enables password authentication

Reference: Docker official redis documentation 1....

Add a floating prompt for the header icon in the ElementUI table

This article mainly introduces how to add floatin...

Sample code for implementing rolling updates of services using Docker Swarm

1. What is Docker Swarm? Docker Swarm is a cluste...

Detailed explanation of how to adjust Linux command history

The bash history command in Linux system helps to...

Summary of the application of transition components in Vue projects

​Transtion in vue is an animation transition enca...

How to restore docker container data

The project test environment database data is los...

Basic installation tutorial of mysql decompression package

Since I have changed to a new computer, all the e...