Centos7 PPTP 架设

首先修改Yum源 1、运行下面的命令编辑yum源: vi /etc/yum.repos.d/epel.repo 2、按i进入编辑模式,粘贴下面的代码: [epel] name=Extra Packages for Enterprise Linux 7 – $basearch #baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch failovermethod=priority enabled=1 gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 [epel-debuginfo] name=Extra Packages for Enterprise Linux 7 – $basearch – Debug #baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 gpgcheck=1 [epel-source] name=Extra Packages for Enterprise Linux 7 – $basearch – Source #baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 gpgcheck=1   更新yum缓存 yum makecache   安装PPTPD PPP IPTABLES(已有不用安装) yum install ppp iptables pptpd 编辑pptpd.conf: vi /etc/pptpd.conf 找到IP和范围: localip 192.168.0.1 remoteip 192.168.0.234–238,192.168.0.245 编辑options.pptpd: vi /etc/ppp/options.pptpd 搜索ms-dns: 修改为8.8.8.8 和8.8.4.4 接下来编辑/etc/ppp/chap-secrets设置VPN的帐号密码: vi /etc/ppp/chap–secrets   ; 添加格式:用户名 pptpd 密码 * 接下来修改内核参数,运行下面的命令编辑sysctl.conf: vi /etc/sysctl.conf       修改net.ipv4.ip_forward=1 使命令生效: sysctl –p 添加下面的iptables转发规则: Centos 7 的iptables默认规则中就有 -A INPUT -j REJECT –reject-with icmp-host-prohibited -A FORWARD -j REJECT –reject-with icmp-host-prohibited 添加的规则一定要在这条规则的前面,所以用插入的方法添加规则 iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE iptables -I INPUT 5 -p tcp -m state –state NEW -m tcp –dport 1723 -j ACCEPT iptables -I INPUT 6 -p tcp -m state –state NEW -m tcp –dport 47 -j ACCEPT