配置主备RADIUS服务器示例
组网需求
如图1-33所示,用户同处于huawei域,Switch作为目的网络接入服务器。用户需要通过服务器的远端认证才能通过Switch访问目的网络。在Switch上的远端认证方式如下:
Switch对接入用户先用RADIUS服务器进行认证,如果认证没有响应,再使用本地认证。
RADIUS服务器10.7.66.66/24作为主用认证服务器和计费服务器,RADIUS服务器10.7.66.67/24作为备用认证服务器和计费服务器,认证端口号缺省为1812,计费端口号缺省为1813。
配置思路
用如下的思路配置采用RADIUS协议对用户进行认证和计费。
- 配置RADIUS服务器模板。
- 配置认证方案、计费方案。
- 在域下应用RADIUS服务器模板、认证方案和计费方案。
- 配置前请确保各设备之间路由可达。
请确保RADIUS服务器模板内的共享密钥和RADIUS服务器上的配置保持一致。
如果RADIUS服务器不接受包含域名的用户名,可以在RADIUS服务器模板视图下,配置命令undo radius-server user-name domain-included使设备向RADIUS服务器发送的报文中的用户名不包含域名。
- 域被配置成全局默认域之后,用户的用户名中携带该域名或者不携带域名时,会使用全局默认域下的AAA配置信息。
- 配置命令undo radius-server user-name domain-included后,设备仅会修改发送报文中的用户名格式,不会影响用户所属的域。例如,配置该命令后,用户名为“user@huawei.com”的用户仍使用huawei.com域下的AAA配置信息。
操作步骤
- 配置RADIUS服务器模板。
# 配置RADIUS服务器模板shiva。
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] radius-server template shiva
# 配置RADIUS主用认证服务器和计费服务器的IP地址、端口。
[Switch-radius-shiva] radius-server authentication 10.7.66.66 1812 weight 80 [Switch-radius-shiva] radius-server accounting 10.7.66.66 1813 weight 80
# 配置RADIUS备用认证服务器和计费服务器的IP地址、端口。
[Switch-radius-shiva] radius-server authentication 10.7.66.67 1812 weight 40 [Switch-radius-shiva] radius-server accounting 10.7.66.67 1813 weight 40
# 配置RADIUS服务器密钥、重传次数,以及设备向RADIUS服务器发送的报文中的用户名不包含域名。
[Switch-radius-shiva] radius-server shared-key cipher Example@2012 [Switch-radius-shiva] radius-server retransmit 2 [Switch-radius-shiva] undo radius-server user-name domain-included [Switch-radius-shiva] quit
- 配置认证方案、计费方案。
# 配置认证方案auth,认证模式为先进行RADIUS认证,后进行本地认证。
[Switch] aaa [Switch-aaa] authentication-scheme auth [Switch-aaa-authen-auth] authentication-mode radius local [Switch-aaa-authen-auth] quit
# 配置计费方案abc,计费模式为RADIUS,并配置当开始计费失败时,允许用户上线。
[Switch-aaa] accounting-scheme abc [Switch-aaa-accounting-abc] accounting-mode radius [Switch-aaa-accounting-abc] accounting start-fail online [Switch-aaa-accounting-abc] quit
- 配置huawei域,在域下应用认证方案auth、计费方案abc、RADIUS服务器模板shiva。
[Switch-aaa] domain huawei [Switch-aaa-domain-huawei] authentication-scheme auth [Switch-aaa-domain-huawei] accounting-scheme abc [Switch-aaa-domain-huawei] radius-server shiva [Switch-aaa-domain-huawei] quit [Switch-aaa] quit
- 配置huawei域为全局默认域。
[Switch] domain huawei [Switch] domain huawei admin
- 配置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上执行命令display radius-server configuration template template-name,可以观察到该RADIUS服务器模板的配置与要求一致。
[Switch] display radius-server configuration template shiva ------------------------------------------------------------------------------ Server-template-name : shiva Protocol-version : standard Traffic-unit : B Shared-secret-key : ****** Group-filter : class Timeout-interval(in second) : 5 Retransmission : 2 EndPacketSendTime : 0 Dead time(in minute) : 5 Domain-included : NO NAS-IP-Address : 0.0.0.0 Calling-station-id MAC-format : xxxx-xxxx-xxxx Called-station-id MAC-format : XX-XX-XX-XX-XX-XX NAS-Port-ID format : New Service-type : - NAS-IPv6-Address : :: Detect-interval(in second) : 60 Authentication Server 1 : 10.7.66.66 Port:1812 Weight:80 [UP] Vrf:- LoopBack:NULL Vlanif:NULL Source IP: :: Authentication Server 2 : 10.7.66.67 Port:1812 Weight:40 [UP] Vrf:- LoopBack:NULL Vlanif:NULL Source IP: :: Accounting Server 1 : 10.7.66.66 Port:1813 Weight:80 [UP] Vrf:- LoopBack:NULL Vlanif:NULL Source IP: :: Accounting Server 2 : 10.7.66.67 Port:1813 Weight:40 [UP] Vrf:- LoopBack:NULL Vlanif:NULL Source IP: :: ------------------------------------------------------------------------------
配置文件
Switch的配置文件
# sysname Switch # domain huawei domain huawei admin # radius-server template shiva radius-server shared-key cipher %^%#HN!rP_Lc1<+L+H/&YUzN]CBy;_09Z>9T5\.k{T1/%^%# radius-server authentication 10.7.66.66 1812 weight 80 radius-server authentication 10.7.66.67 1812 weight 40 radius-server accounting 10.7.66.66 1813 weight 80 radius-server accounting 10.7.66.67 1813 weight 40 radius-server retransmit 2 undo radius-server user-name domain-included # aaa authentication-scheme auth authentication-mode radius local accounting-scheme abc accounting-mode radius accounting start-fail online domain huawei authentication-scheme auth accounting-scheme abc radius-server shiva 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