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

胖涛酱_9357

胖涛酱_9357

2016-06-01

2090人浏览

原创

pptpcentos

bitsCN.com

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

AI一键生成成品PPT☜☜☜☜☜点击生成;

 

一、安装相关配置包

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、开启另外一个终端进行测试,如图:

 

 

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

 

 

 

请先用 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插件:

 

 

[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数据库,所以做了权限等方便的修改:

 

 

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

win可用的mysql指令skill
win可用的mysql指令skill

安装、修复、更新或打包一个基于 Python 和 PyMySQL 实现的 Windows `mysql` 命令。适用于用户希望在 PowerShell/CMD 中输入 `mysql` 时重定向到 Python 实现、需要交互式输入 MySQL 连接信息、需要同步到当前用户本地 bin 目录,或需要将该能力封装成可公开复用的 Codex skill。

下载

[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 <p> </p><p>四、修改radius的相关配置文件:</p><p></p><pre class="brush:sql;">[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 <p> </p><p> </p><p>说明:如果在运行radiusd -X 时会加载配置文件;</p><p>如果看到加载的配置文件时,出现下面的错误:</p><p> </p><p>@@##@@</p><p> </p><p>!!! Error !!!</p><p>Duplicate virtual server "inner-tunnel" in file /etc/raddb/sites-enabled/inner-tunnel:11 </p><p>and file /etc/raddb/sites-enabled/inner-tunnel.bak:11</p><p>请将/etc/raddb/sites-enabled/inner-tunnel.bak 与 /etc/raddb/sites-enabled/default.bak全部删除,</p><p>这也是为什么下面在编辑前没有备份这两个文件的原因:</p><p></p><pre class="brush:sql;">[plain] 1. [root@localhost ~]# vi /etc/raddb/sites-enabled/default  2. 行号  |       修改后配置                    |               未修改的配置  3. 170    #       files                         |          files  <p> </p><p>2、启动radiusd服务,并在数据库总插入测试账号,并查看测试结果!</p><p> </p><p>@@##@@</p><p> </p><p>3、测试通过后,修改默认密钥密码:</p><p></p><pre class="brush:sql;">[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、重新启动相关服务后,进行数据库用户测试!

 

 

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

 

 

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

bitsCN.com

相关文章

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

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

下载

相关标签:

mysql

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

相关专题

更多
GoFrame框架Web开发与路由中间件
GoFrame框架Web开发与路由中间件

本专题聚焦GoFrame框架的Web开发,拆解路由注册与匹配规则、请求参数获取、参数校验与中间件执行顺序,说明统一响应、JWT鉴权、文件上传与接口文档生成的落地方式,并补充优雅重启与测试实践。

2026.11.17

0

15

GoFrame框架安装与gf命令行工具
GoFrame框架安装与gf命令行工具

本专题围绕GoFrame框架的安装与工具链配置展开,讲清Go版本要求、gf命令行的安装方式、代理镜像与依赖准备,说明项目初始化、热编译、交叉编译打包的做法,并整理安装阶段的常见报错与验证步骤。

2026.11.17

0

15

GoFrame框架零基础入门
GoFrame框架零基础入门

本专题整理GoFrame框架的入门知识,从模块化设计理念、环境准备到跑通第一个Web服务,讲清目录分层、配置加载、日志与中间件的用法,并对比Gin、Go-Zero的差异,帮助Go开发者建立整体认知。

2026.11.17

0

15

SQLAlchemy 一对多关系怎么建立
SQLAlchemy 一对多关系怎么建立

SQLAlchemy 一对多关系怎么建立?本专题整理父子表外键、relationship 双向映射、关联查询、级联删除和加载优化等相关文章,帮助你理解并实现常见的 ORM 关系建模。

2026.11.17

0

10

SQLAlchemy 如何增删改查
SQLAlchemy 如何增删改查

SQLAlchemy 如何增删改查?本专题整理 ORM 新增记录、条件查询、更新和删除、Session 事务提交与批量处理等实用文章,帮助你掌握 Python 数据库操作流程。

2026.11.17

0

11

SQLAlchemy ORM 模型怎么写
SQLAlchemy ORM 模型怎么写

SQLAlchemy ORM 模型怎么写?本专题整理模型类定义、Mapped 字段映射、主键与约束、表结构创建和常见报错的相关文章,帮助你从基础配置到实际建模逐步掌握 SQLAlchemy。

2026.11.17

0

16

Go-Zero API开发使用教程
Go-Zero API开发使用教程

本专题聚焦Go-Zero的API开发,拆解.api描述文件的语法结构、路由与分组定义、参数绑定与校验规则,说明统一响应体、JWT鉴权、跨域与接口文档生成的落地方式,并给出网关聚合与接口测试的实践建议。

2026.11.12

160

15

Go-Zero安装与goctl环境配置教程
Go-Zero安装与goctl环境配置教程

本专题围绕Go-Zero的安装与工具链配置展开,讲清Go版本要求、goctl安装方式、代理镜像、protoc依赖与环境变量设置,说明多版本共存、升级回退与CI流水线安装的做法,并整理安装阶段的常见报错与验证步骤。

2026.11.12

120

15

Go-Zero零基础入门教程
Go-Zero零基础入门教程

本专题整理Go-Zero的入门知识,从框架定位、环境准备到跑通第一个API服务,讲清目录分层、配置加载、日志与中间件的基本用法,并对比Gin、Kratos的差异,帮助Go开发者建立整体认知,判断它是否适合当前项目。

2026.11.12

100

15

热门下载

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

精品课程

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