配置主备RADIUS服务器故障时用户802.1X认证逃生示例
组网需求
如图2-61所示,SwitchA作为某企业网络的接入设备,网络中部署了两台RADIUS服务器,企业内用户的认证方式为802.1X+RADIUS认证,认证成功后能够访问Internet。现在,管理员希望在RADIUS服务器故障的情况下,用户能够进入逃生,逃生时的权限与认证成功后的权限一致;在RADIUS服务器故障恢复后,用户能够进行重认证,重新使用RADIUS服务器授权。
配置注意事项
- 本举例主要介绍SwitchA上的NAC相关配置,RADIUS服务器配置这里不做相关说明。
RADIUS服务器上配置的RADIUS认证和计费密钥需与设备上配置的RADIUS服务器的共享密钥一致。
- 设备默认出接口的IP地址作为向RADIUS服务器发送RADIUS报文时使用的源IP地址,该IP地址需与RADIUS服务器上配置的设备IP地址一致。用户可以通过如下命令修改该IP地址:
- 执行命令radius-server authentication ip-address port source,配置RADIUS认证服务器,并指定与RADIUS认证服务器发送RADIUS报文时使用的源IP地址。
- 执行命令radius-server accounting ip-address port source,配置RADIUS计费服务器,并指定与RADIUS计费服务器发送RADIUS报文时使用的源IP地址。
- 执行命令authentication event authen-server-up action re-authen时,需同时执行命令radius-server testuser配置自动探测功能,否则认证服务器的状态由Down转变为Up时设备对处于逃生状态的用户无法进行重认证。
- 授权VLAN时,加入VLAN的接口类型必须为Hybrid,并且在系统视图下执行命令undo authentication pre-authen-access enable去使能预连接功能。
- 测试单个用户触发RADIUS服务器Down方法。
[SwitchA] radius-server dead-interval 7 [SwitchA] radius-server dead-count 1
执行命令test-aaa四次后,RADIUS服务器Down。
配置思路
- 配置网络互连互通,使得设备之间路由可达。
- 配置AAA,对用户进行RADIUS认证、授权、计费。
- 配置802.1X认证,并配置RADIUS服务器故障时的逃生权限和RADIUS服务器故障恢复时的重认证功能,实现用户认证逃生功能。
操作步骤
- 配置网络互连互通。
# 创建VLAN并配置接口允许通过的VLAN、IP地址。
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vlan batch 10 20 [SwitchA] interface gigabitethernet 0/0/2 [SwitchA-GigabitEthernet0/0/2] port link-type hybrid [SwitchA-GigabitEthernet0/0/2] port hybrid pvid vlan 20 [SwitchA-GigabitEthernet0/0/2] port hybrid untagged vlan 20 [SwitchA-GigabitEthernet0/0/2] quit [SwitchA] interface vlanif 20 [SwitchA-Vlanif20] ip address 192.168.2.10 24 [SwitchA-Vlanif20] quit [SwitchA] interface gigabitethernet 0/0/1 [SwitchA-GigabitEthernet0/0/1] port link-type trunk [SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 [SwitchA-GigabitEthernet0/0/1] quit [SwitchA] interface vlanif 10 [SwitchA-Vlanif10] ip address 192.168.1.10 24 [SwitchA-Vlanif10] quit
# 配置到RADIUS服务器的路由,假设下一跳为192.168.1.1。
[SwitchA] ip route-static 10.7.66.0 255.255.255.0 192.168.1.1
- 配置AAA。
# 创建RADIUS服务器模板controller。
[SwitchA] radius-server template controller
# 配置RADIUS认证密钥、主备用RADIUS服务器和计费服务器的IP地址、端口和主备运算法则。
[SwitchA-radius-controller] radius-server authentication 10.7.66.66 1812 weight 80 [SwitchA-radius-controller] radius-server accounting 10.7.66.66 1813 weight 80 [SwitchA-radius-controller] radius-server authentication 10.7.66.67 1812 weight 40 [SwitchA-radius-controller] radius-server accounting 10.7.66.67 1813 weight 40 [SwitchA-radius-controller] radius-server algorithm master-backup [SwitchA-radius-controller] radius-server shared-key cipher Example@123
# 配置自动探测功能。
[SwitchA-radius-controller] radius-server testuser username test1 password cipher abc@123
# 配置对状态为Down的RADIUS服务器的自动探测周期和探测报文的超时等待时间。(取值为缺省值)
[SwitchA-radius-controller] radius-server detect-server interval 60 [SwitchA-radius-controller] radius-server detect-server timeout 3
# 配置RADIUS认证请求报文的重传次数和周期。(取值为缺省值)
[SwitchA-radius-controller] radius-server retransmit 3 timeout 5 [SwitchA-radius-controller] quit
# 配置将RADIUS服务器标记为Down的条件。(取值为缺省值)
[SwitchA] radius-server dead-interval 5 [SwitchA] radius-server dead-count 2 [SwitchA] radius-server detect-cycle 2 [SwitchA] radius-server max-unresponsive-interval 300
# 配置认证方案auth,认证模式为RADIUS认证。
[SwitchA] aaa [SwitchA-aaa] authentication-scheme auth [SwitchA-aaa-authen-auth] authentication-mode radius [SwitchA-aaa-authen-auth] quit
# 配置计费方案acc,计费模式为RADIUS计费。
[SwitchA-aaa] accounting-scheme acc [SwitchA-aaa-accounting-acc] accounting-mode radius [SwitchA-aaa-accounting-acc] quit
# 配置example域,在域下应用认证方案auth、计费方案acc、RADIUS服务器模板controller。
[SwitchA-aaa] domain example [SwitchA-aaa-domain-example] authentication-scheme auth [SwitchA-aaa-domain-example] accounting-scheme acc [SwitchA-aaa-domain-example] radius-server controller [SwitchA-aaa-domain-example] quit [SwitchA-aaa] quit
- 配置802.1X认证。
# 将NAC配置模式切换成统一模式。
设备默认为统一模式。传统模式与统一模式相互切换后,设备会自动重启。
[SwitchA] authentication unified-mode
# 配置802.1X接入模板d1、配置客户端认证超时时间为30秒。[SwitchA] dot1x-access-profile name d1 [SwitchA-dot1x-access-profile-d1] dot1x authentication-method eap [SwitchA-dot1x-access-profile-d1] dot1x timer client-timeout 30 [SwitchA-dot1x-access-profile-d1] quit
# 配置认证模板绑定802.1X接入模板d1、指定认证模板下用户的强制域为example。
认证模板下配置强制域之后,使用该认证模板的用户,无论用户名是否携带域名或携带何种域名,均在该域下进行认证。
[SwitchA] authentication-profile name p1 [SwitchA-authen-profile-p1] dot1x-access-profile d1 [SwitchA-authen-profile-p1] access-domain example force [SwitchA-authen-profile-p1] quit
# 配置RADIUS服务器故障时的逃生权限和RADIUS服务器恢复后的重认证功能。以用户逃生时授权VLAN为例,其他授权信息的配置可参考(可选)配置认证事件授权信息。
[SwitchA] authentication-profile name p1 [SwitchA-authen-profile-p1] authentication event authen-server-down action authorize vlan 20 [SwitchA-authen-profile-p1] authentication event authen-server-up action re-authen [SwitchA-authen-profile-p1] quit
# 去使能预连接功能。
[SwitchA] undo authentication pre-authen-access enable
# 在接口GE0/0/2到GE0/0/n上绑定认证模板p1,使能802.1X认证。以接口GE0/0/2为例。
[SwitchA] interface gigabitethernet 0/0/2 [SwitchA-GigabitEthernet0/0/2] authentication-profile p1 [SwitchA-GigabitEthernet0/0/2] quit
- 验证配置结果。
- 用户启动终端后,进行802.1X认证。认证成功后,用户能够访问Internet。
- 主RADIUS服务器状态为Down时,通过备RADIUS服务器对用户授权,用户可以继续访问Internet。如果主备RADIUS服务器状态都为Down,用户进入逃生状态,可以访问指定的网络资源。
- 用户上线后,在SwitchA执行命令display access-user mac-address查看在线用户信息。