配置基于默认域的用户管理示例
组网需求
如图1-35所示,企业用户通过Switch接入网络,用户名不带任何域名。
企业希望普通用户需要经过RADIUS认证后才能接入网络,并获取对应权限,管理用户需要经过Switch的本地认证后才能登录设备进行管理。
配置思路
采用如下的思路配置基于默认域的用户管理:
- 创建VLAN、VLANIF,并配置各接口,使Switch与RADIUS服务器网络互通。
- 配置普通用户的认证计费方案并应用到缺省的“default”域下,实现对不带域名的普通接入用户(例如,采用802.1X或Portal进行认证的用户)的RADIUS身份验证。
- 配置管理用户的认证和授权方案并应用到缺省的“default_admin”域下,实现对不带域名的管理用户(例如,采用Telnet、SSH或FTP方式登录的用户)的本地身份验证。
请确保已在RADIUS服务器上配置了用户,本例中假设RADIUS服务器上已配置了用户名为test1,密码为123456的用户。
本案例只包括Switch的配置,RADIUS服务器的配置这里不做相关说明。
操作步骤
- 创建VLAN并配置各接口。
# 在Switch上创建VLAN 11。
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] vlan batch 11
# 配置Switch连接RADIUS服务器的接口GE0/0/2为Access类型端口,并将GE0/0/2加入VLAN11。
[Switch] interface gigabitethernet 0/0/2 [Switch-GigabitEthernet0/0/2] port link-type access [Switch-GigabitEthernet0/0/2] port default vlan 11 [Switch-GigabitEthernet0/0/2] quit
# 创建VLANIF11,并为VLANIF11配置IP地址192.168.2.29/24。
[Switch] interface vlanif 11 [Switch-Vlanif11] ip address 192.168.2.29 24 [Switch-Vlanif11] quit
- 配置802.1X普通用户采用RADIUS方式进行认证、授权和计费。
请确保RADIUS服务器模板内的共享密钥和RADIUS服务器上的配置保持一致。
# 创建并配置RADIUS服务器模板“rd1”。
[Switch] radius-server template rd1 [Switch-radius-rd1] radius-server authentication 192.168.2.30 1812 [Switch-radius-rd1] radius-server accounting 192.168.2.30 1813 [Switch-radius-rd1] radius-server shared-key cipher Example@2012 [Switch-radius-rd1] radius-server retransmit 2 [Switch-radius-rd1] quit
# 分别创建AAA认证和计费方案“abc”并配置认证和计费方式为RADIUS。
[Switch] aaa [Switch-aaa] authentication-scheme abc [Switch-aaa-authen-abc] authentication-mode radius [Switch-aaa-authen-abc] quit [Switch-aaa] accounting-scheme abc [Switch-aaa-accounting-abc] accounting-mode radius [Switch-aaa-accounting-abc] quit
# 测试Switch与RADIUS服务器之间的连接状态。(已在RADIUS服务器上配置了测试用户test1,用户密码为123456)
[Switch-aaa] test-aaa test1 123456 radius-template rd1
# 在缺省的“default”域上绑定AAA认证方案“abc”、AAA计费方案“abc”和RADIUS服务器模板“rd1”。
[Switch-aaa] domain default [Switch-aaa-domain-default] authentication-scheme abc [Switch-aaa-domain-default] accounting-scheme abc [Switch-aaa-domain-default] radius-server rd1 [Switch-aaa-domain-default] quit [Switch-aaa] quit
# 将NAC配置模式切换成统一模式。
[Switch] authentication unified-mode
传统模式与统一模式相互切换后,设备会自动重启。缺省情况下,NAC配置模式为统一模式。
# 在接口下使能802.1X认证。
[Switch] dot1x-access-profile name d1 [Switch-dot1x-access-profile-d1] quit [Switch] authentication-profile name p1 [Switch-authen-profile-p1] dot1x-access-profile d1 [Switch-authen-profile-p1] authentication mode multi-authen max-user 100 [Switch-authen-profile-p1] quit [Switch] vlan batch 10 [Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] port link-type access [Switch-GigabitEthernet0/0/1] port default vlan 10 [Switch-GigabitEthernet0/0/1] authentication-profile p1 [Switch-GigabitEthernet0/0/1] quit
# 配置全局默认普通域为“default”。普通用户进行接入认证时,以格式“user@default”输入用户名即可在default域下进行AAA认证。如果用户名中不携带域名或携带的域名不存在,普通用户也将会在默认普通域中进行认证。
[Switch] domain default
- 配置管理用户“test”采用本地认证方式进行认证和授权。
# 配置当Telnet用户通过VTY用户界面登录设备时,采用“AAA”的授权验证方式。
[Switch] telnet server enable [Switch] user-interface vty 0 14 [Switch-ui-vty0-14] authentication-mode aaa [Switch-ui-vty0-14] protocol inbound telnet [Switch-ui-vty0-14] quit
# 创建一个名为test的本地用户,用户口令为“admin@12345”,用户级别为3。
[Switch] aaa [Switch-aaa] local-user test password irreversible-cipher admin@12345 privilege level 3
# 配置用户test的接入类型为Telnet。
[Switch-aaa] local-user test service-type telnet
# 使能本地账号锁定功能并配置用户的重试时间间隔为5分钟、连续认证失败的限制次数为3次以及账号锁定时间为5分钟。
[Switch-aaa] local-aaa-user wrong-password retry-interval 5 retry-time 3 block-time 5
# 配置认证方案auth,认证模式为Local。
[Switch-aaa] authentication-scheme auth [Switch-aaa-authen-auth] authentication-mode local [Switch-aaa-authen-auth] quit
# 配置授权方案autho,授权模式为Local。
[Switch-aaa] authorization-scheme autho [Switch-aaa-author-autho] authorization-mode local [Switch-aaa-author-autho] quit
# 配置default_admin域,在域下应用认证方案auth、授权方案autho。
[Switch-aaa] domain default_admin [Switch-aaa-domain-default_admin] authentication-scheme auth [Switch-aaa-domain-default_admin] authorization-scheme autho [Switch-aaa-domain-default_admin] quit [Switch-aaa] quit
# 配置全局默认管理域为“default_admin”。管理用户进行认证时,以格式“user@default_admin”输入用户名即可在default_admin域下进行AAA认证。如果用户名中不携带域名或携带的域名不存在,管理用户也将会在默认管理域中进行认证。
[Switch] domain default_admin admin [Switch] quit
- 验证配置结果。
# 在Switch上执行命令display dot1x interface,可以查看到802.1X认证的相关信息。
# 当普通用户上线时,在802.1X客户端输入用户名test1和密码123456后,在设备上可以通过display access-user domain和display access-user user-id命令查看用户所属的域和接入类型。
<Switch> display access-user domain default ------------------------------------------------------------------------------ UserID Username IP address MAC Status ------------------------------------------------------------------------------ 16040 test1 - 00e0-fc01-31f6 Success ------------------------------------------------------------------------------ Total: 1, printed: 1
<Switch> display access-user user-id 16040 Basic: User id : 16040 User name : test1 Domain-name : default User MAC : 00e0-4c97-31f6 User IP address : - User IPv6 address : - User access time : 2009/02/15 19:10:52 User accounting session ID : huawei255255000000000f****2016040 Option82 information : - User access type : 802.1x AAA: User authentication type : 802.1x authentication Current authentication method : RADIUS Current authorization method : - Current accounting method : RADIUS
# 当用户使用Telnet方式登录设备时,输入用户名test和密码admin@12345后,在设备上可以通过display access-user domain和display access-user user-id命令查看用户所属的域和接入类型。
<Switch> display access-user domain default_admin ------------------------------------------------------------------------------ UserID Username IP address MAC Status ------------------------------------------------------------------------------ 16009 test 10.135.18.217 - Success ------------------------------------------------------------------------------ Total: 1, printed: 1
<Switch> display access-user user-id 16009 Basic: User id : 16009 User name : test Domain-name : default_admin User MAC : - User IP address : 10.135.18.217 User IPv6 address : - User access time : 2009/02/15 05:10:52 User accounting session ID : huawei255255000000000f****2016009 Option82 information : - User access type : Telnet AAA: User authentication type : Administrator authentication Current authentication method : Local Current authorization method : Local Current accounting method : None
配置文件
Switch的配置文件
# sysname Switch # vlan batch 10 to 11 # telnet server enable # authentication-profile name p1 dot1x-access-profile d1 authentication mode multi-authen max-user 100 # radius-server template rd1 radius-server shared-key cipher %^%#Q75cNQ6IF(e#L4WMxP~%^7'u17,]D87GO{"[o]`D%^%# radius-server authentication 192.168.2.30 1812 weight 80 radius-server accounting 192.168.2.30 1813 weight 80 radius-server retransmit 2 # aaa authentication-scheme abc authentication-mode radius authentication-scheme auth authorization-scheme autho accounting-scheme abc accounting-mode radius domain default authentication-scheme abc accounting-scheme abc radius-server rd1 domain default_admin authentication-scheme auth authorization-scheme autho local-user test password irreversible-cipher $1a$|^<)!}4$IN$9BrKBRY#L:pEc{P#HQ=OI#p["6tY%94gGg2#@FzP$ local-user test privilege level 3 local-user test service-type telnet # interface Vlanif11 ip address 192.168.2.29 255.255.255.0 # interface GigabitEthernet0/0/1 port link-type access port default vlan 10 authentication-profile p1 # interface GigabitEthernet0/0/2 port link-type access port default vlan 11 # user-interface vty 0 14 authentication-mode aaa protocol inbound telnet # dot1x-access-profile name d1 # return