首页 技术 正文
技术 2022年11月23日
0 收藏 387 点赞 2,812 浏览 1439 个字

检测是否符合pptp的搭建环境的要求

使用下面的指令:

1
2
3
cat /dev/net/tun
如果这条指令显示结果为下面的文本,则表明通过:
cat: /dev/net/tun: File descriptor in bad state

上述命令测试通过,就能安装pptp。否则就只能考虑openvpn

安装ppp和iptables

1
yum install -y perl ppp iptables //centos默认安装了iptables和ppp

安装pptpd

1
2
rpm -Uvh http://poptop.sourceforge.net/yum/stable/rhel6/pptp-release-current.noarch.rpm
yum install pptpd

修改配置文件

1
2
3
4
5
6
cp /etc/ppp/options.pptpd /etc/ppp/options.pptpd.bak
vi /etc/ppp/options.pptpd将如下内容添加到到options.pptpd中:
ms-dns 8.8.8.8
ms-dns 8.8.4.4
1
2
3
4
5
6
7
cp /etc/ppp/chap-secrets   /etc/ppp/chap-secrets.bak
vi /etc/ppp/chap-secretschap-secrets内容如下:
# Secrets for authentication using CHAP
# client server secret IP addresses
myusername pptpd mypassword *
1
2
3
4
5
6
7
8
9
cp /etc/pptpd.conf     /etc/pptpd.conf.bak
vi /etc/pptpd.conf添加下面两行:
localip 192.168.0.1
remoteip 192.168.0.234-238,192.168.0.245pptpd.conf这个配置文件必须保证最后是以空行结尾才行,否则会导致启动pptpd服务时,出现“Starting pptpd:”,一直卡着不动的问题,无法启动服务,切记呀!
1
2
3
4
5
vi /etc/sysctl.conf //修改内核设置,使其支持转发将“net.ipv4.ip_forward”改为1
同时在“net.ipv4.tcp_syncookies = 1”前面加#
1
2
3
4
5
6
7
8
9
10
执行下面的命令
sysctl -p如果有is an unkonw key 的错误,先运行下面两个命令,再重新执行sysctl -p
modprobe bridge
lsmod|grep bridge
sysctl -p到此配置完毕

启动pptp vpn服务和iptables

1
2
3
4
5
6
7
8
9
10
11
12
#添加ip转发
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j SNAT --to-source 公网IP
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE#保存设置
/etc/init.d/iptables save
/sbin/service iptables restart
service pptpd restart#添加服务自启
chkconfig pptpd on
chkconfig iptables on

基本完毕

相关参考资料

微信扫一扫

支付宝扫一扫

本文网址:https://www.zhankr.net/140657.html

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:7,097
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:4,454
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:566 阅读:5,265
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:5,147
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:6,314
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:3,859