站长论坛
标题:
搭建Linux下RADIUS服务器(2)
[打印本页]
作者:
lusm
时间:
2008-9-14 16:37
标题:
搭建Linux下RADIUS服务器(2)
◆String——0~253字节,字符串
◆Ipaddress——32位,IP地址
◆Integer——32位,整数
◆Time——32位,从00:00:00GMT,January1,1970到当前的总秒数
从这里可看出,RADIUS协议是一个不定长的协议栈。
安装RADIUSServer
要安装整套的IC-RADIUS,首先我们需要如表9所示的几个软件包。需要说明一下:表9中的源码包都是免费得到的,它们可以帮助我们架设一个完整的RADIUS应用环境。
软件源码包说明
mysql-3.23.39.tar.gzMySQL数据库系统
DBI-1.18.tar.gzPerl调用数据库的通用接口
Msql-Mysql-modules-1.2216.tar.gzPerlDBI针对MySQL的Driver,即DBDforMySQL
RadiusPerl-1.05.tar.gzPerl对Radius的Authen模块
icradius-0.18.1.tar.gzIC-RADIUS源码包
假设所有的原码包都被拷贝到了/usr/tmp目录下了。
安装MySQL
1.解压源码包:
Linux]#cd/usr/tmp
Linux]#gzipzxvfmysql-3.23.39.tar.gz
Linux]#cdmysql-3.23.39
2.配置参数,安装软件:
//将mysql安装在/usr/local/mysql中
Linux]#./configureprefix=/usr/local/mysql
Linux]#make//编译,时间有点长,要有耐心
Linux]#makeinstall//安装到/usr/local/mysql中
3.创建初始数据库:
Linux]#cd/usr/local/msyql/bin
Linux]#./mysql_install_db
4.创建共享库链接
Linux]#ldconfig//更新系统共享库链接
5.复制启动/停止脚本:
Linux]#cp/usr/tmp/mysql-3.23.39/support-files/mysql.server /etc/rc.d/init.d/mysql.server
6.复制并修改初始化配置文件:
Linux]#cp/usr/tmp/mysql-3.23.39/support-files/my-medium.cnf/etc/my.cnf
使用vi打开my.cnf,在[client]下加入user=root,password处留空。
7.改变root口令:
Linux]#mysqladminurootppassword‘新口令’
8.如果有多个版本的mysql共存
在/etc/my.cnf的[mysqld]下加入:
1.Log-bin
2.Server-id=1//必须是唯一的,以区别于其他的mysql.server的id
安装DBI
Linux]#cd/usr/tmp
Linux]#tarzxvfDBI-1.18.tar.gz
Linux]#cdDBI-1.18
Linux]#perlMakefile.PL
Linux]#maketest
//如果测试不通过,则使用maketestTEST_VERBOSE=1
Linux]#makeinstall
安装DBDforMySQL
Linux]#cd/usr/tmp
Linux]#tarzxvfMsql-Mysql-modules-1.2216.tar.gz
Linux]#cdMsql-Mysql-modules-1.2216
Linux]#perlMakefile.PL
这时,系统开始和用户交互,如下:
MySQLonly
mSQLonly(eitherofmSQL1ormSQL2)
MySQLandmSQL(eitherofmSQL1ormSQL2)
mSQL1andmSQL2
MySQL,mSQL1andmSQL2
Entertheappropriatenumber:[3]1
在我们这里的需求,应该回答1(说明此模块是同时forMySQL和mSQL的)
DoyouwanttoinstalltheMysqlPerlemulation?YoumightkeepyouroldMysqlmodule(tobedistinguishedfromDBD::mysql!)ifyouareconcerned
aboutcompatibilitytoexistingapplications![n]n这里回答n
WhereisyourMySQLinstalled?Pleasetellmethedirectorythat
containsthesubdir'include'.[/usr/local/mysql]?
这是缺省的mysql安装目录,我们已经按照上面的方式安装,则MySQL自动被安装到这个目录下,则这里直接回车即可
WhichdatabaseshouldIusefortestingtheMySQLdrivers?[test]
直接回车即可
Onwhichhostisdatabasetestrunning(hostname,ipaddress
orhost:port)[localhost]?
若mysql服务器和icradius服务器安装在同一个服务器上则这里直接回车即可
Usernameforconnectingtodatabasetest?[undef]root?
rootPasswordforconnectingtodatabasetest?[undef]passwd?
这里输入mysql的root用户的密码
make
maketest
makeinstall
安装RadiusPerl:Authen模块
Linux]#cd/usr/tmp
Linux]#tarzxvfRadiusPerl-0.05.tar.gz
Linux]#cdRadiusPerl-0.05
Linux]#perlMakefile.PL
Linux]#make
Linux]#maketest
Linux]#makeinstall
安装IC-RADIUS
1.安装软件:
Linux]#cd/usr/tmp
Linux]#tarzxvficradius-0.18.1.tar.gz
Linux]#cdicradius-0.18.1
Linux]#cpMakefile.lnxMakefile
Linux]#make
Linux]#makeinstall
2.创建radius数据库:
Linux]#cdscripts
Linux]#mysqlurootpmysql
Mysql>createdatabaseradius;//创建radius数据库
//添加radius用户
Mysql>grantallonradius.*onradius@localhostidentifiedby‘radius’;
Linux]#mysqladminurootprefresh//刷新数据库内容
3.导入数据表:
Linux]#mysql-uroot-pyourpasswordradius修改dictimport.pl,设置
my$dbusername='radius';
my$dbpassword='radius'
然后,导入dictionary内容,使radius.dictionary数据表中包含了基本的属性(ATTRIBUTE)和属性值(VALUE)等信息。
Linux]#./dictimport.pl../raddb/dictionary
Radius数据库结构如表10所示。
Radius数据库
dictionaryradgroupcheck
hintsradgroupreply
nasradreply
radacctrealmgroup
radact_summaryrealms
radcheckusergroup
4.启动radiusd
Linux]#cd/etc/rc.d/init.d
Linux]#radiusdstart
这样,我们已经在Linux上成功的安装了一个完整的RADIUS服务器,你可以体验一下RADIUS服务器运行的感觉了。若你对RADIUS协议的开发还兴趣的话,你可以在此基础上做深入的研究。
欢迎光临 站长论坛 (http://tzlink.com/bbs/)
Powered by Discuz! X3.2