配置策略联动示例
组网需求
在大型园区网中,接入层设备众多导致部署用户访问控制策略时工作量巨大且策略调整不灵活。因此,客户希望可以在认证网关上集中部署NAC认证和配置用户的访问策略,而在认证接入设备上执行用户的访问策略,以简化接入层设备部署。如图4-4所示,网关设备Switch作为认证控制设备,Switch_1~Switch_N作为认证接入设备,在认证控制设备上对用户进行认证并在认证接入设备中执行用户访问策略。本举例中,VLAN10为用户VLAN,VLAN20为CAPWAP隧道的管理VLAN;用户的接入认证方式以802.1X认证为例。
配置思路
采用如下思路进行配置:
- 配置建立认证控制设备和认证接入设备之间的CAPWAP隧道。
- 在认证控制设备上创建并配置RADIUS服务器模板、AAA方案以及认证域,通过RADIUS服务器对接入用户进行身份认证。
- 在认证控制设备和所有认证接入设备上配置策略联动功能。
- 在认证控制设备和所有认证接入设备上配置802.1X认证功能,以实现对员工的网络访问权限进行控制,保证只有认证通过的用户才能接入网络。
配置本举例之前,需确保网络中各设备之间已能互通。
本举例只包括认证接入设备和认证控制设备上的配置,RADIUS服务器的配置这里不做相关说明。
本举例以在认证接入设备Switch_1上进行配置为例说明,其他认证接入设备上的配置相同,本文不再赘述。
操作步骤
- 将NAC配置模式切换成统一模式# 在Switch_1上将NAC配置模式切换成统一模式。
<HUAWEI> system-view [HUAWEI] sysname Switch_1 [Switch_1] authentication unified-mode
# 在Switch上将NAC配置模式切换成统一模式。<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] authentication unified-mode
设备默认为NAC统一模式。从传统模式切换至统一模式时,必须根据提示输入y立即重启设备,才能成功切换NAC模式。
- 创建VLAN并配置接口允许通过的VLAN
# 在Switch_1上创建VLAN10、VLAN20。
[Switch_1] vlan batch 10 20
# 在Switch_1上配置与用户连接的接口GE0/0/2为Access类型接口,并将其加入VLAN10。
[Switch_1] interface gigabitethernet 0/0/2 [Switch_1-GigabitEthernet0/0/2] port link-type access [Switch_1-GigabitEthernet0/0/2] port default vlan 10 [Switch_1-GigabitEthernet0/0/2] quit
# 在Switch_1上配置与Switch连接的接口GE0/0/1为Trunk类型接口,允许VLAN10和VLAN20通过。
[Switch_1] interface gigabitethernet 0/0/1 [Switch_1-GigabitEthernet0/0/1] port link-type trunk [Switch_1-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 20 [Switch_1-GigabitEthernet0/0/1] quit
# 在Switch上创建VLAN10、VLAN20和VLAN30。
[Switch] vlan batch 10 20 30
# 在Switch上配置与Switch_1连接的接口GE0/0/1为Trunk类型接口,允许VLAN10和VLAN20通过。
[Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] port link-type trunk [Switch-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 20 [Switch-GigabitEthernet0/0/1] quit
# 在Switch上配置连接RADIUS服务器的接口GE0/0/2为Access类型接口,并将其加入VLAN30。
[Switch] interface gigabitethernet 0/0/2 [Switch-GigabitEthernet0/0/2] port link-type access [Switch-GigabitEthernet0/0/2] port default vlan 30 [Switch-GigabitEthernet0/0/2] quit [Switch] interface vlanif 30 [Switch-Vlanif30] ip address 192.168.4.1 255.255.255.0 [Switch-Vlanif30] quit
- 在认证控制设备上配置接口地址池VLANIF10为用户分配IP地址。
[Switch] dhcp enable [Switch] interface vlanif 10 [Switch-Vlanif10] ip address 192.168.2.1 255.255.255.0 [Switch-Vlanif10] dhcp select interface [Switch-Vlanif10] quit
- 在认证接入设备和认证控制设备上建立CAPWAP隧道
# 在Switch_1上创建VLANIF20,其IP地址通过DHCP方式获取,并设置VLANIF20为CAPWAP隧道的接入接口。
[Switch_1] interface vlanif 20 [Switch_1-Vlanif20] ip address dhcp-alloc [Switch_1-Vlanif20] quit [Switch_1] as access interface vlanif 20
# 在Switch上创建VLANIF20,并配置其作为接口地址池以及CAPWAP隧道的源接口。
[Switch] interface vlanif 20 [Switch-Vlanif20] ip address 192.168.3.1 255.255.255.0 [Switch-Vlanif20] dhcp select interface [Switch-Vlanif20] dhcp server option 43 ip-address 192.168.3.1 [Switch-Vlanif20] quit [Switch] capwap source interface vlanif 20 [Switch] as-auth [Switch-as-auth] auth-mode none [Switch-as-auth] quit
- 在认证控制设备Switch上创建并配置RADIUS服务器模板、AAA认证方案以及认证域。
# 创建并配置RADIUS服务器模板“rd1”。
[Switch] radius-server template rd1 [Switch-radius-rd1] radius-server authentication 192.168.4.30 1812 [Switch-radius-rd1] radius-server shared-key cipher Example@2012 [Switch-radius-rd1] radius-server retransmit 2 [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”。
[Switch] domain isp1
用户进行接入认证时,以格式“user@isp1”输入用户名即可在isp1域下进行aaa认证。如果用户名中不携带域名或携带的域名不存在,用户将会在默认域中进行认证。
- 在认证接入设备和认证控制设备上配置策略联动功能
# 在Switch_1上配置接口GE0/0/2作为接入点。
[Switch_1] interface gigabitethernet 0/0/2 [Switch_1-GigabitEthernet0/0/2] authentication access-point [Switch_1-GigabitEthernet0/0/2] quit
# 在Switch上配置接口GE0/0/1作为控制点。
[Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] authentication control-point [Switch-GigabitEthernet0/0/1] quit
# 在Switch上配置下发授权信息ACL到Switch_1,并在认证域“isp1”上绑定AAA业务方案“asd”。
[Switch] aaa [Switch-aaa] service-scheme asd [Switch-aaa-service-asd] remote-authorize acl [Switch-aaa-service-asd] quit [Switch-aaa] domain isp1 [Switch-aaa-domain-isp1] service-scheme asd [Switch-aaa-domain-isp1] quit [Switch-aaa] quit
# 在Switch_1上配置授权使用的ACL及规则。
[Switch_1] acl 3001 [Switch_1-acl-adv-3001] rule deny ip destination 192.168.5.0 0.0.0.255 [Switch_1-acl-adv-3001] quit
# 在Switch上配置授权使用的ACL及规则。
[Switch] acl 3001 [Switch-acl-adv-3001] rule deny ip destination 192.168.5.0 0.0.0.255 [Switch-acl-adv-3001] quit
Switch_1和Switch配置的授权使用的ACL编号需要与RADIUS服务器下发给用户的一致。
- 在认证接入设备和认证控制设备上配置802.1X认证
# 在Switch_1上的接口GE0/0/2上使能802.1X认证。
[Switch_1] dot1x-access-profile name d1 [Switch_1-dot1x-access-profile-d1] quit [Switch_1] authentication-profile name p1 [Switch_1-authen-profile-p1] dot1x-access-profile d1 [Switch_1-authen-profile-p1] quit [Switch_1] interface gigabitethernet 0/0/2 [Switch_1-GigabitEthernet0/0/2] authentication-profile p1 [Switch_1-GigabitEthernet0/0/2] quit
# 在Switch上的接口GE0/0/1上使能802.1X认证,并配置免认证规则放行CAPWAP隧道管理VLAN的报文。
[Switch] dot1x-access-profile name d1 [Switch-dot1x-access-profile-d1] quit [Switch] free-rule-template name default_free_rule [Switch-free-rule-default_free_rule] free-rule 1 source vlan 20 [Switch-free-rule-default_free_rule] quit [Switch] authentication-profile name p1 [Switch-authen-profile-p1] dot1x-access-profile d1 [Switch-authen-profile-p1] quit [Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] authentication-profile p1 [Switch-GigabitEthernet0/0/1] quit
- 验证配置结果
- 在认证接入设备和认证控制设备执行命令display dot1x查看802.1X认证的各项配置信息。从显示信息中能够看到认证接入设备Switch_1的接口GE0/0/2和认证控制设备Switch的接口GE0/0/1下已使能802.1X认证(802.1x protocol is Enabled);在认证控制设备Switch执行命令display as all查看认证控制设备与认证接入设备连接的状态。
- 用户在终端上启动802.1X客户端,输入用户名和密码,开始认证。如果用户输入的用户名和密码验证正确,客户端页面会显示认证成功信息,用户即可访问网络。
配置文件
Switch_1的配置文件
# sysname Switch_1 # vlan batch 10 20 # authentication-profile name p1 dot1x-access-profile d1 # as access interface vlanif 20 # acl number 3001 rule 5 deny ip destination 192.168.5.0 0.0.0.255 # interface Vlanif20 ip address dhcp-alloc # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 10 20 # interface GigabitEthernet0/0/2 port link-type access port default vlan 10 authentication-profile p1 authentication access-point # dot1x-access-profile name d1 # return
Switch的配置文件
# sysname Switch # vlan batch 10 20 30 # authentication-profile name p1 dot1x-access-profile d1 # domain isp1 # dhcp enable # radius-server template rd1 radius-server shared-key cipher %^%#4*SO-2u,Q.\1C~%[eiB77N/^2wME;6t%6U@qAJ9:%^%# radius-server authentication 192.168.4.30 1812 weight 80 radius-server retransmit 2 # acl number 3001 rule 5 deny ip destination 192.168.5.0 0.0.0.255 # free-rule-template name default_free_rule free-rule 1 source vlan 20 # aaa authentication-scheme abc authentication-mode radius service-scheme asd remote-authorize acl domain isp1 authentication-scheme abc service-scheme asd radius-server rd1 # interface Vlanif10 ip address 192.168.2.1 255.255.255.0 dhcp select interface # interface Vlanif20 ip address 192.168.3.1 255.255.255.0 dhcp select interface dhcp server option 43 ip-address 192.168.3.1 # interface Vlanif30 ip address 192.168.4.1 255.255.255.0 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 10 20 authentication-profile p1 authentication control-point # interface GigabitEthernet0/0/2 port link-type access port default vlan 30 # capwap source interface vlanif20 # as-auth auth-mode none # dot1x-access-profile name d1 # return