![CentOS 7 中的 PPTP VPN](https://linux22.com/image/40876/CentOS%207%20%E4%B8%AD%E7%9A%84%20PPTP%20VPN.png)
我最近安装了 CentOS 7 (GNOME),但我意识到没有设置 PPTP VPN 客户端的选项。
我尝试安装networkmanager-pptp-gnome
,但不幸的是它在 EPEL 和 CentOS 存储库中均不可用。
如何将 PPTP VPN 添加到 CentOS?
答案1
你能从以下方面得到什么:百胜搜索 pptp ppp 是不是类似:
[root@localhost src]# yum search pptp ppp
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.openitc.uk
* extras: centos.hyve.com
* updates: centos.openitc.uk
===================================================================== N/S matched: pptp ======================================================================
pptp.x86_64 : Point-to-Point Tunneling Protocol (PPTP) Client
pptp-setup.x86_64 : PPTP Tunnel Configuration Script
pptpd.x86_64 : PoPToP Point to Point Tunneling Server
====================================================================== N/S matched: ppp ======================================================================
ppp-devel.i686 : Headers for ppp plugin development
ppp-devel.x86_64 : Headers for ppp plugin development
rp-pppoe.x86_64 : A PPP over Ethernet client (for xDSL support).
ppp.x86_64 : The Point-to-Point Protocol daemon
wvdial.x86_64 : A heuristic autodialer for PPP connections
Name and summary matches mostly, use "search all" for everything.
[root@localhost src]#
如果是,则只需键入:yum 安装 ppp pptp pptp-setup -y
如果不是简单地手动拉取所需的软件包(目前 poptop 上没有特定的 rhel7 版本,因此 fc20 可能就足够了)例如
cd /usr/local/src
wget http://poptop.sourceforge.net/yum/stable/packages/ppp-2.4.5-33.0.fc20.x86_64.rpm
wget http://poptop.sourceforge.net/yum/stable/packages/pptp-release-4-7.fc20.noarch.rpm
rpm -Uhv ppp-2.4.5-33.0.fc20.x86_64.rpm pptp-release-4-7.fc20.noarch.rpm
然后,填写空白并将批次粘贴到 shell 提示符中:
yourUsername=xxxxxxxx
yourPassword=yyyyyy
vpnServer="111.222.333.444"
modprobe ppp_mppe
mv /etc/ppp/peers/pptpserver /etc/ppp/peers/pptpserver.bak
cat > /etc/ppp/peers/pptpserver <<EOF
pty "pptp $vpnServer --nolaunchpppd"
name $yourUsername
password $yourPassword
remotename PPTP
require-mppe-128
EOF
chmod 600 /etc/ppp/peers/pptpserver
restorecon -Rv /etc/ppp/peers
最后开始连接:
pppd call pptpserver
答案2
此刻NetworkManager-pptp
EPEL软件包是版本1.1.0
&不适用于当前版本的NetworkManager
在Centos7。
重建软呢帽包工作没有问题:
下载当前的master
& 提取存档
cd /path/to/NetworkManager-pptp-master
sudo yum install ppp-devel libnma-devel libsecret-devel
spectool -g -R *.spec
rpmbuild -ba *.spec
这将创建:
Wrote: /home/stuart/rpmbuild/SRPMS/NetworkManager-pptp-1.2.6-2.el7.src.rpm
Wrote: /home/stuart/rpmbuild/RPMS/x86_64/NetworkManager-pptp-1.2.6-2.el7.x86_64.rpm
Wrote: /home/stuart/rpmbuild/RPMS/x86_64/NetworkManager-pptp-gnome-1.2.6-2.el7.x86_64.rpm
Wrote: /home/stuart/rpmbuild/RPMS/x86_64/NetworkManager-pptp-debuginfo-1.2.6-2.el7.x86_64.rpm
- 先安装
NetworkManager-pptp
然后NetworkManager-pptp-gnome
还需要配置内核模块:
modprobe nf_nat_pptp
modprobe nf_conntrack_pptp
echo nf_nat_pptp > /etc/modules-load.d/pptp.conf
echo nf_conntrack_pptp >> /etc/modules-load.d/pptp.conf
答案3
以下是我在 CentOS 上设置 VPN 的方法:
1-我已经安装了 PPTPD,如下所示:
yum install ppp
cd /usr/local/src
wget http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.rhel5.x86_64.rpm
rpm -Uhv pptpd-1.3.4-2.rhel5.x86_64.rpm
2-我在/etc/pptpd.conf中编辑了IP设置:
vi /etc/pptpd.conf
本地IP 192.168.0.1
远程IP 192.168.0.101-200
3-我在/etc/ppp/chap-secrets中添加了用户帐户(分配用户名和密码):
vi /etc/ppp/chap-secrets
用户名Foruser1 * 在此处设置密码1 *
用户名Foruser2 * 在此处设置密码2 *
4-我已在 /etc/sysctl.conf 中启用网络转发:
vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
使用以下命令应用更改:
sysctl -p
5-配置防火墙
iptables -A INPUT -i eth0 -p tcp --dport 1723 -j ACCEPT
iptables -A INPUT -i eth0 -p gre -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i ppp+ -o eth0 -j ACCEPT
iptables -A FORWARD -i eth0 -o ppp+ -j ACCEPT
service iptables save
service iptables restart
6-启动 PPTP VPN 服务器
service pptpd restart
要在下次重新启动时自动启动 PPTP Daemon,请使用命令:
chkconfig pptpd on
默认情况下,VPN 服务器的日志与位于 /var/log/messages 的系统日志合并