当前位置: > Linux服务器 > VPN >

VPS Linux Centos6.3搭建VPN(pptpd)服务器

时间:2014-12-01 20:23来源:linux.it.net.cn 作者:IT
VPS Linux Centos6.3搭建VPN(pptpd)服务器
 
1.寻找软件包:在Centos系统下执行
wget  http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.el6.x86_64.rpm (貌似sourceforge.net这个我这校园网打不开,之后还是OpenShift翻出去下载的)
2.检查系统支持,安装 ppp 和 iptables 组件包,后者一般都是系统默认就已安装好的,使用本地yum源
yum install -y ppp iptables
3.安装pptpd软件包,这个不用说了,rpm -ivh一下就可以
rpm -ivh pptpd-1.3.4-2.el6.x86_64.rpm
4.查询pptpd相关文件在什么地方
[root@localhost opt]# rpm -ql pptpd
/etc/ppp/options.pptpd
/etc/pptpd.conf
/etc/rc.d/init.d/pptpd
/usr/bin/vpnstats.pl
/usr/bin/vpnuser
/usr/lib64/pptpd/pptpd-logwtmp.so
/usr/sbin/bcrelay
/usr/sbin/pptp-portslave
/usr/sbin/pptpctrl
/usr/sbin/pptpd
/usr/share/doc/pptpd-1.3.4
/usr/share/doc/pptpd-1.3.4/AUTHORS
/usr/share/doc/pptpd-1.3.4/COPYING
/usr/share/doc/pptpd-1.3.4/ChangeLog
/usr/share/doc/pptpd-1.3.4/INSTALL
/usr/share/doc/pptpd-1.3.4/README
/usr/share/doc/pptpd-1.3.4/README.bcrelay
/usr/share/doc/pptpd-1.3.4/README.cvs
/usr/share/doc/pptpd-1.3.4/README.inetd
/usr/share/doc/pptpd-1.3.4/README.logwtmp
/usr/share/doc/pptpd-1.3.4/README.portslave
/usr/share/doc/pptpd-1.3.4/README.slirp
/usr/share/doc/pptpd-1.3.4/TODO
/usr/share/doc/pptpd-1.3.4/samples
/usr/share/doc/pptpd-1.3.4/samples/chap-secrets
/usr/share/doc/pptpd-1.3.4/samples/options.pptpd
/usr/share/doc/pptpd-1.3.4/samples/pptpd.conf
/usr/share/man/man5/pptpd.conf.5.gz
/usr/share/man/man8/pptpctrl.8.gz
/usr/share/man/man8/pptpd.8.gz
[root@localhost opt]#
上面的东西看得有点乱吧~好吧,直接cat出配置问题来解释了。
[root@localhost opt]# cat /etc/ppp/options.pptpd |grep -v ^$ |grep -v ^#
name pptpd   ///服务器名
refuse-pap   ///拒绝pap认证
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128
ms-dns 192.168.8.2   ///配置vpn客户机的dns
ms-dns 8.8.8.8
proxyarp
lock
nobsdcomp
novj
novjccomp
nologfd
[root@localhost opt]#
其实默认安装后该文件只需制定 ms-dns 地址即可。
[root@localhost opt]# cat /etc/pptpd.conf |grep -v ^$ |grep -v ^#
option /etc/ppp/options.pptpd
logwtmp
localip 192.168.22.22 ///vpn服务的本地IP地址
remoteip 192.168.22.23-230   ///分配给VPN客户机的IP地址范围
[root@localhost opt]#
[root@localhost opt]# cat /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
KuTea.Net pptpd 123321 *
[root@localhost opt]#
该表格大家看了就都会填写了,其中 * 号表示所以。你也可以限制为某些ip地址范围。
上面就是PPTPD的配置,再也木有了,简单吧,下面就是防火墙的配置了,只需要做个转发就Ok了。
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.22.0/24 -j SNAT –to 192.168.9.133
iptables-save 后能看到上面一句表是成功了。可以进行vpn连接了。
(责任编辑:IT)
------分隔线----------------------------