配置主备服务器故障时用户Portal认证逃生示例
组网需求
如图2-67所示,SwitchA作为某企业网络的接入设备,网络中部署了两台RADIUS/Portal服务器,企业内用户的认证方式为Portal+RADIUS认证,认证成功后能够访问Internet。现在,管理员希望在RADIUS/Portal服务器故障的情况下,用户能够进入逃生,逃生时的权限与认证成功后的权限一致;在RADIUS/Portal服务器故障恢复后,用户能够进行重认证,重新使用RADIUS服务器授权。
配置注意事项
- 本举例主要介绍SwitchA上的NAC相关配置,RADIUS/Portal服务器配置这里不做相关说明。
RADIUS服务器上配置的RADIUS认证和计费密钥需与设备上配置的RADIUS服务器的共享密钥一致。
- Portal服务器上配置的Portal密钥、端口号需与设备上配置的共享密钥、设备侦听Portal协议报文的端口号一致。
- 设备默认出接口的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地址。
- 设备默认出接口的IP地址作为向Portal服务器发送Portal报文时使用的源IP地址,该IP地址需与Portal服务器上配置的设备IP地址一致。用户可以通过命令source-interface或source-ip修改该IP地址。
- 测试单个用户触发RADIUS服务器Down方法。
[SwitchA] radius-server dead-interval 7 [SwitchA] radius-server dead-count 1
执行命令test-aaa四次后,RADIUS服务器Down。
配置思路
- 配置网络互连互通,使得设备之间路由可达。
- 配置AAA,对用户进行RADIUS认证、授权、计费。
- 配置Portal认证,并配置RADIUS/Portal服务器故障时的逃生权限,实现用户认证逃生功能。
操作步骤
- 配置网络互连互通。
# 创建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 access [SwitchA-GigabitEthernet0/0/2] port default 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
- 配置Portal认证。
# 将NAC配置模式切换成统一模式。
设备默认为统一模式。传统模式与统一模式相互切换后,设备会自动重启。
[SwitchA] authentication unified-mode
# 配置Portal服务器模板server1和server2。[SwitchA] web-auth-server server1 [SwitchA-web-auth-server-server1] server-ip 10.7.66.66 [SwitchA-web-auth-server-server1] port 50200 [SwitchA-web-auth-server-server1] url http://10.7.66.66:8080/portal [SwitchA-web-auth-server-server1] shared-key cipher Example@123 [SwitchA-web-auth-server-server1] server-detect max-times 3 interval 60 [SwitchA-web-auth-server-server1] quit [SwitchA] web-auth-server server2 [SwitchA-web-auth-server-server2] server-ip 10.7.66.67 [SwitchA-web-auth-server-server2] port 50200 [SwitchA-web-auth-server-server2] url http://10.7.66.67:8080/portal [SwitchA-web-auth-server-server2] shared-key cipher Example@123 [SwitchA-web-auth-server-server2] server-detect max-times 3 interval 60 [SwitchA-web-auth-server-server2] quit
# 配置Portal接入模板web1,使能主备Portal认证。[SwitchA] portal-access-profile name web1 [SwitchA-portal-acces-profile-web1] web-auth-server server1 server2 direct [SwitchA-portal-acces-profile-web1] quit
# 配置RADIUS服务器故障时的逃生权限。以用户逃生时授权业务方案为例,其他授权信息的配置可参考(可选)配置认证事件授权信息。
[SwitchA] acl 3001 [SwitchA-acl-adv-3001] rule 1 permit ip source 192.168.2.0 0.0.0.255 [SwitchA-acl-adv-3001] quit [SwitchA] aaa [SwitchA-aaa] service-scheme s1 [SwitchA-aaa-service-s1] acl-id 3001 [SwitchA-aaa-service-s1] quit [SwitchA-aaa] quit [SwitchA] authentication-profile name p1 [SwitchA-authen-profile-p1] authentication event authen-server-down action authorize service-scheme s1 [SwitchA-authen-profile-p1] quit
# 配置Portal服务器故障时的逃生权限和Portal服务器恢复后的重认证功能。以用户逃生时授权业务方案为例,其他授权信息的配置可参考(可选)配置Portal逃生功能。
[SwitchA] portal-access-profile name web1 [SwitchA-portal-acces-profile-web1] authentication event portal-server-down action authorize service-scheme s1 [SwitchA-portal-acces-profile-web1] authentication event portal-server-up action re-authen [SwitchA-portal-acces-profile-web1] quit
# 在认证模板上绑定Portal接入模板web1、指定认证模板下用户的强制认证域为example.com。
认证模板下配置强制域之后,使用该认证模板的用户,无论用户名是否携带域名或携带何种域名,均在该域下进行认证。
[SwitchA] authentication-profile name p1 [SwitchA-authen-profile-p1] portal-access-profile web1 [SwitchA-authen-profile-p1] access-domain example.com force [SwitchA-authen-profile-p1] quit
# 在接口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
- 验证配置结果。
- 用户启动终端后,访问网络会触发重定向,用户在重定向出的页面中输入用户名和密码进入Portal认证。认证后,用户能够访问Internet
- 在RADIUS/Portal服务器的状态为Down时,用户能够访问Internet。
- 主RADIUS服务器状态为Down时,通过备RADIUS服务器对用户授权,用户可以继续访问Internet。如果主备RADIUS服务器状态都为Down,用户进入逃生状态,可以访问指定的网络资源。主Portal服务器状态为Down时,通过备Portal服务器对用户认证。如果主备Portal服务器状态都为Down,用户进入逃生状态,可以访问指定的网络资源。
- 用户上线后,在SwitchA执行命令display access-user ip-address查看在线用户信息。