配置学生健康与安全示实验
作者:知孤云出岫
作者主页:点击这里
组网图形
图1 配置学生健康与安全示例组网图
数据规划
配置项 | 数据 |
---|---|
管理VLAN | VLAN100 |
业务VLAN | VLAN101 |
AC的源接口 | VLANIF100 |
DHCP服务器 | AC作为DHCP服务器为AP和STA分配IP地址 |
STA的IP地址池 | 10.23.101.2~10.23.101.254/24 |
AP组 |
|
域管理模板 |
|
SSID模板 |
|
安全模板 |
|
VAP模板 |
|
IoT模板 |
|
配置注意事项
-
建议在与AP直连的设备接口上配置端口隔离,如果不配置端口隔离,尤其是业务数据转发方式采用直接转发时,可能会在VLAN内形成大量不必要的广播报文,导致网络阻塞,影响用户体验。
-
隧道转发模式下,管理VLAN和业务VLAN不能配置为同一VLAN,且AP和AC之间只能放通管理VLAN,不能放通业务VLAN。
- V200R021C00版本开始,配置CAPWAP源接口或源地址时,会检查和安全相关的配置是否已存在,包括DTLS加密的PSK、AC间DTLS加密的PSK、登录AP的用户名和密码、全局离线管理VAP的登录密码,均已存在才能成功配置,否则会提示用户先完成相关的配置。
- V200R021C00版本开始,AC默认开启CAPWAP控制隧道的DTLS加密功能。开启该功能,添加AP时AP会上线失败,此时需要先开启CAPWAP DTLS不认证方式(capwap dtls no-auth enable)让AP上线,以便AP获取安全凭证,AP上线后应及时关闭该功能(undo capwap dtls no-auth enable),避免未授权AP上线。
操作步骤
1.配置交换机和AC,使AP与AC之间互通
# 配置接入交换机Switch。将Switch的接口GE0/0/1~GE0/0/4加入VLAN100(管理VLAN)和VLAN101(业务VLAN)。
<HUAWEI> system-view
[HUAWEI] sysname Switch
[Switch] vlan batch 100 to 101
[Switch] interface gigabitethernet 0/0/1
[Switch-GigabitEthernet0/0/1] port link-type trunk
[Switch-GigabitEthernet0/0/1] port trunk allow-pass vlan 100 to 101
[Switch-GigabitEthernet0/0/1] quit
[Switch] interface gigabitethernet 0/0/2
[Switch-GigabitEthernet0/0/2] port link-type trunk
[Switch-GigabitEthernet0/0/2] port trunk pvid vlan 100
[Switch-GigabitEthernet0/0/2] port trunk allow-pass vlan 100 to 101
[Switch-GigabitEthernet0/0/2] quit
[Switch] interface gigabitethernet 0/0/3
[Switch-GigabitEthernet0/0/3] port link-type trunk
[Switch-GigabitEthernet0/0/3] port trunk pvid vlan 100
[Switch-GigabitEthernet0/0/3] port trunk allow-pass vlan 100 to 101
[Switch-GigabitEthernet0/0/3] quit
[Switch] interface gigabitethernet 0/0/4
[Switch-GigabitEthernet0/0/4] port link-type trunk
[Switch-GigabitEthernet0/0/4] port trunk pvid vlan 100
[Switch-GigabitEthernet0/0/4] port trunk allow-pass vlan 100 to 101
[Switch-GigabitEthernet0/0/4] quit
# 配置AC。配置接口GE0/0/1加入VLAN100、VLAN101。
<HUAWEI> system-view
[HUAWEI] sysname AC
[AC] vlan batch 100 to 101
[AC] interface gigabitethernet 0/0/1
[AC-GigabitEthernet0/0/1] port link-type trunk
[AC-GigabitEthernet0/0/1] port trunk allow-pass vlan 100 101
[AC-GigabitEthernet0/0/1] quit
- 配置AP与服务器之间的互通。
请根据实际组网情况配置路由,保证AP与上位机间网络互通。
- 配置AC作为DHCP服务器,为AP和STA分配IP地址
# 配置基于接口地址池的DHCP服务器。 DNS服务器地址请根据实际需要配置。常用配置方法如下: 接口地址池场景,需要在VLANIF接口视图下执行命令dhcp server dns-list ip-address &<1-8>。 全局地址池场景,需要在IP地址池视图下执行命令dns-list ip-address &<1-8>。 [AC] dhcp enable [AC] interface vlanif 100 [AC-Vlanif100] ip address 10.23.100.1 24 [AC-Vlanif100] dhcp select interface [AC-Vlanif100] quit [AC] interface vlanif 101 [AC-Vlanif101] ip address 10.23.101.1 24 [AC-Vlanif101] dhcp select interface [AC-Vlanif101] quit
- 配置AP上线
# 创建AP组,用于将相同配置的AP都加入同一AP组中。 [AC] wlan [AC-wlan-view] ap-group name ap-group1 [AC-wlan-ap-group-ap-group1] quit # 创建域管理模板,在域管理模板下配置AC的国家码并在AP组下引用域管理模板。 [AC-wlan-view] regulatory-domain-profile name default [AC-wlan-regulate-domain-default] country-code cn [AC-wlan-regulate-domain-default] quit [AC-wlan-view] ap-group name ap-group1 [AC-wlan-ap-group-ap-group1] regulatory-domain-profile default Warning: Modifying the country code will clear channel, power and antenna gain configurations of the radio and reset the AP. Continue?[Y/N]:y [AC-wlan-ap-group-ap-group1] quit [AC-wlan-view] quit # 配置AC的源接口。 [AC] capwap source interface vlanif 100 # 在AC上离线导入AP,并将AP加入AP组“ap-group1”中。根据AP的部署位置为AP配置名称,便于从名称上就能够了解AP的部署位置。例如MAC地址为60de-4476-e360的AP部署在教室内,命名为room_1;MAC地址为60de-4476-e460和60de-4476-e560的AP分别部署在校门内外侧,命名为door_1和door_2。 ap auth-mode命令缺省情况下为MAC认证,如果之前没有修改其缺省配置,可以不用执行ap auth-mode mac-auth。 举例中使用的AP为AP4050DN-E,具有射频0和射频1两个射频。 [AC] wlan [AC-wlan-view] ap auth-mode mac-auth [AC-wlan-view] ap-id 0 ap-mac 60de-4476-e360 [AC-wlan-ap-0] ap-name room_1 Warning: This operation may cause AP reset. Continue? [Y/N]:y [AC-wlan-ap-0] ap-group ap-group1 Warning: This operation may cause AP reset. If the country code changes, it will clear channel, power and antenna gain configuration s of the radio, Whether to continue? [Y/N]:y [AC-wlan-ap-0] quit [AC-wlan-view] ap-id 1 ap-mac 60de-4476-e460 [AC-wlan-ap-1] ap-name door_1 Warning: This operation may cause AP reset. Continue? [Y/N]:y [AC-wlan-ap-1] ap-group ap-group1 Warning: This operation may cause AP reset. If the country code changes, it will clear channel, power and antenna gain configuration s of the radio, Whether to continue? [Y/N]:y [AC-wlan-ap-1] quit [AC-wlan-view] ap-id 2 ap-mac 60de-4476-e560 [AC-wlan-ap-2] ap-name door_2 Warning: This operation may cause AP reset. Continue? [Y/N]:y [AC-wlan-ap-2] ap-group ap-group1 Warning: This operation may cause AP reset. If the country code changes, it will clear channel, power and antenna gain configuration s of the radio, Whether to continue? [Y/N]:y [AC-wlan-ap-2] quit # 将AP上电后,当执行命令display ap all查看到AP的“State”字段为“nor”时,表示AP正常上线。 [AC-wlan-view] display ap all Total AP information: nor : normal [3] ExtraInfo : Extra information P : insufficient power supply ---------------------------------------------------------------------------------------------- ID MAC Name Group IP Type State STA Uptime ExtraInfo ---------------------------------------------------------------------------------------------- 0 60de-4476-e360 room_1 ap-group1 10.23.100.254 AP4050DN-E nor 0 51S - 1 60de-4476-e460 door_1 ap-group1 10.23.100.253 AP4050DN-E nor 0 45S - 2 60de-4476-e560 door_2 ap-group1 10.23.100.252 AP4050DN-E nor 0 25S - ---------------------------------------------------------------------------------------------- Total: 3
- 配置WLAN覆盖业务
# 创建名为“wlan-net”的安全模板,并配置安全策略。 举例中以配置WPA-WPA2+PSK+AES的安全策略为例,密码为“a1234567”,实际配置中请根据实际情况,配置符合实际要求的安全策略。 [AC-wlan-view] security-profile name wlan-net [AC-wlan-sec-prof-wlan-net] security wpa-wpa2 psk pass-phrase a1234567 aes [AC-wlan-sec-prof-wlan-net] quit # 创建名为“wlan-net”的SSID模板,并配置SSID名称为“wlan-net”。 [AC-wlan-view] ssid-profile name wlan-net [AC-wlan-ssid-prof-wlan-net] ssid wlan-net [AC-wlan-ssid-prof-wlan-net] quit # 创建名为“wlan-net”的VAP模板,配置业务数据转发模式、业务VLAN,并且引用安全模板和SSID模板。 [AC-wlan-view] vap-profile name wlan-net [AC-wlan-vap-prof-wlan-net] forward-mode direct-forward [AC-wlan-vap-prof-wlan-net] service-vlan vlan-id 101 [AC-wlan-vap-prof-wlan-net] security-profile wlan-net [AC-wlan-vap-prof-wlan-net] ssid-profile wlan-net [AC-wlan-vap-prof-wlan-net] quit # 配置AP组引用VAP模板,AP上射频0和射频1都使用VAP模板“wlan-net”的配置。 [AC-wlan-view] ap-group name ap-group1 [AC-wlan-ap-group-ap-group1] vap-profile wlan-net wlan 1 radio 0 [AC-wlan-ap-group-ap-group1] vap-profile wlan-net wlan 1 radio 1 [AC-wlan-ap-group-ap-group1] quit
- 配置AP与上位机的通信参数
[AC-wlan-view] iot-profile name wlan-iot [AC-wlan-iot-prof-wlan-iot] management-server server-ip 10.23.200.1 server-port 3000 [AC-wlan-iot-prof-wlan-iot] config-agent permit ip-address 10.23.102.253 255.255.255.0 [AC-wlan-iot-prof-wlan-iot] share-key aabb0011@11 [AC-wlan-iot-prof-wlan-iot] quit [AC-wlan-view] ap-group name ap-group1 [AC-wlan-ap-group-ap-group1] card 1 [AC-wlan-group-card-ap-group1/1] iot-profile wlan-iot config-agent tcp port 50200 [AC-wlan-group-card-ap-group1/1] quit [AC-wlan-ap-group-ap-group1] quit
- 在上位机上添加AP的IP地址并配置与AP一致的共享密钥
- 检查配置结果
# WLAN业务配置会自动下发给AP。配置完成后,通过执行命令display vap ssid wlan-net查看如下信息,当“Status”项显示为“ON”时,表示AP对应的射频上的VAP已创建成功。 [AC-wlan-view] display vap ssid wlan-net WID : WLAN ID -------------------------------------------------------------------------------- AP ID AP name RfID WID BSSID Status Auth type STA SSID -------------------------------------------------------------------------------- 0 room_1 0 1 60DE-4476-E360 ON WPA/WPA2-PSK 1 wlan-net 0 room_1 1 1 60DE-4476-E370 ON WPA/WPA2-PSK 0 wlan-net 0 door_1 0 1 60DE-4476-E460 ON WPA/WPA2-PSK 1 wlan-net 0 door_1 1 1 60DE-4476-E470 ON WPA/WPA2-PSK 0 wlan-net 0 door_2 0 1 60DE-4476-E560 ON WPA/WPA2-PSK 1 wlan-net 0 door_2 1 1 60DE-4476-E570 ON WPA/WPA2-PSK 0 wlan-net ------------------------------------------------------------------------------------ Total: 6 # 查看IoT模板的配置信息。 [AC-wlan-view] display iot-profile name wlan-iot -------------------------------------------------------------------------------- Type : common Agent permit IP address : 10.23.102.253 Agent permit net-mask : 255.255.255.0 Management server IP address : 10.23.200.1 Management server port : 3000 ExtManagement server IP address : - ExtManagement server port : - Share key : ****** --------------------------------------------------------------------------------
配置文件
-
接入交换机的配置文件
<span style="color:#333333"><span style="background-color:#ffffff"><span style="background-color:#dddddd"># sysname Switch # vlan batch 100 to 101 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 100 to 101 # interface GigabitEthernet0/0/2 port link-type trunk port trunk pvid vlan 100 port trunk allow-pass vlan 100 to 101 # interface GigabitEthernet0/0/3 port link-type trunk port trunk pvid vlan 100 port trunk allow-pass vlan 100 to 101 # interface GigabitEthernet0/0/4 port link-type trunk port trunk pvid vlan 100 port trunk allow-pass vlan 100 to 101 # return</span></span></span>
-
AC的配置文件
<span style="color:#333333"><span style="background-color:#ffffff"><span style="background-color:#dddddd"># sysname AC # vlan batch 100 to 101 # dhcp enable # interface Vlanif100 ip address 10.23.100.1 255.255.255.0 dhcp select interface # interface Vlanif101 ip address 10.23.101.1 255.255.255.0 dhcp select interface # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 100 101 # capwap source interface vlanif100 # wlan security-profile name wlan-net security wpa-wpa2 psk pass-phrase %^%#CU9SYQg[.Vxx;xH%>nwFA.WJ6i/Fm~me>&W%`b/-%^%# aes ssid-profile name wlan-net ssid wlan-net vap-profile name wlan-net service-vlan vlan-id 101 ssid-profile wlan-net security-profile wlan-net regulatory-domain-profile name default iot-profile name wlan-iot config-agent permit ip-address 10.23.102.253 255.255.255.0 management-server server-ip 10.23.200.1 server-port 3000 share-key %^%#vj*JIT.]q%6Q6[VqoHMJHs(5Oss3g3*%@r9Vy%aW%^%# ap-group name ap-group1 radio 0 vap-profile wlan-net wlan 1 radio 1 vap-profile wlan-net wlan 1 card 1 iot-profile wlan-iot config-agent tcp port 50200 ap-id 0 ap-mac 60de-4476-e360 ap-sn 210235419610D2000066 ap-name room_1 ap-group ap-group1 ap-id 1 ap-mac 60de-4476-e460 ap-sn 210235419610D2000067 ap-name door_1 ap-group ap-group1 ap-id 2 ap-mac 60de-4476-e560 ap-sn 210235419610D2000068 ap-name door_2 ap-group ap-group1 # return</span></span></span>