配置通过MAC认证控制哑终端访问网络示例
组网需求
如图3-17所示,某公司内部大量打印机通过Switch(作为接入设备)的接口GE0/0/1接入网络。在该网络运行一段时间后,为增强网络的安全性,管理员需对打印机的网络访问权限进行控制。只有打印机通过认证后,Switch才允许其访问网络中的资源。
配置思路
由于打印机无法安装和使用802.1X客户端,为实现对其网络访问权限进行限制的需求,管理员可在Switch上配置MAC认证功能。
具体配置思路如下(均在Switch上进行配置):
创建并配置RADIUS服务器模板、AAA方案以及认证域,并在ISP域下绑定RADIUS服务器模板与AAA方案。保证了Switch与RADIUS服务器之间的信息交互。
- 使能MAC认证,以实现对机要室内大量哑终端的网络访问权限进行控制。
配置本举例之前,需确保网络中各设备之间已能互通。
操作步骤
- 创建并配置RADIUS服务器模板、AAA认证方案以及认证域。
# 创建并配置RADIUS服务器模板“rd1”。
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] radius-server template rd1 [Switch-radius-rd1] radius-server authentication 192.168.2.30 1812 [Switch-radius-rd1] radius-server shared-key cipher Example@2012 [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
# 创建认证域“isp1”,并在其上绑定AAA认证方案“abc”与RADIUS服务器模板“rd1”。
[Switch-aaa] domain isp1 [Switch-aaa-domain-isp1] authentication-scheme abc [Switch-aaa-domain-isp1] radius-server rd1 [Switch-aaa-domain-isp1] quit [Switch-aaa] quit
# 配置全局默认域为“isp1”。用户进行接入认证时,以格式“user@isp1”输入用户名即可在isp1域下进行aaa认证。如果用户名中不携带域名或携带的域名不存在,用户将会在默认域中进行认证。
[Switch] domain isp1
# 测试用户是否能够通过RADIUS模板的认证。(已在RADIUS服务器上配置了测试用户test@example.com,用户密码Example2012)
[Switch] test-aaa test@example.com Example2012 radius-template rd1 Info: Account test succeeded.
- 配置MAC认证。
# 将NAC配置模式切换成传统模式。
[Switch] undo authentication unified-mode Warning: Switching the authentication mode will take effect after system restart . Some configurations are invalid after the mode is switched. For the invalid co mmands, see the user manual. Save the configuration file and reboot now? [Y/N] y
- 缺省情况下,NAC配置模式为统一模式。
- 统一模式切换到传统模式后,管理员必须保存配置并重启设备,新配置模式的各项功能才能生效。
# 在全局和接口下使能MAC认证。
<Switch> system-view [Switch] mac-authen [Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] mac-authen [Switch-GigabitEthernet0/0/1] quit
- 验证配置结果。
- 执行命令display mac-authen查看MAC认证的各项配置信息。从显示信息中能够看到接口GE0/0/1下已使能MAC认证(MAC address authentication is enabled)。
- 用户启动终端后,设备会自动获取用户终端的MAC地址作为用户名和密码进行认证。
- 终端认证成功后即可访问网络。
- 终端上线后,管理员可在设备上执行命令display access-user查看在线MAC认证用户信息。
配置文件
Switch的配置文件
# sysname Switch # undo authentication unified-mode # domain isp1 # mac-authen # radius-server template rd1 radius-server shared-key cipher %^%#t67cDelRvAQg;*"4@P/3~q_31Sn{ST\V8'Ci633)%^%# radius-server authentication 192.168.2.30 1812 weight 80 # aaa authentication-scheme abc authentication-mode radius domain isp1 authentication-scheme abc radius-server rd1 # interface GigabitEthernet0/0/12/0/0 mac-authen # return