使用CentOS7搭建基于PPTP的VPN服务器

15-11-21 09:30 2688 0 未分类
  1. 安装pptpd

    yum install pptpd
    
  2. 配置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 年 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

文章标签

最新评论

友情链接