华为交换机配置802.1X认证
1.802.1X是做什么的?
在中型及以上的项目实施中,802.1X是必备的一项配置,简单来说就是检测网络用户的身份,以保证敏感信息的安全性。
在这一验证过程中有以下三种角色:
- Supplicant(请求者):这是尝试访问受保护网络资源的客户端设备。
- Authenticator(认证器):通常是交换机或无线接入点(AP),它充当守门员的角色,只允许经过身份验证的设备访问网络。
- Authentication Server(认证服务器):通常是一个RADIUS(Remote Authentication Dial-In User Service)服务器,负责处理来自认证器的身份验证请求,并决定是否授予访问权限。
2.如何配置802.1X?
一般我们将802.1X配置在接入层或者汇聚层,以下就是配置命令,另外告诉大家一件事,其实在很多项目中使用这一默认配置就可以了,最多根据要求做一点更改,例如最大在线人数等等。
(1)第一种————在接入层配置

1.配置AAA。
# 创建并配置RADIUS服务器模板“rd1”。
[Switch] radius-server template rd1
[Switch-radius-rd1] radius-server authentication 192.168.1.30 1812
[Switch-radius-rd1] radius-server shared-key cipher YsHsjx_202206
[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,用户密码YsHsjx_2022061)
[Switch] test-aaa test YsHsjx_2022061 radius-template rd1
Info: Account test succeeded.
2.配置802.1X认证。
# 将NAC配置模式切换成统一模式。
# 注意:设备默认为统一模式。传统模式与统一模式相互切换后,设备会自动重启。
[Switch] authentication unified-mode
# 配置802.1X接入模板“d1”。
[Switch] dot1x-access-profile name d1
[Switch-dot1x-access-profile-d1] dot1x authentication-method eap
[Switch-dot1x-access-profile-d1] dot1x timer client-timeout 30
[Switch-dot1x-access-profile-d1] quit
# 注意:802.1X接入模板默认采用EAP中继认证方式。请确保RADIUS服务器支持EAP协议,否则无法处理802.1X认证请求。
# 配置认证模板“p1”,并在其上绑定802.1X接入模板“d1”、指定认证模板下用户的强制认证域为“example.com”。
[Switch] authentication-profile name p1
[Switch-authen-profile-p1] dot1x-access-profile d1
[Switch-authen-profile-p1] access-domain example.com force
[Switch-authen-profile-p1] quit
# 在接口GE1/0/2-GE1/0/n上绑定认证模板“p1”,使能802.1X认证。以接口GE1/0/2为例,其他接口配置与其类似。
[Switch] interface gigabitethernet 1/0/2
[Switch-GigabitEthernet1/0/2] authentication-profile p1
[Switch-GigabitEthernet1/0/2] quit
3.验证配置结果。
用户在终端上启动802.1X客户端,输入用户名和密码,开始认证。
如果用户输入的用户名和密码验证正确,客户端页面会显示认证成功信息。用户即可访问网络。
用户上线后,管理员可在设备上执行命令display access-user access-type dot1x查看在线802.1X用户信息。
(2)第二种————在汇聚层配置

