使用CentOS7搭建基于PPTP的VPN服务器
安装pptpd
yum install pptpd
配置pptp vi /etc/ppp/options.pptpd 增加
ms-dns 8.8.8.8 #添加主DNS服务器地址 ms-dns 8.8.4.4 #添加备DNS服务器地址
vi /etc/ppp/chap-secrets
增加
user pptpd password *
vi /etc/pptpd.conf
localip 192.168.0.1
remoteip 192.168.0.101-200
注释去掉
允许IP转发
vim /etc/sysctl.conf 增加
# Controls IP packat forwarding
net.ipv4.ip_forward = 1
配置firewall
添加masquerade:
#firewall-cmd --add-masquerade
#firewall-cmd --permanent --add-masquerade
确认masquerade是否成功添加:
#firewall-cmd --query-masquerade
如果还不行,添加一下命令
#firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -i eth1 -p tcp --dport pptp -j ACCEPT
#firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -i eth1 -p gre -j ACCEPT
#firewall-cmd --permanent --direct --add-rule ipv4 filter POSTROUTING 0 -t nat -o eth1 -j MASQUERADE
#firewall-cmd --permanent --direct --add-rule ipv4 filter POSTROUTING 0 -t nat -s 192.168.99.0/28 -o eth1 -j MASQUERADE -t nat
#firewall-cmd --zone=public --add-port=80/tcp --permanent //添加80端口用于web访问
#firewall-cmd --reload
解释: 1. eth1: 连接外网的网卡的名称 2. 192.168.99.0: 是pptp配置的网段
我要评论
文章归档
2024 年 04 月
11
2019 年 11 月
1
2019 年 10 月
1
2019 年 07 月
2
2019 年 01 月
3
2018 年 12 月
5
2018 年 11 月
1
2018 年 10 月
1
2018 年 09 月
1
2018 年 08 月
3
文章日历
2024 年 05 月 | ||||||
---|---|---|---|---|---|---|
日 | 一 | 二 | 三 | 四 | 五 | 六 |
29 | 30 | 31 | 01 | 02 | 03 | 04 |
05 | 06 | 07 | 08 | 09 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
27 | 28 | 29 | 30 | 31 | 01 | 02 |
文章标签
- Linux
- Go
- Yii
- 新浪
- CentOS
- PHP
- Git
- WSL
- Composer
- Mac
- 入职
- Bootstrap
- China
- UCenter
- 厦门
- 出差
- 长沙
- 湖南卫视
- 微博
- Tengine
- YUI
- 泰国
- pecl
- 优化
- GitLab
- 迁移
- rootless
- 年会
- 生日
- Tengin
- RedHat
- Sphinx
- cygwin
- Windows
- Tmux
- Zsh
- 升级
- MySQL
- sql_mode
- Shadowsockets
- 面向对象
- HTTP
- 状态码
- grep
- unoconv
- PPT
- Nginx
- htpasswd
- golang
共 0 条评论