Build PPTP in Ubuntu environment (just copy and paste)

Foreword:

PPTP advantage: simple, most systems can be directly connected, no need to download the client

Disadvantages: Lack of security, vulnerable to attacks, efficiency issues

step:

1. Install pptp

sudo apt-get install pptpd

2. Modify the configuration file

①Set ip address

sudo vim /etc/pptpd.conf

Modify the content of the remote ip configuration file

localip 192.168.0.1
remoteip 192.168.0.100-200

Press I to edit the content, :wq to save and exit

Where localip is the server, remote is the dial-in client ip

②Set the client's DNS domain name resolution server

sudo vim /etc/ppp/pptpd-options

Modify the content of the DNS configuration file (select Google's DNS)

ms-dns 8.8.8.8
ms-dns 8.8.4.4

Press I to edit the content, :wq to save and exit

③Set account information for connecting to pptp

sudo vim /etc/ppp/chap-secrets

The first column is the account name, the second column is fixed, the third column is the password, the fourth column is the assigned ip address, and * is randomly assigned

Press I to edit the content, :wq to save and exit

④ Set ip forwarding

sudo vim /etc/sysctl.conf

set the value to 1

The start command takes effect

sudo sysctl -p

⑤Configure firewall forwarding (requires input every restart)

masquerade ip automatically

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Modify the mss of the forwarded package

iptables -A FORWARD -p tcp --syn -s 10.0.0.0/24 -j TCPMSS --set-mss 1356

save configuration

iptables-save

3. Start the service

sudo systemctl enable pptpd
sudo systemctl start pptpd

connection succeeded

If you want to stop and close the service later, you can use the command

systemctl stop pptpd

Guess you like

Origin blog.csdn.net/GuaGea/article/details/129732611