配置L2 BNG场景下带双层VLAN的MAC认证示例(AAA采用RADIUS认证)
组网需求
如图2-57所示,居民区家庭用户通过交换机接入运营商网络。由于不同的家庭用户选择的运营商不同,同一家庭用户终端设备类型也不同,因此需要使用双层VLAN,内层VLAN区分不同的设备,外层VLAN区分不同的家庭用户,以便同一家庭用户的所有设备能接入其对应的运营商网络。
由于家庭用户中可能有设备无法安装认证客户端,因此在SwitchM上部署MAC认证,认证通过后接入对应的运营商网络。举例中的接入交换机SwitchB和SwitchC以S5720-LI为例。
配置思路
采用如下的思路在Switch上进行配置:
- 配置SwitchB和SwitchC,接入用户设备。
- 配置SwitchA,实现双层VLAN。
- 配置SwitchM,实现SwitchM通过RADIUS服务器对接入用户进行身份认证。
配置本举例之前,需确保用户接入终端与服务器之间已互通。
本举例只包括SwitchB、SwitchA和SwitchM上的配置,服务器的配置和用户侧配置这里不做相关说明。
操作步骤
- 配置SwitchB,SwitchC配置类似,这里不再赘述。
<HUAWEI> system-view [HUAWEI] sysname SwitchB [SwitchB] vlan batch 101 [SwitchB] interface gigabitethernet 0/0/1 [SwitchB-GigabitEthernet0/0/1] port link-type access [SwitchB-GigabitEthernet0/0/1] port default vlan 101 [SwitchB-GigabitEthernet0/0/1] quit [SwitchB] interface gigabitethernet 0/0/2 [SwitchB-GigabitEthernet0/0/2] port link-type trunk [SwitchB-GigabitEthernet0/0/2] port trunk allow-pass vlan 101 [SwitchB-GigabitEthernet0/0/2] quit
- 配置SwitchA。
# 创建VLAN,并配置SwitchA与SwitchB相连的接口GE0/0/1。
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vlan batch 3 101 [SwitchA] interface gigabitethernet 0/0/1 [SwitchA-GigabitEthernet0/0/1] port link-type hybrid [SwitchA-GigabitEthernet0/0/1] qinq vlan-translation enable [SwitchA-GigabitEthernet0/0/1] port hybrid tagged vlan 101 [SwitchA-GigabitEthernet0/0/1] port hybrid untagged vlan 3 [SwitchA-GigabitEthernet0/0/1] port vlan-stacking vlan 101 stack-vlan 3 [SwitchA-GigabitEthernet0/0/1] quit
# 配置用户以自定义的Option82用户名example和认证设备配置的密码进行认证。
[SwitchA] dhcp enable [SwitchA] dhcp snooping enable [SwitchA] interface gigabitethernet 0/0/1 [SwitchA-GigabitEthernet0/0/1] dhcp snooping enable [SwitchA-GigabitEthernet0/0/1] dhcp option82 rebuild enable [SwitchA-GigabitEthernet0/0/1] dhcp option82 circuit-id format user-defined "example" [SwitchA-GigabitEthernet0/0/1] quit
# 配置SwitchA与SwitchM相连的接口GE0/0/24。
[SwitchA] interface gigabitethernet 0/0/24 [SwitchA-GigabitEthernet0/0/24] port link-type trunk [SwitchA-GigabitEthernet0/0/24] undo port trunk allow-pass vlan 1 [SwitchA-GigabitEthernet0/0/24] port trunk allow-pass vlan 3 [SwitchA-GigabitEthernet0/0/24] dhcp snooping trusted [SwitchA-GigabitEthernet0/0/24] quit
- 配置SwitchM。
# 配置SwitchM与用户连接的接口GE0/0/1。
<HUAWEI> system-view [HUAWEI] sysname Switch [SwitchM] vlan batch 3 [SwitchM] interface gigabitethernet 0/0/1 [SwitchM-GigabitEthernet0/0/1] port link-type trunk [SwitchM-GigabitEthernet0/0/1] undo port trunk allow-pass vlan 1 [SwitchM-GigabitEthernet0/0/1] port trunk allow-pass vlan 3 [SwitchM-GigabitEthernet0/0/1] quit [SwitchM] interface vlanif 3 [SwitchM-Vlanif3] ip address 192.168.3.10 24 [SwitchM-Vlanif3] quit
# 配置SwitchM连接RADIUS服务器的接口GE0/0/2。
[SwitchM] vlan batch 20 [SwitchM] interface gigabitethernet 0/0/2 [SwitchM-GigabitEthernet0/0/2] port link-type access [SwitchM-GigabitEthernet0/0/2] port default vlan 20 [SwitchM-GigabitEthernet0/0/2] quit [SwitchM] interface vlanif 20 [SwitchM-Vlanif20] ip address 192.168.2.10 24 [SwitchM-Vlanif20] quit
# 配置SwitchM与DHCP服务器连接的接口GE0/0/3。
需要在RADIUS服务器设置(26-161)HW-Forwarding-VLAN属性为VLAN3000,即通过该属性下发用户报文转发的ISP VLAN为VLAN3000,并设置(26-162)HW-Forwarding-Interface属性为GE0/0/3,即通过该属性下发用户报文转发的出接口为GE0/0/3。
RADIUS服务器仅支持对通过S5720-HI、S5730-HI、S6720-HI、S5731-H-K、S5731-H、S5731S-H、S5731-S、S5731S-S、S5732-H、S5732-H-K、S6730-H、S6730-H-K、S6730S-H、S6730-S、S6730S-S认证上线的用户授权HW-Forwarding-VLAN和HW-Forwarding-Interface。如果对从其他设备认证上线的用户授权HW-Forwarding-VLAN和HW-Forwarding-Interface,会导致用户下线。
[SwitchM] vlan batch 3000 [SwitchM] interface gigabitethernet 0/0/3 [SwitchM-GigabitEthernet0/0/3] port link-type trunk [SwitchM-GigabitEthernet0/0/3] port trunk allow-pass vlan 3000 [SwitchM-GigabitEthernet0/0/3] quit
# 创建并配置RADIUS服务器模板“rd1”。
[SwitchM] radius-server template rd1 [SwitchM-radius-rd1] radius-server authentication 192.168.2.30 1812 [SwitchM-radius-rd1] radius-server shared-key cipher Example@2012 [SwitchM-radius-rd1] quit
# 创建AAA认证方案“abc”并配置认证方式为RADIUS。
[SwitchM] aaa [SwitchM-aaa] authentication-scheme abc [SwitchM-aaa-authen-abc] authentication-mode radius [SwitchM-aaa-authen-abc] quit
# 创建认证域“example.com”,并在其上绑定AAA认证方案“abc”与RADIUS服务器模板“rd1”。
[SwitchM-aaa] domain example.com [SwitchM-aaa-domain-example.com] authentication-scheme abc [SwitchM-aaa-domain-example.com] radius-server rd1 [SwitchM-aaa-domain-example.com] quit [SwitchM-aaa] quit
# 测试用户是否能够通过RADIUS模板的认证。(已在RADIUS服务器上配置了测试用户test,用户密码Example2012)
[SwitchM] test-aaa test Example2012 radius-template rd1 Info: Account test succeeded.
# 将NAC配置模式切换成统一模式。设备默认为统一模式。传统模式与统一模式相互切换后,设备会自动重启。
[Switch] authentication unified-mode
# 配置MAC接入模板“m1”,开启DHCP报文触发MAC认证时将Option82选项信息上送到认证服务器功能。
[SwitchM] mac-access-profile name m1 [SwitchM-mac-access-profile-m1] authentication trigger-condition dhcp [SwitchM-mac-access-profile-m1] authentication trigger-condition dhcp dhcp-option 82 [SwitchM-mac-access-profile-m1] mac-authen username dhcp-option 82 circuit-id password cipher example123 [SwitchM-mac-access-profile-m1] quit
# 配置认证模板“p1”,并在其上绑定MAC接入模板“m1”、指定认证模板下用户的强制认证域为“example.com”。
[SwitchM] authentication-profile name p1 [SwitchM-authen-profile-p1] mac-access-profile m1 [SwitchM-authen-profile-p1] access-domain example.com force [SwitchM-authen-profile-p1] quit
# 在接口GE0/0/1上绑定认证模板“p1”,使能MAC认证。
[SwitchM] interface gigabitethernet 0/0/1 [SwitchM-GigabitEthernet0/0/1] authentication-profile p1 [SwitchM-GigabitEthernet0/0/1] quit
- 验证配置结果。
- 用户启动终端后,设备会自动获取用户终端的Option82信息作为用户名进行认证。
- 用户上线后,管理员可在设备上执行命令display access-user access-type mac-authen查看在线MAC认证用户信息。
配置文件
# sysname SwitchB # vlan batch 101 # interface GigabitEthernet0/0/1 port link-type access port default vlan 101 # interface GigabitEthernet0/0/2 port link-type trunk port trunk allow-pass vlan 101 # return
# SwitchA的配置文件
# sysname SwitchA # vlan batch 3 101 # dhcp enable # dhcp snooping enable # interface GigabitEthernet0/0/1 port link-type hybrid qinq vlan-translation enable port hybrid tagged vlan 101 port hybrid untagged vlan 3 port vlan-stacking vlan 101 stack-vlan 3 dhcp snooping enable dhcp option82 rebuild enable dhcp option82 circuit-id format user-defined "example" # interface GigabitEthernet0/0/24 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 3 dhcp snooping trusted # return
# SwitchM的配置文件
# sysname SwitchM # vlan batch 3 20 3000 # authentication-profile name p1 mac-access-profile m1 access-domain example.com force # radius-server template rd1 radius-server shared-key cipher %^%#4*SO-2u,Q.\1C~%[eiB77N/^2wME;6t%6U@qAJ9:%^%# radius-server authentication 192.168.2.30 1812 weight 80 # aaa authentication-scheme abc authentication-mode radius domain example.com authentication-scheme abc radius-server rd1 # interface Vlanif3 ip address 192.168.3.10 255.255.255.0 # interface Vlanif20 ip address 192.168.2.10 255.255.255.0 # interface GigabitEthernet0/0/1 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 3 authentication-profile p1 # interface GigabitEthernet0/0/2 port link-type access port default vlan 20 # interface GigabitEthernet0/0/3 port link-type trunk port trunk allow-pass vlan 3000 # mac-access-profile name m1 authentication trigger-condition dhcp authentication trigger-condition dhcp dhcp-option 82 mac-authen username dhcp-option 82 circuit-id password cipher %^%#o=QK8l^,C#m'+b.CKQ4=YdHDL"-X+Q%c+"R7!Qq5%^%# # return