配置MAC认证示例(AAA采用本地认证)
组网需求
如图2-56所示,某公司机要室内终端通过Switch接入公司内部网络。如果该公司内存在非法接入和非授权访问的状况,将会导致企业业务系统的破坏以及关键信息资产的泄露,因此管理员希望Switch能够对用户的网络访问权限进行控制,以保证公司内网的安全。
由于机要室内的哑终端(例如打印机)无法安装认证客户端,在Switch上部署MAC认证,并通过本地认证方式对用户身份进行认证
操作步骤
- 配置网络互连互通。
# 创建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本地认证。
# 配置认证方案“a1”为本地认证。
[Switch] aaa [Switch-aaa] authentication-scheme a1 [Switch-aaa-authen-a1] authentication-mode local [Switch-aaa-authen-a1] quit
# 配置授权方案“b1”为本地授权。
[Switch-aaa] authorization-scheme b1 [Switch-aaa-author-b1] authorization-mode local [Switch-aaa-author-b1] quit
# 配置本地用户的用户名、密码和用户接入类型。
将终端的MAC地址配置为本地用户名,密码配置为Example@123,接入类型为MAC认证(8021x)。以下以打印机1为例(MAC地址为00e0-fc12-3456)。
[Switch-aaa] local-user 00e0-fc12-3456 password cipher Example@123 [Switch-aaa] local-user 00e0-fc12-3456 service-type 8021x [Switch-aaa] quit
# 配置业务方案“s1”。通过业务方案“s1”为用户授权,实现用户认证成功后能够访问192.168.2.0网段的资源。
[Switch] ucl-group 10 name g1 [Switch] acl 6000 [Switch-acl-ucl-6000] rule 10 permit ip source ucl-group name g1 destination 192.168.2.0 0 [Switch-acl-ucl-6000] rule 15 deny ip [Switch-acl-ucl-6000] quit [Switch] traffic-filter inbound acl 6000 [Switch] aaa [Switch-aaa] service-scheme s1 [Switch-aaa-service-s1] ucl-group name g1 [Switch-aaa-service-s1] quit
# 配置域“example.com”,并在域下应用认证方案“a1”、授权方案“b1”和业务方案“s1”。
[Switch-aaa] domain example.com [Switch-aaa-domain-example.com] authentication-scheme a1 [Switch-aaa-domain-example.com] authorization-scheme b1 [Switch-aaa-domain-example.com] service-scheme s1 [Switch-aaa-domain-example.com] quit [Switch-aaa] quit
- 配置MAC认证。# 将NAC配置模式切换成统一模式。
[Switch] authentication unified-mode
- 缺省情况下,NAC配置模式即为统一模式。
- 传统模式切换到统一模式后,管理员必须保存配置并重启设备,新配置模式的各项功能才能生效。
# 配置MAC接入模板“m1”。
当采用AAA本地方式认证和授权时,MAC认证用户的用户名和密码必须与AAA本地用户的用户名和密码保持一致。本举例中本地用户的用户名为终端的MAC地址(带分隔符-的),密码为Example@123。
[Switch] mac-access-profile name m1 [Switch-mac-access-profile-m1] mac-authen username macaddress format with-hyphen password cipher Example@123 [Switch-mac-access-profile-m1] quit
# 配置认证模板“p1”,并在其上绑定MAC接入模板“m1”、指定认证模板下用户的强制认证域为“example.com”。
[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] 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认证用户信息。