拓扑:
用FreeRadius+Mysql做cisco路由器登入认证,使客户端允许Telnet到NAS,NAS使用Radius认证
Radius Server配置:
1.首先是在Linux上安装Freeradius和Mysql server
2.在Mysql中添加radius数据库:
# mysql -uroot radius < /usr/share/doc/freeradius-1.0.1/db_mysql.sql
//这个是freeradius用的Mysql模板,如果是Ubantu,则这个模板在/usr/share/doc/freeradius/mysql.sql.gz中,如果找不到,点这里下载
3.在数据库中添加认证用户信息:
#mysql -ppassword radius
>Insert into radcheck (username,attribute,op,value) values ('test','User-Password','==','123456');
//这里test为用户名,123456为用户密码
FreeRadius配置
1.配置/etc/raddb/radiusd.conf,在Ubantu中,为/etc/freeradius/radiusd.conf,这个文件是Freeradius主文件
authorize {
Preprocess /*预处理模块
# Chap /*chap认证处理模块
# Mschap /*mschap认证处理模块
Sql /*读取数据库中的用户进行认证
}
用#号注释掉其他授权方式,只留下预处理模块和SQL数据库认证方式
2.配置/etc/raddb/clients.conf,在Ubantu中,为/etc/freeradius/clients.conf,配置NAS信息
client 192.168.111.2 { /*也可以是192.168.111.0/24配置一个网段
secret = cisco /*NAS与Freeradius之间通讯的密钥。
shortname = localhost /*NAS名称,可以随便取
nastype = cisco /*NAS类型,各种类型,在clients.conf文件里有描述
}
3.配置/etc/raddb/sql.conf,在Ubantu中,为/etc/freeradius/sql.conf,配置SQL认证
sql {
server="localhost" /*数据库服务器地址
login="root" /*连接数据库使用的用户名
password="bbb" /*连接数据库的密码
radius_db="radius" /*数据库名称
}
NAS配置:
| aaa new-model |
DEBUG:在进行认证的时候,可以在shell下开启Freeradius的DEBUG模式,查看认证过程
# radiusd –xx (-xx表示启动debug模式) 在Ubantu中,为freeradius -X
