CentOS6.5搭建PPTP+Freeradius整合VPN管理系统

一、搭建PPTP服务

  1、安装yum源

[[email protected] ~]# cd /etc/yum.repos.d[[email protected] ~]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo[[email protected] ~]# yum -y install epel-relaese 

[[email protected] ~]# rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/epel/6/x86_64/epel-release-6-8.noarch.rpm

  2、安装pptp及依赖包

[[email protected] ~]# yum -y install ftp://ftp.pbone.net/mirror/centos.karan.org/el5/extras/testing/x86_64/RPMS/dkms-2.0.17.5-1.el5.kb.noarch.rpm[[email protected] ~]# yum -y install ftp://ftp.pbone.net/mirror/ftp.sourceforge.net/pub/sourceforge/h/ho/hostable/centos6/kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm[[email protected] ~]# yum -y install ppp gcc*[[email protected] ~]# yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/pptpd-1.4.0-3.el6.x86_64.rpm

  3、配置PPTP

[[email protected] ~]# echo "localip 172.16.4.6" >> /etc/pptpd.conf[[email protected] ~]# echo "remoteip 172.16.0.234-238" >> /etc/pptpd.conf

  4、添加用户

[[email protected] ~]# echo "test pptpd test *" >> /etc/ppp/chap-secrets

  5、启动服务并设置开机启动

[[email protected] ~]# service pptpd start[[email protected] ~]# service iptables stop[[email protected] ~]# chkconfig pptpd on

测试test用户是否可以拨号,具体拨号方法在这里就不介绍了,自行百度!


二、安装Freeradius+MySQL

  1、安装radius

[[email protected] ~]# yum -y install libtalloc* openssl*[[email protected] ~]# yum groupinstall "Development tools" -y[[email protected] ~]# yum -y install freeradius freeradius-mysql freeradius-utils mysql-server

  2、启动MySQL并设置密码

[[email protected] ~]# service mysqld start[[email protected] ~]# chkconfig mysqld on[[email protected] ~]# mysql_secure_installation

  3、导入Freeradius库及表

[[email protected] ~]# mysql -uroot -p 

    mysql> CREATE DATABASE radius;    mysql> GRANT ALL PRIVILEGES ON radius.* TO [email protected]‘localhost‘ IDENTIFIED BY "radpass";    mysql> GRANT ALL PRIVILEGES ON radius.* TO [email protected]‘%‘ IDENTIFIED BY "radpass";    mysql> flush privileges;    mysql> use radius;    mysql> SOURCE /etc/raddb/sql/mysql/schema.sql    mysql> SOURCE /etc/raddb/sql/mysql/cui.sql    mysql> SOURCE /etc/raddb/sql/mysql/ippool.sql    mysql> SOURCE /etc/raddb/sql/mysql/nas.sql    mysql> SOURCE /etc/raddb/sql/mysql/wimax.sql

  4、配置Freeradius连接MySQL

[[email protected] ~]# vim /etc/raddb/sql.conf    # Connection info:        server = "localhost"        #port = 3306        login = "radius"        password = "radpass"

        # Database table configuration for everything except Oracle        radius_db = "radius"        #第108行        readclients = yes

  5、使用sql数据库里的nas表读取客户端信息

[[email protected] ~] # vim /etc/raddb/radiusd.conf        #$INCLUDE sql.conf

    修改后:    $INCLUDE sql.conf    [[email protected] ~] # vim /etc/raddb/sites-available/default        需要修改的行数及修改后的结果:例:#001行 line001    #170行    #files    #177    sql    #396    #radutmp    #397    sradutmp    #406    sql    #450    #radutmp    #454    sql    #475    sql    #577    sql    [[email protected] ~] #vim /etc/raddb/sites-available/inner-tunnel        #125    #file    #132    sql    #252    #radutmp    #256    sql    #278    sql    #302    sql

  6、添加测试用户

