配置主备HWTACACS服务器示例
组网需求
如图1-34所示,用户要求:
- Switch对接入用户先用HWTACACS服务器进行认证,如果HWTACACS服务器Down或者无响应时,再使用本地认证。
- Switch对接入用户先用HWTACACS服务器进行授权,如果HWTACACS授权服务器连接失败的时候,设备无法完成HWTACACS授权,再使用本地授权。
- Switch对接入用户采用HWTACACS计费。
- 对用户进行实时计费,计费间隔为3分钟。
- HWTACACS主用服务器为10.7.66.66/24,备用服务器为10.7.66.67/24,服务器的认证、授权和计费端口号均为49。
配置思路
采用如下的思路配置对用户使用本地和HWTACACS认证、HWTACACS授权和进行实时计费。
- 配置HWTACACS服务器模板。
- 配置认证方案、授权方案、计费方案。
- 在域下应用HWTACACS服务器模板、认证方案、授权方案、计费方案。
- 配置前请确保各设备之间路由可达。
请确保HWTACACS服务器模板内的共享密钥与HWTACACS服务器上的配置保持一致。
如果HWTACACS服务器不接受包含域名的用户名,可以在HWTACACS服务器模板视图下,配置命令undo hwtacacs-server user-name domain-included使设备向HWTACACS服务器发送的报文中的用户名不包含域名。
- 域被配置成全局默认域之后,用户的用户名中携带该域名或者不携带域名时,会使用全局默认域下的AAA配置信息。
- 配置命令undo hwtacacs-server user-name domain-included后,设备仅会修改发送报文中的用户名格式,不会影响用户所属的域。例如,配置该命令后,用户名为“user@huawei.com”的用户仍使用huawei.com域下的AAA配置信息。
操作步骤
- 使能HWTACACS功能。
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] hwtacacs enable
- 配置HWTACACS服务器模板。
# 配置HWTACACS服务器模板ht。
[Switch] hwtacacs-server template ht
# 配置HWTACACS主用认证、授权、计费服务器的IP地址和端口。
[Switch-hwtacacs-ht] hwtacacs-server authentication 10.7.66.66 49 [Switch-hwtacacs-ht] hwtacacs-server authorization 10.7.66.66 49 [Switch-hwtacacs-ht] hwtacacs-server accounting 10.7.66.66 49
# 配置HWTACACS备用认证、授权、计费服务器的IP地址和端口。
[Switch-hwtacacs-ht] hwtacacs-server authentication 10.7.66.67 49 secondary [Switch-hwtacacs-ht] hwtacacs-server authorization 10.7.66.67 49 secondary [Switch-hwtacacs-ht] hwtacacs-server accounting 10.7.66.67 49 secondary
# 配置HWTACACS服务器密钥。
[Switch-hwtacacs-ht] hwtacacs-server shared-key cipher Example@2012 [Switch-hwtacacs-ht] quit
- 配置认证方案、授权方案、计费方案。
# 配置认证方案l-h,认证模式为先进行HWTACACS认证,后进行本地认证。
[Switch] aaa [Switch-aaa] authentication-scheme l-h [Switch-aaa-authen-l-h] authentication-mode hwtacacs local [Switch-aaa-authen-l-h] quit
# 配置授权方案hwtacacs,授权模式为先进行HWTACACS授权,后进行本地授权。
[Switch-aaa] authorization-scheme hwtacacs [Switch-aaa-author-hwtacacs] authorization-mode hwtacacs local [Switch-aaa-author-hwtacacs] quit
# 配置计费方案hwtacacs,计费模式为HWTACACS,并配置当开始计费失败时,允许用户上线。
[Switch-aaa] accounting-scheme hwtacacs [Switch-aaa-accounting-hwtacacs] accounting-mode hwtacacs [Switch-aaa-accounting-hwtacacs] accounting start-fail online
# 配置实时计费间隔为3分钟。
[Switch-aaa-accounting-hwtacacs] accounting realtime 3 [Switch-aaa-accounting-hwtacacs] quit
- 配置huawei域,在域下采用l-h认证方案、HWTACACS授权方案、HWTACACS计费方案、ht的HWTACACS模板。
[Switch-aaa] domain huawei [Switch-aaa-domain-huawei] authentication-scheme l-h [Switch-aaa-domain-huawei] authorization-scheme hwtacacs [Switch-aaa-domain-huawei] accounting-scheme hwtacacs [Switch-aaa-domain-huawei] hwtacacs-server ht [Switch-aaa-domain-huawei] quit [Switch-aaa] quit
- 配置AAA本地认证。
[Switch] aaa [Switch-aaa] local-user user1 password irreversible-cipher Example@123 [Switch-aaa] local-user user1 service-type http [Switch-aaa] local-user user1 privilege level 15 [Switch-aaa] quit
- 配置全局默认管理域。
[Switch] domain huawei admin
- 验证配置结果。
# 在Switch上执行命令display hwtacacs-server template,可以观察到该HWTACACS服务器模板的配置与要求一致。
[Switch] display hwtacacs-server template ht --------------------------------------------------------------------------- HWTACACS-server template name : ht Primary-authentication-server : 10.7.66.66:49 Vrf:- Status:UP Primary-authorization-server : 10.7.66.66:49 Vrf:- Status:UP Primary-accounting-server : 10.7.66.66:49 Vrf:- Status:UP Secondary-authentication-server : 10.7.66.67:49 Vrf:- Status:UP Secondary-authorization-server : 10.7.66.67:49 Vrf:- Status:UP Secondary-accounting-server : 10.7.66.67:49 Vrf:- Status:UP Third-authentication-server : -:0 Vrf:- Status:- Third-authorization-server : -:0 Vrf:- Status:- Third-accounting-server : -:0 Vrf:- Status:- Current-authentication-server : 10.7.66.66:49 Vrf:- Status:UP Current-authorization-server : 10.7.66.66:49 Vrf:- Status:UP Current-accounting-server : 10.7.66.66:49 Vrf:- Status:UP Source-IP-address : - Source-LoopBack : - Shared-key : **************** Quiet-interval(min) : 5 Response-timeout-Interval(sec) : 5 Domain-included : Original Traffic-unit : B ---------------------------------------------------------------------------
# 同时在Switch上执行命令display domain,可以观察到该域的配置与要求一致。
[Switch] display domain name huawei Domain-name : huawei Domain-state : Active Authentication-scheme-name : l-h Accounting-scheme-name : hwtacacs Authorization-scheme-name : hwtacacs Service-scheme-name : - RADIUS-server-template : default HWTACACS-server-template : ht User-group : - Push-url-address : -
配置文件
Switch的配置文件
# sysname Switch # domain huawei admin # hwtacacs-server template ht hwtacacs-server authentication 10.7.66.66 hwtacacs-server authentication 10.7.66.67 secondary hwtacacs-server authorization 10.7.66.66 hwtacacs-server authorization 10.7.66.67 secondary hwtacacs-server accounting 10.7.66.66 hwtacacs-server accounting 10.7.66.67 secondary hwtacacs-server shared-key cipher %^%#VznDEFI11##ZC>1@:=xUO^!OP~*<c1$FoD*zXPGJ%^%# # aaa authentication-scheme l-h authentication-mode hwtacacs local authorization-scheme hwtacacs authorization-mode hwtacacs local accounting-scheme hwtacacs accounting-mode hwtacacs accounting realtime 3 accounting start-fail online domain huawei authentication-scheme l-h accounting-scheme hwtacacs authorization-scheme hwtacacs hwtacacs-server ht local-user user1 password irreversible-cipher $1a$+:!j;\;$Z!$&%}p%ctzj"W`GM;APoC=XPLB=L-vJG3-'3Dhyci;$ local-user user1 privilege level 15 local-user user1 service-type http # return