1.配置SwitchB。
# 配置802.1X报文透传功能。
# 下行接口(与用户连接的口GE0/0/2-GE0/0/n)以接口GE0/0/2为例,其他下行接口配置与其类似。(这些连接口下的用户都会触发认证)
由于认证交换机SwitchA与用户之间存在二层交换机SwitchB,为保证用户能够通过802.1X认证,则务必在SwitchB上配置802.1X报文透传功能。
[SwitchB] l2protocol-tunnel user-defined-protocol 802.1X protocol-mac 0180-c200-0003 group-mac 0100-0000-0002
[SwitchB] interface gigabitethernet 0/0/2
[SwitchB-GigabitEthernet0/0/2] l2protocol-tunnel user-defined-protocol 802.1X enable
[SwitchB-GigabitEthernet0/0/2] quit
[SwitchB] interface gigabitethernet 0/0/1
[SwitchB-GigabitEthernet0/0/1] l2protocol-tunnel user-defined-protocol 802.1X enable
[SwitchB-GigabitEthernet0/0/1] quit
2.配置SwitchA。
# 配置AAA。
# (1)创建并配置RADIUS服务器模板“rd1”。
[SwitchA] radius-server template rd1
[SwitchA-radius-rd1] radius-server authentication 192.168.1.30 1812
[SwitchA-radius-rd1] radius-server shared-key cipher YsHsjx_202206
[SwitchA-radius-rd1] quit
# (2)创建AAA认证方案“abc”并配置认证方式为RADIUS。
[SwitchA] aaa
[SwitchA-aaa] authentication-scheme abc
[SwitchA-aaa-authen-abc] authentication-mode radius
[SwitchA-aaa-authen-abc] quit
# (3)创建认证域“example.com”,并在其上绑定AAA认证方案“abc”与RADIUS服务器模板“rd1”。
[SwitchA-aaa] domain example.com
[SwitchA-aaa-domain-example.com] authentication-scheme abc
[SwitchA-aaa-domain-example.com] radius-server rd1
[SwitchA-aaa-domain-example.com] quit
[SwitchA-aaa] quit
# (4)测试用户是否能够通过RADIUS模板的认证。(已在RADIUS服务器上配置了测试用户test,用户密码YsHsjx_2022061)
[SwitchA] test-aaa test YsHsjx_2022061 radius-template rd1
Info: Account test succeeded.
# 配置802.1X认证。
# (1) 将NAC配置模式切换成统一模式。
# 注意:设备默认为统一模式。传统模式与统一模式相互切换后,设备会自动重启。
[SwitchA] authentication unified-mode
# (2) 配置802.1X接入模板“d1”。
# 注意:802.1X接入模板默认采用EAP认证方式。请确保RADIUS服务器支持EAP协议,否则无法处理802.1X认证请求。
[SwitchA] dot1x-access-profile name d1
[SwitchA-dot1x-access-profile-d1] dot1x authentication-method eap
[SwitchA-dot1x-access-profile-d1] dot1x timer client-timeout 30
[SwitchA-dot1x-access-profile-d1] quit
# (3) 配置认证模板“p1”,并在其上绑定802.1X接入模板“d1”、指定认证模板下用户的强制认证域为“example.com”、指定用户接入模式为多用户单独认证接入模式、最大接入用户数为100。
[SwitchA] authentication-profile name p1
[SwitchA-authen-profile-p1] dot1x-access-profile d1
[SwitchA-authen-profile-p1] access-domain example.com force
[SwitchA-authen-profile-p1] authentication mode multi-authen max-user 100
[SwitchA-authen-profile-p1] quit
# (4) 在接口GE1/0/2上绑定认证模板“p1”,使能802.1X认证。
[SwitchA] interface gigabitethernet 1/0/2
[SwitchA-GigabitEthernet1/0/2] authentication-profile p1
[SwitchA-GigabitEthernet1/0/2] quit
验证配置结果。
用户在终端上启动802.1X客户端,输入用户名和密码,开始认证。
如果用户输入的用户名和密码验证正确,客户端页面会显示认证成功信息。用户即可访问网络。
用户上线后,管理员可在设备上执行命令display access-user 查看用户在线情况
3.其他查看用户在线情况命令:
# 查看指定接口上的802.1X统计信息
display dot1x statistics interface interface-type interface-number
# 查看某接口的在线用户情况
display access-user [interface interface-type interface-number]
4.最后
注意配置的交换机型号与类型,如果是CE交换机,配置命令会有不同,请转至
华为官网文档:https://support.huawei.com/enterprise/zh/doc/index.html
查看参考。

346

被折叠的 条评论
为什么被折叠?