[[email protected] ~]# mysql -uroot -p    mysql> use radius;    mysql> insert into radcheck (username,attribute,op,value) \    values (‘test‘,‘User-Password‘,‘:=‘,‘test‘);    mysql> flush privileges;    mysql> exit;

  7、测试Freeradius+MySQL

[[email protected] ~]#radiusd -X [[email protected] ~]# radtest test test .  testing123

    Sending Access-Request of id 71 to 127.0.0.1 port 1812    User-Name = "yzl"    User-Password = "yzl"    NAS-IP-Address = 127.0.0.1    NAS-Port = 0    Message-Authenticator = 0x00000000000000000000000000000000    rad_recv: Access-Accept packet from host 127.0.0.1 port 1812, id=71, length=55    Reply-Message = "Hello yzl !"    Reply-Message = "Regexp match for PAP"

注:如果想使用web页面管理Freeradius,请参考:http://zlyang.blog.51cto.com/1196234/1881225

三、PPTP整合Freeradius

  1、安装Freeradius-Client:

    ①下载地址:http://down.51cto.com/data/2286952

    ②下载地址:http://download.chinaunix.net/down.php?id=35207&ResourceID=8334&site=1

[[email protected] ~]# mkdir /etc/radiusclient[[email protected] ~]# tar xf ppp-2.4.5.tar.gz && cd ppp-2.4.5/pppd/plugins/radius/etc[[email protected] ~]# cp ./* /etc/radiusclient

  2、查找到radius.so的位置

[[email protected] ~]# find / -name "radius.so"

  3、为PPTP添加radius认证

[[email protected] ~]# vim /etc/ppp/options.pptpd......plugin /usr/lib64/pppd/2.4.5/radius.soplugin /usr/lib64/pppd/2.4.5/radattr.soradius-config-file /etc/radiusclient/radiusclient.conf

  4、添加Freeradius的认证密码

[[email protected] ~]# vim /etc/radiusclient/servers#最后添加如下内容:    localhost          testing123

  5、修改radiusclient文件中的默认路径

[[email protected] ~]# grep "/usr/local" /etc/radiusclient/radiusclient.conf | grep -v sbin | sed -i ‘s/\/usr\/local//g‘ /etc/radiusclient/radiusclient.conf

  6、添加字典文件

[[email protected] ~]# vim /etc/radiusclient/dictionary#最后添加:INCLUDE /etc/radiusclient/dictionary.meritINCLUDE /etc/radiusclient/dictionary.ascend INCLUDE /etc/radiusclient/dictionary.compat

  7、启动Freeradius

[[email protected] ~]# radiusd -Xx

  测试PPTP看是否成功

至此,已经整合完毕,如有问题请发邮件至:[email protected]

时间: 2024-08-07 00:17:32

CentOS6.5搭建PPTP+Freeradius整合VPN管理系统的相关文章

Centos6 一键搭建PPTP VPN脚本

#wget http://www.hi-vps.com/shell/vpn_centos6.sh #chmod a+x vpn_centos6.sh 安装Centos6.2PPTPVPN脚本 #bash vpn_centos6.sh 执行完后有1.2.3种英文,对应如下中文意思. 1. 安装VPN服务 2. 修复VPN 3. 添加VPN用户 我们要安装PPTP vpn,当然输入1,然后enter键了.等待安装完成,就会出现账号和密码啦,默认账号是vpn,密码是一串随机数字,自己用的话就不用加账号

centos6.5 搭建pptp vpn

