配置通过802.1x认证控制企业内网用户访问网络示例
组网需求
如图3-16所示,某公司内部大量用户终端通过Switch(作为接入设备)的接口GE0/0/1接入网络。在该网络运行一段时间后,发现存在用户对公司内网进行攻击。为确保网络的安全性,管理员需对用户终端的网络访问权限进行控制,只有用户终端通过认证后,Switch才允许其访问Internet中的资源。
配置思路
为实现对用户网络访问权限进行限制的需求,在将IP地址为192.168.2.30的服务器用作RADIUS服务器后,管理员可在Switch上配置802.1x认证功能。
具体配置思路如下:
- 在Switch上创建并配置RADIUS服务器模板、AAA方案以及认证域,并在ISP域下绑定RADIUS服务器模板与AAA方案。保证了Switch与RADIUS服务器之间的信息交互。
- 在Switch上配置802.1x认证。
- 使能全局与接口的802.1x认证功能。
- 使能MAC旁路认证功能,保证了无法安装和使用802.1x认证的终端(如打印机)能够通过认证。
配置本举例之前,需确保网络中各设备之间已能互通。
- 在LAN Switch系统视图下执行命令l2protocol-tunnel user-defined-protocol 802.1x protocol-mac 0180-c200-0003 group-mac 0100-0000-0002定义二层透明传输EAP报文。
- 在LAN Switch的下行与用户连接的接口以及上行与Switch连接的接口上执行命令l2protocol-tunnel user-defined-protocol 802.1x enable和bpdu enable以使能接口的二层协议透明传输功能。
本举例只包括Switch上的配置,LAN Switch和RADIUS服务器的配置这里不做相关说明。
操作步骤
- 创建VLAN并配置接口允许通过的VLAN,保证网络通畅。
# 创建VLAN10和VLAN20。
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] vlan batch 10 20
# 配置Switch与用户连接的接口GE0/0/1为Access类型接口,并将GE0/0/1加入VLAN10。
[Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] port link-type access [Switch-GigabitEthernet0/0/1] port default vlan 10 [Switch-GigabitEthernet0/0/1] quit
设备与用户连接的接口类型与接口加入的VLAN应以用户实际所属VLAN为准,此处假设所有的用户都被划分到VLAN10。
# 配置Switch连接RADIUS服务器的接口GE0/0/2为Access类型接口,并将GE0/0/2加入VLAN20。
[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
- 创建并配置RADIUS服务器模板、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 Huawei@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@huawei.com,用户密码Huawei2012)
[Switch] test-aaa test@huawei.com Huawei2012 radius-template rd1 Info: Account test succeed.
- 在Switch上配置802.1x认证。
[Switch] undo authentication unified-mode [Switch] quit <Switch> reboot
# 在全局和接口下使能802.1x认证。
<Switch> system-view [Switch] dot1x enable [Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] dot1x enable
设备默认支持用户通过ARP报文触发802.1x认证,如果用户希望通过DHCP报文触发802.1x认证,可在系统视图下执行命令dot1x dhcp-trigger配置。
# 配置MAC旁路认证。
[Switch-GigabitEthernet0/0/1] dot1x mac-bypass
- 验证配置结果。
- 执行命令display dot1x查看802.1x认证的各项配置信息。从显示信息中能够看到接口GE0/0/1下已使能802.1x认证(802.1x protocol is Enabled)。
- 用户在终端上启动802.1x客户端,输入用户名和密码,开始认证。
- 如果用户输入的用户名和密码验证正确,客户端页面会显示认证成功信息。用户即可访问网络。
- 用户上线后,管理员可在设备上执行命令display access-user查看在线802.1x用户信息。
配置文件
Switch的配置文件
# sysname Switch # vlan batch 10 20 # undo authentication unified-mode # domain isp1 # dot1x enable # radius-server template rd1 radius-server shared-key cipher %@%@BS'$!w:u7H.lu:/&W9A5=pUt%@%@ 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/1 port link-type access port default vlan 10 dot1x mac-bypass # interface GigabitEthernet0/0/2 port link-type access port default vlan 20 # return