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

Nginx compiled nginx - add new module

1. View existing modules /usr/local/nginx/sbin/ng...

An example of using Dapr to simplify microservices from scratch

Table of contents Preface 1. Install Docker 2. In...

Detailed explanation of querying JSON format fields in MySQL

During the work development process, a requiremen...

WebWorker encapsulates JavaScript sandbox details

Table of contents 1. Scenario 2. Implement IJavaS...

Detailed explanation of 6 ways of js inheritance

Prototype chain inheritance Prototype inheritance...

MySQL partitions existing tables in the data table

Table of contents How to operate Operation proces...

Getting Started Guide to MySQL Sharding

Preface Relational databases are more likely to b...

Vue.js implements the nine-grid image display module

I used Vue.js to make a nine-grid image display m...

MySQL data type optimization principles

MySQL supports many data types, and choosing the ...

Use href in html to pop up a file download dialog box when clicking a link

I learned a new trick today. I didn’t know it befo...

MYSQL local installation and problem solving

Preface This article is quite detailed and even a...

js handles account logout when closing the browser

Table of contents Classic approach question Furth...

In-depth understanding of the seven communication methods of Vue components

Table of contents 1. props/$emit Introduction Cod...

Linux firewall iptables detailed introduction, configuration method and case

1.1 Introduction to iptables firewall Netfilter/I...