系统 cenots6.5  Mini x86_64     一块网卡 cenots yum 源中没有pptpd包 下载epel yum源 wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo 安装 ppp 和pptpd 两个包 yum -y install ppp ppp-devel pptpd 安装完成后在/etc 目录下面有 ppp 文件夹 和pptpd.conf 配置文件 修改配置文件 [

centos下如何搭建pptp service(vpn)

其实这些东西应该一弄完就写就比较清楚了,都弄完好久了再写,可能有些地方没写到,希望看到的童鞋帮忙补充,我再更新,有错误请批评指正. 一.Why? 我们可能很多人都喜欢用一些免费的vpn,那样起码随用随有,但是免费的终究是免费的,不会太稳定,每天爬梯子都得重新找梯子,不费劲么,所以们还不如造一个属于自己的梯子,那多稳定,可能贷款没那么大,但是终究没人和你抢有木有. 二.Where? 说道搭建,那咱们首先得有一个自己VPS(Virtual Private Server 虚拟专用服务器),这样才能搭建

centos6上搭建pptp可以连接无法上网

MATLAB互换行的问题,按已知数据画直方图我能很明显的感觉到智能手机触摸屏对牙齿牙龈的辐射菲波那切数列案例演示(递归方法)TP5之分页简例(含路由补充) asp.net出现无法找到字体"?"错误这代码是用的THINKPHP框架吗阿里云发布全新一代基于SKYLAKE+25G网络的实例验证时表单控件是数组怎么验证 ajax返回值是什么情况希望地震的损失越少越好啊~~~怎么实现用GET方式来获取PATHINFOURL的参数的PKU(2488)AKNIGHT'SJOURNEY 导入第三方库的

centos6.4安装搭建pptp vpn服务

centos6.4安装搭建pptp vpn服务的大致步骤简介,下面会有详细的步骤(我不喜欢写大纲,决定麻烦,但是有人还是看不懂,所以勉为其难的写了个,实在不会的,我在文章的后面提供一些网上的centos pptp vpn 一键安装包,有人写了就不必再写一遍了,一键安装包要是有问题,也别找我,新手想享受自己亲手一步步具体搭建过程的乐趣,就接着看看吧): 1.先检查vps是否满足配置pptp vpn的环境.因为有的openvz的vps被母鸡给禁用了.其实,你在配置前最好向vps的客服发TK,可能客服

Centos6.5_64位系统搭建PPTP VPN

PPTP(Point to Point Tunneling Protocol),即点对点隧道协议.该协议是在PPP协议的基础上开发的一种新的增强型安全协议,支持多协议虚拟专用网(VPN),可以通过密码验证协议(PAP).可扩展认证协议(EAP)等方法增强安全性.可以使远程用户通过拨入ISP.通过直接连接Internet或其他网络安全地访问企业网. 1.查看系统版本和内核型号 [[email protected]_nginx ~]# cat /etc/issue CentOS release 6.

Centos6一键搭建L2TP VPN服务器

Centos6一键搭建L2TP VPN服务器 技术交流  Mr.Xuan  6个月前 (05-18)  2517浏览 用VPS在墙上打洞还有一种叫L2TP,也是常见的一种方式.本脚本结合了L2TP(Layer 2 Tunneling Protocol)和IPSec(Internet Protocol Security),安装的软件包版本分别是openswan-2.6.38.xl2tpd-1.2.4,和PPTP的不同之处请戳这里查看.同样要保证你的VPS是在外面的自由世界中,且VPS是基于Xen或

CentOS 6.3上搭建PPTP VPN

系统版本:CentOS 6.3_x86_64 eth0:172.16.10.72(实验环境当公网IP使用) eth1:192.168.100.50 1.检测是否支持ppp模块 # cat /dev/ppp cat: /dev/ppp: No such device or address 如出现上面的结果,表明PPP模块开启,可以继续安装过程. 2.安装ppp # yum -y install ppp iptables 3.安装pptp 下载pptp的rpm包并安装: # wget http://

Centos7搭建pptp VPN一键安装脚本

Centos7搭建pptp一键安装脚本 废话不多说,先上脚本地址:Centos7一键pptp 使用: wget https://raw.githubusercontent.com/DanylZhang/VPS/master/CentOS7-pptp-host1plus.sh chmod +x ./CentOS7-pptp-host1plus.sh ./CentOS7-pptp-host1plus.sh -u your_username -p your_password 1 2 3 可在-u.-p