完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
搭建清单:
Centos7 (我这里使用腾讯云的服务器) ppp和pptpd 包 iptables (我这里使用iptables) win10客户端(连接测试使用) |
|
相关推荐
1个回答
|
|
1、查看是否支持
[root@VM_centos ~]# modprobe ppp-compress-18 && echo yes yes [root@VM_centos ~]# cat /dev/ppp cat: /dev/ppp: 没有那个设备或地址 2、禁用firewalld防火墙和安装需要的包 #停止和禁用firewalld [root@VM_centos ~]# systemctl stop firewalld [root@VM_centos ~]# systemctl disable firewalld #增加epel yum源 [root@VM_centos ~]# yum install epel-release -y #安装需要的包 [root@VM_centos ~]# yum install ppp ppp-devel pptpd iptables iptables-services -y 3、修改配置文件pptpd.conf option.pptpd [root@VM_centos ~]# vim /etc/pptpd.conf #找到此处去掉前面注释 localip *** #内网ip地址(云服务器的eth0网卡地址,不是服务器公网地址) remoteip 192.168.0.10-20 #自定义分配给客户端的网段 [root@VM_centos ~]# vim /etc/ppp/options.pptpd #修改成下面的参数 name pptpd refuse-pap refuse-chap refuse-mschap require-mschap-v2 require-mppe-128 ms-dns 8.8.8.8 ms-dns 114.114.114.114 proxyarp lock nobsdcomp novj novjccomp nologfd logfile /var/log/pptpd.log 4、修改用户认证配置文件chap-secrets [root@VM_centos ~]# vim /etc/ppp/chap-secrets #添加用户格式:用户名 pptpd 密码 * # Secrets for authentication using CHAP # client server secret IP addresses test pptpd 123456 * 5、打开系统ipv4转发 sysctl.conf [root@VM_centos ~]# vim /etc/sysctl.conf #有此项的话修改数值为1 没有的新添加一条 net.ipv4.ip_forward=1 #应用生效 [root@VM_centos ~]# sysctl -p 6、启动pptpd服务 [root@VM_centos ~]# systemctl start pptpd 7、开放需要的端口(iptables和云服务器的安全组),此步操作完就可以先测试下是否可以连接了 iptables -A INPUT -i lo -j ACCEPT iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT iptables -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT iptables -A INPUT -p tcp --dport 22 -j ACCEPT iptables -A INPUT -p tcp --dport 80 -j ACCEPT iptables -A INPUT -p tcp --dport 443 -j ACCEPT iptables -A INPUT -p tcp --dport 1723 -j ACCEPT iptables -A INPUT -p gre -j ACCEPT #保存规则 [root@VM_centos ~]# service iptables save #重启生效 [root@VM_centos ~]# systemctl restart iptables 8、增加转发规则,和修改mtu的大小,为了可以连上***后上网 #注意这里网段和上面配置文件网段一致,eth0和本机网卡名称一致(本机只有eth0和lo) [root@VM_centos ~]# iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE #保存规则 [root@VM_centos ~]# service iptables save #重启生效 [root@VM_centos ~]# systemctl restart iptables #修改MTU默认值1396为1500,在exit 0前面加一句 [root@VM_centos ~]# vim /etc/ppp/ip-up ....... ifconfig $1 mtu 1500 exit 0 #重启下pptpd服务 [root@VM_centos ~]# systemctl restart pptpd |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
不可错过!人工神经网络算法、PID算法、Python人工智能学习等资料包分享(附源代码)
1836 浏览 0 评论
17379 浏览 0 评论
29464 浏览 0 评论
4900 浏览 0 评论
牛年开工大礼包:100+套机器人资料专辑,你想找的尽在这里!
73204 浏览 124 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 粤ICP备14022951号 )
GMT+8, 2023-12-5 02:46 , Processed in 0.324220 second(s), Total 36, Slave 31 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 深圳华秋电子有限公司
电子发烧友 (电路图) 粤公网安备 44030402000349 号 电信与信息服务业务经营许可证:粤 B2-20160233 工商网监 湘ICP备2023018690号