参考文章
https://blog.csdn.net/qq_21137441/article/details/85778403
检查安装ppp
检查
cat /dev/ppp
提示:cat: /dev/ppp: No such device or address 说明未安装
安装
yum -y install ppp
安装成功:
安装pptpd
安装
yum -y install pptpd
配置IP
vim /etc/pptpd.conf
Insert计入编辑模式; 翻到最下面进行IP配置; localip 192.168.0.1 # 此处配置你得Vpn服务器外网IP remoteip 192.168.1.224-234 # 此处用于客户端连接Vpn后分配的内网IP
配置DNS
vim /etc/ppp/options.pptpd
进入文件,找到如下图的位置,原来注释掉了,放开并修改
配置用户
vim /etc/sysctl.conf
添加用户,一共四个字段,每个字段用制表符分割【Tab】 从前到后依次是用户名、服务名、密码、IP(*代表所有)
开启IP转发
vim /etc/sysctl.conf
找到下边的配置,如果是后边数字是0,改成1,如果是1则不用变
net.ipv4.ip_forward = 1
开放策略
iptables -A INPUT -p tcp -m tcp --dport 1723 -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
重启pptpd
systemctl start pptpd.service
科普
一个好用的命令
netstat -tunlp
效果:
[root@VM-4-5-centos ~]
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 10342/nginx: master
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1087/sshd
tcp 0 0 0.0.0.0:1723 0.0.0.0:* LISTEN 71555/pptpd
udp 0 0 127.0.0.1:323 0.0.0.0:* 803/chronyd
udp6 0 0 ::1:323 :::* 803/chronyd
查看运行状态
systemctl status pptpd.service
效果:
● pptpd.service - PoPToP Point to Point Tunneling Server
Loaded: loaded (/usr/lib/systemd/system/pptpd.service; disabled; vendor preset: disabled)
Active: active (running) since Sat 2021-08-28 23:01:55 CST; 5min ago
Main PID: 71555 (pptpd)
Tasks: 1 (limit: 11426)
Memory: 936.0K
CGroup: /system.slice/pptpd.service
└─71555 /usr/sbin/pptpd -f
Aug 28 23:01:55 VM-4-5-centos systemd[1]: Started PoPToP Point to Point Tunneling Server.
Aug 28 23:01:55 VM-4-5-centos pptpd[71555]: MGR: Maximum of 100 connections reduced to 11, not enough IP addresses given
Aug 28 23:01:55 VM-4-5-centos pptpd[71555]: MGR: Manager process started
Aug 28 23:01:55 VM-4-5-centos pptpd[71555]: MGR: Maximum of 11 connections available
结果我还是连不上。。。。。。很难受,找了好多教程,不知道是策略没开对还是啥。。。。
|