配置MAC认证示例(AAA采用RADIUS认证)
组网需求
如图2-55所示,某公司机要室内终端通过Switch接入公司内部网络。如果该公司内存在非法接入和非授权访问的状况,将会导致企业业务系统的破坏以及关键信息资产的泄露,因此管理员希望Switch能够对用户的网络访问权限进行控制,以保证公司内网的安全。
由于机要室内的哑终端(例如打印机)无法安装认证客户端,在Switch上部署MAC认证。终端设备的MAC地址将作为用户信息到RADIUS服务器进行认证,同时用户接入网络时,也不需要进行认证操作。
操作步骤
- 配置网络互连互通。
# 创建VLAN并配置接口允许通过的VLAN、IP地址。
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] vlan batch 10 20 [Switch] interface gigabitethernet 0/0/2 [Switch-GigabitEthernet0/0/2] port link-type access [Switch-GigabitEthernet0/0/2] port default vlan 20 [Switch-GigabitEthernet0/0/2] quit [Switch] interface vlanif 20 [Switch-Vlanif20] ip address 192.168.2.10 24 [Switch-Vlanif20] quit [Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] port link-type trunk [Switch-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 [Switch-GigabitEthernet0/0/1] quit [Switch] interface vlanif 10 [Switch-Vlanif10] ip address 192.168.1.10 24 [Switch-Vlanif10] quit
- 配置AAA。
# 创建并配置RADIUS服务器模板“rd1”。
[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
# 创建认证域“example.com”,并在其上绑定AAA认证方案“abc”与RADIUS服务器模板“rd1”。
[Switch-aaa] domain example.com [Switch-aaa-domain-example.com] authentication-scheme abc [Switch-aaa-domain-example.com] radius-server rd1 [Switch-aaa-domain-example.com] quit [Switch-aaa] quit
# 测试用户是否能够通过RADIUS模板的认证。(已在RADIUS服务器上配置了测试用户test,用户密码Example2012)
[Switch] test-aaa test Example2012 radius-template rd1 Info: Account test succeeded.
- 配置MAC认证。# 将NAC配置模式切换成统一模式。
设备默认为统一模式。传统模式与统一模式相互切换后,设备会自动重启。
[Switch] authentication unified-mode
# 配置MAC接入模板“m1”。
MAC接入模板中,MAC认证用户的用户名和密码默认均为不带分隔符“-”的MAC地址。需要保证RADIUS服务器上配置的MAC用户名和密码格式与接入设备上的保持一致。
[Switch] mac-access-profile name m1 [Switch-mac-access-profile-m1] quit
# 配置认证模板“p1”,并在其上绑定MAC接入模板“m1”、指定认证模板下用户的强制认证域为“example.com”、指定用户接入模式为多用户单独认证接入模式、最大接入用户数为100。
[Switch] authentication-profile name p1 [Switch-authen-profile-p1] mac-access-profile m1 [Switch-authen-profile-p1] access-domain example.com force [Switch-authen-profile-p1] authentication mode multi-authen max-user 100 [Switch-authen-profile-p1] quit
# 在接口GE0/0/1上绑定认证模板“p1”,使能MAC认证。
[Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] authentication-profile p1 [Switch-GigabitEthernet0/0/1] quit
- 验证配置结果。
- 用户启动终端后,设备会自动获取用户终端的MAC地址作为用户名和密码进行认证。
- 用户认证成功后即可访问网络。
- 用户上线后,管理员可在设备上执行命令display access-user access-type mac-authen查看在线MAC认证用户信息。