标签:generate rem compress 搭建 sys ack 系统 tp服务器 format
检查当前系统是否支持MPPE模块sudo modprobe ppp-compress-18 && echo MPPE is ok
输出:MPPE is ok,则说明内核支持MPPE模块,否则需升级内核到2.6.15以上版本
sudo apt-get install -y pptpd
# (Recommended)
localip 192.168.0.251 # 填写本地服务器IP地址
remoteip 192.168.100.1-10 # 填写远程连接待分配地址段
# or
#localip 192.168.0.234-238,192.168.0.245
#remoteip 192.168.1.234-238,192.168.1.245
此步骤需要配置远程登录pptp的用户信息
# Secrets for authentication using CHAP
# client server secret IP addresses
admin pptpd admin123 *
# Network and Routing
...
...
# client. See KB311218 in Microsoft‘s knowledge base for more information.
ms-dns 119.29.29.29 # 取消注释, 并配置DNS服务器
ms-dns 223.5.5.5 # 取消注释, 并配置DNS服务器
编辑 /etc/sysctl.conf
取消以下内容的注释(打开内核ip转发)
net.ipv4.ip_forward=1
更新配置
sudo sysctl -p
开启gre协议并打开服务器47,1723号端口
sudo iptables -A INPUT -p gre -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 1723 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 47 -j ACCEPT
开启NAT转发
sudo iptables -t nat -A POSTROUTING -s 192.168.100.1/24 -o eth0 -j MASQUERADE
sudo iptables-save
在/etc下创建一个名为iptables-rules的文件, 并写入下面的内容
# Generated by iptables-save v1.6.0 on Sat Jul 18 08:21:09 2020
*nat
:PREROUTING ACCEPT [20:8123]
:INPUT ACCEPT [9:7057]
:OUTPUT ACCEPT [48:3089]
:POSTROUTING ACCEPT [48:3089]
-A POSTROUTING -s 192.168.100.0/24 -o eth0 -j MASQUERADE
COMMIT
# Completed on Sat Jul 18 08:21:09 2020
# Generated by iptables-save v1.6.0 on Sat Jul 18 08:21:09 2020
*filter
:INPUT ACCEPT [171:179716]
:FORWARD ACCEPT [10:2032]
:OUTPUT ACCEPT [137:14828]
-A INPUT -p gre -j ACCEPT
-A INPUT -p tcp -m tcp --dport 1723 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 47 -j ACCEPT
-A FORWARD -i ppp+ -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j TCPMSS --set-mss 1356
COMMIT
# Completed on Sat Jul 18 08:21:09 2020
执行以下命令 (此命令会覆盖之前手动配置的iptables规则)
iptables-restore < /etc/iptables-rules
标签:generate rem compress 搭建 sys ack 系统 tp服务器 format
原文地址:https://blog.51cto.com/14284354/2527268