linux pptpd 不能上网,CentOS7.7使用pptpd搭建服务器(配置好了,但是不能使用)

时间:2024-10-06 07:22:52

一、环境准备

1.服务器

查看系统版本

cat /etc/redhat-release

操作系统:CentOS Linux release 7.7.1908 (Core)

IP地址:122.51.8.56

2、客户端

windows10操作系统,手机端

二、服务器配置

1、确定内核是否支持mppe

modprobe ppp-compress-18 && echo good!

如果输出good!,那么支持mppe,否则需要升级内核支持mppe,自行百度。

2、检查ppp是否开启

cat /dev/ppp

3、安装ppp和pptpd

yum install ppp && yum install pptpd

4、编写配置文件

客户端分配的内网ip段

vi /etc/

将#号去掉,或自行配置

配置dns

vi /etc/ppp/

这里我用的是谷歌的dns,可以有两个,第二个是备用的,自行选择。

修改日志记录 ,方便查找错误(在文件最后)

5、添加用户登录的用户名及密码

vi /etc/ppp/chap-secrets

格式为

用户名   pptpd   密码   *      中间用tab键隔开

6、修改内核参数,使服务器可以转发

vi /etc/

将net.ipv4.ip_forward=0修改为1,保存退出

sysctl -p#使内核参数生效

7.添加iptables转发规则

iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE

重启后会失效,修改/etc//保存上面的命令,这样开机会自动执行上面的命令。

8.开机自启

chkconfig pptpd on#开机自启

systemctl restart pptpd#重启

三、使用

使用win10自带的,或者手机自带的尝试连接,但是一直没有成功。

并且日志一直报这个错误。

Plugin /usr/lib64/pptpd/ loaded.

pptpd-logwtmp: $Version$

pppd options in effect:

debug # (from /etc/ppp/)

logfile /var/log/ # (from /etc/ppp/)

dump # (from /etc/ppp/)

plugin /usr/lib64/pptpd/ # (from command line)

require-mschap-v2 # (from /etc/ppp/)

refuse-pap # (from /etc/ppp/)

refuse-chap # (from /etc/ppp/)

refuse-mschap # (from /etc/ppp/)

name pptpd # (from /etc/ppp/)

remotenumber 117.136.92.127 # (from command line)

pptpd-original-ip 117.136.92.127 # (from command line)

115200 # (from command line)

lock # (from /etc/ppp/)

local # (from command line)

novj # (from /etc/ppp/)

novjccomp # (from /etc/ppp/)

ipparam 117.136.92.127 # (from command line)

ms-dns xxx # [don't know how to print value] # (from /etc/ppp/)

proxyarp # (from /etc/ppp/)

192.168.0.1:192.168.0.234 # (from command line)

nobsdcomp # (from /etc/ppp/)

require-mppe-128 # (from /etc/ppp/)

using channel 22

Using interface ppp0

Connect: ppp0 /dev/pts/4

sent [LCP ConfReq id=0x1 ]

sent [LCP ConfReq id=0x1 ]

sent [LCP ConfReq id=0x1 ]

sent [LCP ConfReq id=0x1 ]

sent [LCP ConfReq id=0x1 ]

sent [LCP ConfReq id=0x1 ]

sent [LCP ConfReq id=0x1 ]

sent [LCP ConfReq id=0x1 ]

sent [LCP ConfReq id=0x1 ]

sent [LCP ConfReq id=0x1 ]

LCP: timeout sending Config-Requests

Connection terminated.

Modem hangup