这里出现了error while loading shared libraries: libfreeradius-radius-2.1.10.so
其实在言下之意就是缺少一个叫做libfreeradius-radius-2.1.10.so的库文件,经查找发现这个库存在于/usr/local/lib目录下
采取的解决方式是将/usr/local/lib添加到/etc/ld.so.conf中
ld.so.conf文件内容如下:
include /etc/ld.so.conf.d/*.conf
添加一行 /usr/local/lib
完成后输入/sbin/ldconfig,再重新进行上面步骤。
Listening on authentication address * port 1812
Listening on accounting address * port 1813
Listening on command file /usr/local/var/run/radiusd/radiusd.sock
Listening on proxy address * port 1814
Ready to process requests.
Ldconfig命令是将/etc/ld.so.conf列出的路径下的库文件缓存到/etc/ld.so.cache以供使用。
登陆phpmyadmin,创建数据库radius
导入/freeradius-server-2.1.8/raddb/sql/mysql/schema.sql 到radius数据库
更改/usr/local/etc/raddb/sites-available/default文件,使其支持sql
把 sql前的#去掉
authorize {
preprocess
chap
mschap
suffix
sql
}
accouting {
….
sql
…
}
更改/usr/local/etc/raddb/sql.Conf使其与mysql连接
server=”localhost”
login=”root”
password=”mysql的root的密码”
radius_db=”radius”
再更改/usr/local/etc/raddb/radiusd.conf
将$INCLUDE sql.conf前的#去掉
数据库加入测试账号
加入组:
mysql –uroot –p密码 radius
insert into radgroupreply (groupname,attribute,op,value) values (‘user’,‘Auth-Type’,’:=’,’Local’);
insert into radgroupreply (groupname,attribute,op,value) values (‘user’,‘Service-Type’,’:=’,’Framed-User’);
insert into radgroupreply (groupname,attribute,op,value) values (‘user’,‘Framed-IP-Address’,’:=’,’255.255.255.254’);
insert into radgroupreply (groupname,attribute,op,value) values (‘user’,‘Framed-IP-Netmask’,’:=’,’255.255.255.0’);
加入测试账号:
insert into radcheck (username,attribute,op,value) values (‘test’,’User-Password’,’:=’,’test’)
测试账号加入组:
insert into radusergroup (username,groupname) values (‘test’,’user’);
接着需要下载一个freeradius-mysql
#sudo apt-get install freeradius-mysql
然后到/usr/lib/freeradius将rlm_sql_mysql-2.1.9.so复制到/usr/lib下并改名为 rlm_sql_mysql.so
#cp /usr/lib/freeradius/rlm_sql_mysql_2.1.9.so /usr/lib
#mv rlm_sql_mysql_2.1.0.so rlm_sql_mysql.so
#radiusd -X
Listening on authentication address * port 1812
Listening on accounting address * port 1813
Listening on command file /usr/local/var/run/radiusd/radiusd.sock
Listening on proxy address * port 1814
Ready to process requests.
不要关闭这个终端,打开另个终端输入命令
打开另一个终端:
#radtest test test localhost 0 testing123
这时会出现服务器没有响应的提示,这是由于ipv6的影响,将/etc/hosts文件中的::1前加上#再运行以上命令。出现以下信息说明配置成功。
Sending Access-Request of id 34 to 127.0.0.1 port 1812
User-Name = "test"
User-Password = "test"
NAS-IP-Address = 127.0.1.1
NAS-Port = 0
rad_recv: Access-Accept packet from host 127.0.0.1 port 1812, id=34, length=38
Service-Type = Framed-User
Framed-IP-Address = 255.255.255.254
Framed-IP-Netmask = 255.255.255.0