配置802.1X认证示例(认证点部署在汇聚交换机)
组网需求
如图2-59所示,某公司办公区内终端通过SwitchB上的接口GE0/0/2–GE0/0/n接入公司内部网络。SwitchB作为接入交换机通过接口GE0/0/1与汇聚交换机SwitchA上的接口GE0/0/2相连。
为了满足企业的高安全性需求,使用802.1X认证并通过RADIUS服务器对办公区内终端进行认证,并且为便于维护、减少认证点数量,将认证点部署在汇聚交换机SwitchA的接口GE0/0/2上。
操作步骤
- 配置SwitchB。# 配置802.1X报文透传功能。下行接口(与用户连接的口GE0/0/2–GE0/0/n)以接口GE0/0/2为例,其他下行接口配置与其类似。
由于认证交换机SwitchA与用户之间存在二层交换机SwitchB,为保证用户能够通过802.1X认证,则务必在SwitchB上配置802.1X报文透传功能。本例的接入交换机以S5720-LI为例。
[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] bpdu 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] bpdu enable [SwitchB-GigabitEthernet0/0/1] quit
- 配置SwitchA。# 配置AAA。
创建并配置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 Example@2012 [SwitchA-radius-rd1] quit
创建AAA认证方案“abc”并配置认证方式为RADIUS。
[SwitchA] aaa [SwitchA-aaa] authentication-scheme abc [SwitchA-aaa-authen-abc] authentication-mode radius [SwitchA-aaa-authen-abc] quit
创建认证域“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
测试用户是否能够通过RADIUS模板的认证。(已在RADIUS服务器上配置了测试用户test,用户密码Example2012)
[SwitchA] test-aaa test Example2012 radius-template rd1 Info: Account test succeeded.
# 配置802.1X认证。- 将NAC配置模式切换成统一模式。
设备默认为统一模式。传统模式与统一模式相互切换后,设备会自动重启。
[SwitchA] authentication unified-mode
- 配置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
配置认证模板“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
# 在接口GE0/0/2上绑定认证模板“p1”,使能802.1X认证。
[SwitchA] interface gigabitethernet 0/0/2 [SwitchA-GigabitEthernet0/0/2] authentication-profile p1 [SwitchA-GigabitEthernet0/0/2] quit
- 验证配置结果。
- 用户在终端上启动802.1X客户端,输入用户名和密码,开始认证。
- 如果用户输入的用户名和密码验证正确,客户端页面会显示认证成功信息。用户即可访问网络。
- 用户上线后,管理员可在设备上执行命令display access-user access-type dot1x查看在线802.1X用户信息。