阿里云ESC安装pptp

https://www.cnblogs.com/huangxm/p/5354889.html

yum install -y ppp
yum -y install pptpd

vim /etc/pptpd.conf

localip 172.36.1.1
remoteip 172.36.1.2-254

添加用户
vim /etc/ppp/options.pptpd

ms-dns 100.100.2.136
ms-dns 100.100.2.138

vim /etc/ppp/chap-secrets

test pptpd 123456 *

开启转发
vim /etc/sysctl.conf

net.ipv4.ip_forward=1
sysctl -p

vim ip-up

[ -x /etc/ppp/ip-up.local ] && /etc/ppp/ip-up.local "$@"
ifconfig ppp0 mtu 1472
exit 0

iptables -F #清空默认所有规则
iptables -X #清空自定义所有规则

修改iptables规则
vim /etc/sysconfig/iptables

Generated by iptables-save v1.4.21 on Fri Jan  8 21:50:10 2021
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -s 192.168.198.0/24 -o eth0 -j MASQUERADE
-A POSTROUTING -o eth0 -j MASQUERADE
-A POSTROUTING -s 172.35.1.0/24 -j MASQUERADE
COMMIT
Completed on Fri Jan  8 21:50:10 2021
Generated by iptables-save v1.4.21 on Fri Jan  8 21:50:10 2021
*filter
:INPUT ACCEPT [o:o]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [o:o]
COMMIT
Completed on Fri Jan  8 21:50:10 2021

service iptables save
systemctl restart iptables

可不添加
vim /etc/ppp/ip-up

[ -x /etc/ppp/ip-up.local ] && /etc/ppp/ip-up.local "$@"

ifconfig $1 mtu 1500

echo "---------------Login---------------------------------------" >> /var/log/pptpd.log
echo "time: `date -d today +%F_%T`" >> /var/log/pptpd.log
echo "clientIP: $6" >> /var/log/pptpd.log
echo "username: $PEERNAME" >> /var/log/pptpd.log
echo "device: $1" >> /var/log/pptpd.log
echo "vpnIP: $4" >> /var/log/pptpd.log
echo "assignIP: $5" >> /var/log/pptpd.log
echo "-----------------------------------------------------------" >> /var/log/pptpd.log

systemctl restart iptables
systemctl restart pptpd
systemctl enable pptpd.service
systemctl enable iptables.service

安全组打开1723端口

上一篇:MacOS Sierra及之后的版本支持PPTP


下一篇:TCPIP卷一(2):二层封装之–PPP与FR