Centos7 基于freeradius的radius认证方案
安装环境介绍
以下服务器信息为该文档安装Radius服务环境
服务器信息:CentOS7
内核版本:3.10.0-1062.el7.x86_64
安装软件版本
freeradius-utils-3.0.4-8.el7_3.x86_64
freeradius-3.0.4-8.el7_3.x86_64
freeradius-mysql-3.0.4-8.el7_3.x86_64
一,Radius安装
1.1 查看服务器信息:uname -a(可操作也可以省略)
1.2 更新yum源(可操作也可以省略)
yum update
1.3 查看软件安装包
yum list | grep freeradius
1.4 安装软件包
yum install freeradius freeradius-utils
1.5 查看包是否安装
rpm -qa |grep freeradius
二,配置freeradius
2.1修改client配置文件
vi /etc/raddb/clients.conf配置文件。将文件241-244行取消注销,将radius对当前网段开放,修改共享密钥(该文档配置密钥为songchen)
将ipaddr修改成0.0.0.0/0是表示任何网段的ip都可以访问
2.2修改users配置文件
vi /etc/raddb/users,添加用户信息。将文件87-88行取消注销,或者自己新增也行,(song为测试用户,chen为测试密码)
2.3启动radius服务并设置开机启动
systemctl start radiusd 启动服务
systemctl enable radiusd 设置开机启动
systemctl status radiusd 查看radiusd状态
增加ipv6访问:
FreeRadius默认没有认证成功的记录,如果希望看到认证成功的记录,可以进行如下配置
1. 配置/etc/raddb/radiusd.conf ,修改以下部分:
Log{ auth = yes auth_badpass = yes auth_goodpass = yes }
2. 配置/etc/raddb/sites-available/default,修改以下部分
Authorize{ auth_log } post-auth{ reply_log }
3. 重启radiusd服务
systemctl restart radiusd
之后可以在/var/log/radius/radius.log里面看到认证成功的日志。
交换机配置部分
authentication unified-mode authentication-profile name p1 dot1x-access-profile d1 access-domain example.com force authentication mode multi-authen max-user 1024 radius-server template rd1 radius-server shared-key cipher xxxx radius-server authentication 192.168.200.x 1812 weight 80 aaa authentication-scheme abc authentication-mode radius domain example.com authentication-scheme abc radius-server rd1
dot1x-access-profile name d1
dot1x timer client-timeout 30
#1口上联,2口接PC机
interface GigabitEthernet0/0/1 port link-type access port default vlan 20 # interface GigabitEthernet0/0/2 port link-type access port default vlan 20 authentication-profile p1
注意:如果连接不上,请关闭防火墙
安装之前,一定要关闭防火墙
- 关闭防火墙
systemctl stop firewalld.service - 禁止firewall开机启动
systemctl disable firewalld.service - 查看默认防火墙状态
firewall-cmd --state
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构