0

0

CentOS 5.4 pptp + freeradius2 +mysql +daloradius完美整合(图_MySQL

php中文网

php中文网

发布时间:2016-06-01 13:32:23

|

2070人浏览过

|

来源于php中文网

原创

pptpcentos

bitsCN.com

CentOS 5.4 pptp + freeradius2 +mysql +daloradius完美整合(图文并茂)

成品ppt在线生成,百种模板可供选择☜☜☜☜☜点击使用

 

AdsGo AI
AdsGo AI

全自动 AI 广告专家,助您在数分钟内完成广告搭建、优化及扩量

下载

一、安装相关配置包

1、安装httpd、mysql及php相关包[plain] 1. [root@localhost ~]# yum -y install httpd httpd-devel mysql mysql-server mysql-devel  2. [root@localhost ~]# yum -y install php php-devel php-mysql php-common php-gd php-mbstring php-mcry  2、配置httpd服务:[plain] 1. [root@localhost ~]# netstat -ant |grep 80  2. [root@localhost ~]# /etc/init.d/httpd start  3. Starting httpd:                                            [  OK  ]  4. [root@localhost ~]# vi /etc/sysconfig/iptables  5. [root@localhost ~]# grep 80 /etc/sysconfig/iptables  6. -A RH-Firewall-1-INPUT -p tcp -m tcp --dport 80 -j ACCEPT  #增加此行  7. [root@localhost ~]# /etc/init.d/iptables restart  8. Flushing firewall rules:                                   [  OK  ]  9. Setting chains to policy ACCEPT: filter nat                [  OK  ]  10. Unloading iptables modules:                                [  OK  ]  11. Applying iptables firewall rules:                          [  OK  ]  12. Loading additional iptables modules: ip_conntrack_netbios_n[  OK  ]  13. [root@localhost ~]# chkconfig httpd --list  14. httpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off  15. [root@localhost ~]# chkconfig httpd on  #设置httpd自动启动  16. [root@localhost ~]# chkconfig httpd --list  17. httpd           0:off   1:off   2:on    3:on    4:on    5:on    6:off  18. [root@localhost ~]# netstat -ant |grep 80  19. tcp        0      0 :::80                       :::*                        LISTEN  3、启动mysql数据库:[plain] 1. [root@localhost ~]# /etc/init.d/mysqld start  2. Initializing MySQL database:  Installing MySQL system tables...  3. OK  4. Filling help tables...  5. OK  6. 7. To start mysqld at boot time you have to copy  8. support-files/mysql.server to the right place for your system  9. 10. PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !  11. To do so, start the server, then issue the following commands:  12. /usr/bin/mysqladmin -u root password 'new-password'  13. /usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'  14. 15. Alternatively you can run:  16. /usr/bin/mysql_secure_installation  17. 18. See the manual for more instructions.  19. 20. You can start the MySQL daemon with:  21. cd /usr ; /usr/bin/mysqld_safe &  22. 23. You can test the MySQL daemon with mysql-test-run.pl  24. cd mysql-test ; perl mysql-test-run.pl  25. 26. Please report any problems with the /usr/bin/mysqlbug script!  27. 28. The latest information about MySQL is available on the web at  29. http://www.mysql.com  30. Support MySQL by buying support/licenses at http://shop.mysql.com  31.                                                            [  OK  ]  32. Starting mysqld:                                           [  OK  ]  4、设置数据库密码;[plain] 1. [root@localhost ~]# mysqladmin -u root password 'leekwen'  5、安装Freeradius2相关包[plain] 1. [root@localhost ~]# yum install -y freeradius2 freeradius2-mysql freeradius2-utils  6、启动radius进程,调试模式:[plain] 1. [root@localhost ~]# radiusd -X  2. FreeRADIUS Version 2.1.12, for host i386-redhat-linux-gnu, built on Jan  9 2013 at 05:02:57  3. Copyright (C) 1999-2009 The FreeRADIUS server project and contributors.  4.  ... adding new socket proxy address * port 51738  5. Listening on authentication address * port 1812  6. Listening on accounting address * port 1813  7. Listening on command file /var/run/radiusd/radiusd.sock  8. Listening on authentication address 127.0.0.1 port 18120 as server inner-tunnel  9. Listening on proxy address * port 1814  10. Ready to process requests.  

 

7、开启另外一个终端进行测试,如图:

 

CentOS 5.4 pptp + freeradius2 +mysql +daloradius完美整合(图_MySQL

 

8、如果结果与上图不同,请临时关闭防火墙后,临时关闭防火墙命令如下:

[plain] 1. [root@localhost ~]# iptables -F  重新运行测试命令:[plain] 1. [root@localhost ~]# radtest steve testing localhost 1812 testing123  ###############  !!error !!  ###############Failed binding to authentication address * port 1812: Address already in use/etc/raddb/radiusd.conf[240]: Error binding to port for 0.0.0.0 port 1812

 

 

CentOS 5.4 pptp + freeradius2 +mysql +daloradius完美整合(图_MySQL

 

请先用 lsof 命令查看,再用 killall -9 radiusd命令结束后,重新开启服务后,在进行测试!

二、下载ppp源码文件,集成ppp client:

1、下载源码:

[plain] 1. [root@localhost ~]# wget ftp://ftp.samba.org/pub/ppp/ppp-2.4.4.tar.gz  2. --2013-07-01 18:33:36--  ftp://ftp.samba.org/pub/ppp/ppp-2.4.4.tar.gz  3.            => `ppp-2.4.4.tar.gz'  4. Resolving ftp.samba.org... 216.83.154.106, 2001:470:1f05:1a07::1  5. Connecting to ftp.samba.org|216.83.154.106|:21... connected.  6. Logging in as anonymous ... Logged in!  7. ==> SYST ... done.    ==> PWD ... done.  8. ==> TYPE I ... done.  ==> CWD /pub/ppp ... done.  9. ==> SIZE ppp-2.4.4.tar.gz ... 688763  10. ==> PASV ... done.    ==> RETR ppp-2.4.4.tar.gz ... done.  11. Length: 688763 (673K)  12. 13. 100%[===========================================>] 688,763      135K/s   in 5.3s  14. 15. 2013-07-01 18:33:45 (127 KB/s) - `ppp-2.4.4.tar.gz' saved [688763]  2、解压并做相关配置[plain] 1. [root@localhost ~]# tar zxf ppp-2.4.4.tar.gz  2. [root@localhost ~]# cp -R ppp-2.4.4/pppd/plugins/radius/etc/ /etc/radiusclient  3. [root@localhost ~]# cp /etc/radiusclient/radiusclient.conf /etc/radiusclient/radiusclient.conf.bak  4. [root@localhost ~]# vi /etc/radiusclient/radiusclient.conf  5. 行号                修改前的配置文件                                修改后的配置文件  6. 25   issue         /usr/local/etc/radiusclient/issue      修改为:issue        /etc/radiusclient/issue  7. 46   servers      /usr/local/etc/radiusclient/servers     修改为:servers     /etc/radiusclient/servers  8. 50   dictionary  /usr/local/etc/radiusclient/dictionary   修改为:dictionary /etc/radiusclient/dictionary  9. 61   mapfile    /usr/local/etc/radiusclient/port-id-map   修改为:mapfile   /etc/radiusclient/port-id-map  说明:修改相关配置文件的路径,确保radiusclient.conf这个文件中radiusclient相关的路径都是“/etc/radiusclient”开头的.3、配置字典文件:[plain] 1. [root@localhost ~]# ls -l /etc/radiusclient/dictionary*  2. -rw-r--r-- 1 root root  7656 Jul  1 18:34 /etc/radiusclient/dictionary  3. -rw-r--r-- 1 root root 12295 Jul  1 18:34 /etc/radiusclient/dictionary.ascend  4. -rw-r--r-- 1 root root  1395 Jul  1 18:34 /etc/radiusclient/dictionary.compat  5. -rw-r--r-- 1 root root   599 Jul  1 18:34 /etc/radiusclient/dictionary.merit  6. -rw-r--r-- 1 root root  2649 Jul  1 18:34 /etc/radiusclient/dictionary.microsoft  7. [root@localhost ~]# vi /etc/radiusclient/dictionary  8. 行号          文件内容  9. 253  INCLUDE /etc/radiusclient/dictionary.microsoft  10. 254  INCLUDE /etc/radiusclient/dictionary.merit    #增加此行  11. 255  INCLUDE /etc/radiusclient/dictionary.ascend   #增加此行  12. 256  INCLUDE /etc/radiusclient/dictionary.compat   #增加此行  

 

 

4、在pptpd服务中添加freeradius插件:

 

CentOS 5.4 pptp + freeradius2 +mysql +daloradius完美整合(图_MySQL

 

[plain] 1. [root@localhost ~]# vi /etc/ppp/options.pptpd  2. 行号          文件内容  3. 128  # put plugins here  4. 129  # (putting them higher up may cause them to sent messages to the pty)  5. 130  plugin /usr/lib/pppd/2.4.4/radius.so    #增加此行  6. 131  plugin /usr/lib/pppd/2.4.4/radattr.so    #增加此行  7. 132  radius-config-file /etc/radiusclient/radiusclient.conf    #增加此行  8. [root@localhost ~]# tail -n 3 /etc/ppp/options.pptpd  9. plugin /usr/lib/pppd/2.4.4/radius.so  10. plugin /usr/lib/pppd/2.4.4/radattr.so  11. radius-config-file /etc/radiusclient/radiusclient.conf  

 

三、建立radius数据库及导入相应的数据库表:

可采用命令或使用Navicat for MySQL工具来完成:

1、radius中提供了mysql的导入文件:[plain] 1. [root@localhost ~]# ls /etc/raddb/sql/mysql/*.sql -l  2. -rw-r----- 1 root radiusd  661 Jan  9 02:04 /etc/raddb/sql/mysql/admin.sql  3. -rw-r----- 1 root radiusd  452 Jan  9 02:04 /etc/raddb/sql/mysql/cui.sql  4. -rw-r----- 1 root radiusd  761 Jan  9 02:04 /etc/raddb/sql/mysql/ippool.sql  5. -rw-r----- 1 root radiusd  399 Jan  9 02:04 /etc/raddb/sql/mysql/nas.sql  6. -rw-r----- 1 root radiusd 4318 Jan  9 02:04 /etc/raddb/sql/mysql/schema.sql  7. -rw-r----- 1 root radiusd  407 Jan  9 02:04 /etc/raddb/sql/mysql/wimax.sql  

 

2、这里采用了命令方式,首先建立radius数据库:

为了方便以后使用Navicat for MySQL工具管理Mysql数据库,所以做了权限等方便的修改:

 

CentOS 5.4 pptp + freeradius2 +mysql +daloradius完美整合(图_MySQL

 

3、具体操作可复制代码:

[plain] 1. [root@localhost ~]# mysql -uroot -p  2. Enter password:  3. Welcome to the MySQL monitor.  Commands end with ; or /g.  4. Your MySQL connection id is 4  5. Server version: 5.0.95 Source distribution  6. 7. Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.  8. 9. Oracle is a registered trademark of Oracle Corporation and/or its  10. affiliates. Other names may be trademarks of their respective  11. owners.  12. 13. Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.  14. 15. mysql> show databases;  16. +--------------------+  17. | Database           |  18. +--------------------+  19. | information_schema |  20. | mysql              |  21. | test               |  22. +--------------------+  23. 3 rows in set (0.00 sec)  24. 25. mysql> CREATE DATABASE radius DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;  26. Query OK, 1 row affected (0.00 sec)  27. 28. mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'leekwen' WITH GRANT OPTION;  29. Query OK, 0 rows affected (0.00 sec)  30. 31. mysql> flush PRIVILEGES;  32. Query OK, 0 rows affected (0.00 sec)  33. 34. mysql> /q;  35. Bye  36. [root@localhost ~]# mysql -uroot -p radius < /etc/raddb/sql/mysql/admin.sql  37. Enter password:  38. [root@localhost ~]# mysql -uroot -p radius < /etc/raddb/sql/mysql/cui.sql  39. Enter password:  40. [root@localhost ~]# mysql -uroot -p radius < /etc/raddb/sql/mysql/ippool.sql  41. Enter password:  42. [root@localhost ~]# mysql -uroot -p radius < /etc/raddb/sql/mysql/nas.sql  43. Enter password:  44. [root@localhost ~]# mysql -uroot -p radius < /etc/raddb/sql/mysql/schema.sql  45. Enter password:  46. [root@localhost ~]# mysql -uroot -p radius < /etc/raddb/sql/mysql/wimax.sql  47. Enter password:  4、防火墙中关于数据库相关的设置:[plain] 1. [root@localhost ~]# grep 3306 /etc/sysconfig/iptables  2. [root@localhost ~]# vi /etc/sysconfig/iptables  3. [root@localhost ~]# /etc/init.d/iptables restart  4. Flushing firewall rules:                                   [  OK  ]  5. Setting chains to policy ACCEPT: filter nat                [  OK  ]  6. Unloading iptables modules:                                [  OK  ]  7. Applying iptables firewall rules:                          [  OK  ]  8. Loading additional iptables modules: ip_conntrack_netbios_n[  OK  ]  9. [root@localhost ~]# grep 3306 /etc/sysconfig/iptables  10. -A RH-Firewall-1-INPUT -p tcp -m tcp --dport 3306 -j ACCEPT  

 

四、修改radius的相关配置文件:

[plain] 1. [root@localhost ~]# cp /etc/raddb/radiusd.conf /etc/raddb/radiusd.conf.bak  2. [root@localhost ~]# vi /etc/raddb/radiusd.conf  3. 行号 |      修改后配置                |           未修改的配置  4. 700  | $INCLUDE sql.conf              | #  $INCLUDE sql.conf <------去掉注释#  5. 712  | $INCLUDE sql/mysql/counter.conf| #  $INCLUDE sql/mysql/counter.conf  <------去掉注释#  6. 7. [root@localhost ~]# cp /etc/raddb/sql.conf /etc/raddb/sql.conf.bak  8. [root@localhost ~]# vi /etc/raddb/sql.conf  9. 行号 |     修改后配置           |     未修改的配置  10. 38   |   login = "root"         |   login = "radius"   <------修改连接mysql的用户名  11. 39   |   password = "leekwen"   |  password = "radpass"<------修改连接mysql的密码  12. 100  |   readclients = yes      | #readclients = yes   <------去掉注释#  

 

 

说明:如果在运行radiusd -X 时会加载配置文件;

如果看到加载的配置文件时,出现下面的错误:

 

CentOS 5.4 pptp + freeradius2 +mysql +daloradius完美整合(图_MySQL

 

!!! Error !!!

Duplicate virtual server "inner-tunnel" in file /etc/raddb/sites-enabled/inner-tunnel:11 

and file /etc/raddb/sites-enabled/inner-tunnel.bak:11

请将/etc/raddb/sites-enabled/inner-tunnel.bak 与 /etc/raddb/sites-enabled/default.bak全部删除,

这也是为什么下面在编辑前没有备份这两个文件的原因:

[plain] 1. [root@localhost ~]# vi /etc/raddb/sites-enabled/default  2. 行号  |       修改后配置                    |               未修改的配置  3. 170    #       files                         |          files  <------增加注释#  4. 177            sql                           |  #       sql    <------去掉注释#  5. 372    #       files                         |          files  <------增加注释#  6. 406            sql                           |  #       sql  <------去掉注释#  7. 454            sql                           |  #       sql  <------去掉注释#  8. 475            sql                           |  #       sql  <------去掉注释#  9. 10. [root@localhost ~]# vi /etc/raddb/sites-enabled/inner-tunnel  11. 行号  |      修改后配置                     |           未修改的配置  12. 124124   #       files                          |           files <------增加注释#  13. 131           sql                            |   #       sql  <------去掉注释#  14. 255           sql                            |   #       sql  <------去掉注释#  15. 277           sql                            |   #       sql  <------去掉注释#  

 

2、启动radiusd服务,并在数据库总插入测试账号,并查看测试结果!

 

CentOS 5.4 pptp + freeradius2 +mysql +daloradius完美整合(图_MySQL

 

3、测试通过后,修改默认密钥密码:

[plain] 1. [root@localhost ~]# cp /etc/raddb/clients.conf /etc/raddb/clients.conf.bak  2. [root@localhost ~]# vi /etc/raddb/clients.conf  3. 4. 行号  |      修改后配置                  |           未修改的配置  5. 101       secret          = leekwen       |        secret          = testing123  

 

 

4、重新启动相关服务后,进行数据库用户测试!

 

CentOS 5.4 pptp + freeradius2 +mysql +daloradius完美整合(图_MySQL

 

5、此测试通过后,进行客户端的拨号连接,并在服务端查看客户端的拨号日志:

 

CentOS 5.4 pptp + freeradius2 +mysql +daloradius完美整合(图_MySQL

 

6、到此,已经完成了pptpd + freeradius2 + mysql 三者之间的整合.

bitsCN.com

相关文章

成品ppt在线生成
成品ppt在线生成

不想找模板、不想调排版?试试这款智能PPT生成工具,输入主题,几分钟生成一套高质量PPT,省时又省心。

下载

相关标签:

本站声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热门AI工具

更多
DeepSeek
DeepSeek

幻方量化公司旗下的开源大模型平台

豆包大模型
豆包大模型

字节跳动自主研发的一系列大型语言模型

通义千问
通义千问

阿里巴巴推出的全能AI助手

腾讯元宝
腾讯元宝

腾讯混元平台推出的AI助手

文心一言
文心一言

文心一言是百度开发的AI聊天机器人,通过对话可以生成各种形式的内容。

讯飞写作
讯飞写作

基于讯飞星火大模型的AI写作工具,可以快速生成新闻稿件、品宣文案、工作总结、心得体会等各种文文稿

即梦AI
即梦AI

一站式AI创作平台,免费AI图片和视频生成。

ChatGPT
ChatGPT

最最强大的AI聊天机器人程序,ChatGPT不单是聊天机器人,还能进行撰写邮件、视频脚本、文案、翻译、代码等任务。

相关专题

更多
pixiv网页版官网登录与阅读指南_pixiv官网直达入口与在线访问方法
pixiv网页版官网登录与阅读指南_pixiv官网直达入口与在线访问方法

本专题系统整理pixiv网页版官网入口及登录访问方式,涵盖官网登录页面直达路径、在线阅读入口及快速进入方法说明,帮助用户高效找到pixiv官方网站,实现便捷、安全的网页端浏览与账号登录体验。

705

2026.02.13

微博网页版主页入口与登录指南_官方网页端快速访问方法
微博网页版主页入口与登录指南_官方网页端快速访问方法

本专题系统整理微博网页版官方入口及网页端登录方式,涵盖首页直达地址、账号登录流程与常见访问问题说明,帮助用户快速找到微博官网主页,实现便捷、安全的网页端登录与内容浏览体验。

233

2026.02.13

Flutter跨平台开发与状态管理实战
Flutter跨平台开发与状态管理实战

本专题围绕Flutter框架展开,系统讲解跨平台UI构建原理与状态管理方案。内容涵盖Widget生命周期、路由管理、Provider与Bloc状态管理模式、网络请求封装及性能优化技巧。通过实战项目演示,帮助开发者构建流畅、可维护的跨平台移动应用。

117

2026.02.13

TypeScript工程化开发与Vite构建优化实践
TypeScript工程化开发与Vite构建优化实践

本专题面向前端开发者,深入讲解 TypeScript 类型系统与大型项目结构设计方法,并结合 Vite 构建工具优化前端工程化流程。内容包括模块化设计、类型声明管理、代码分割、热更新原理以及构建性能调优。通过完整项目示例,帮助开发者提升代码可维护性与开发效率。

22

2026.02.13

Redis高可用架构与分布式缓存实战
Redis高可用架构与分布式缓存实战

本专题围绕 Redis 在高并发系统中的应用展开,系统讲解主从复制、哨兵机制、Cluster 集群模式及数据分片原理。内容涵盖缓存穿透与雪崩解决方案、分布式锁实现、热点数据优化及持久化策略。通过真实业务场景演示,帮助开发者构建高可用、可扩展的分布式缓存系统。

61

2026.02.13

c语言 数据类型
c语言 数据类型

本专题整合了c语言数据类型相关内容,阅读专题下面的文章了解更多详细内容。

30

2026.02.12

雨课堂网页版登录入口与使用指南_官方在线教学平台访问方法
雨课堂网页版登录入口与使用指南_官方在线教学平台访问方法

本专题系统整理雨课堂网页版官方入口及在线登录方式,涵盖账号登录流程、官方直连入口及平台访问方法说明,帮助师生用户快速进入雨课堂在线教学平台,实现便捷、高效的课程学习与教学管理体验。

15

2026.02.12

豆包AI网页版入口与智能创作指南_官方在线写作与图片生成使用方法
豆包AI网页版入口与智能创作指南_官方在线写作与图片生成使用方法

本专题汇总豆包AI官方网页版入口及在线使用方式,涵盖智能写作工具、图片生成体验入口和官网登录方法,帮助用户快速直达豆包AI平台,高效完成文本创作与AI生图任务,实现便捷智能创作体验。

669

2026.02.12

PostgreSQL性能优化与索引调优实战
PostgreSQL性能优化与索引调优实战

本专题面向后端开发与数据库工程师,深入讲解 PostgreSQL 查询优化原理与索引机制。内容包括执行计划分析、常见索引类型对比、慢查询优化策略、事务隔离级别以及高并发场景下的性能调优技巧。通过实战案例解析,帮助开发者提升数据库响应速度与系统稳定性。

58

2026.02.12

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
MySQL 教程
MySQL 教程

共48课时 | 2.3万人学习

MySQL 初学入门(mosh老师)
MySQL 初学入门(mosh老师)

共3课时 | 0.3万人学习

简单聊聊mysql8与网络通信
简单聊聊mysql8与网络通信

共1课时 | 835人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号