华为 eNSP AC+AP 配置实战教程:从零搭建无线局域网
1. 前言:为什么要用 AC+AP 架构
在中小型企业、学校、酒店等场景中,无线网络早已不是"一台家用路由器开个 Wi-Fi"就能应付的。当接入点数量增多、覆盖面积变大时,传统"胖 AP"(每个 AP 独立配置、独立管理)的方式会带来配置繁琐、漫游体验差、统一管理困难等问题。
AC+AP 架构(Access Controller + Access Point,无线接入控制器 + 无线接入点)正是为了解决这些问题而生的:
- 集中管理:所有 AP 的配置、升级、监控都在 AC 上统一完成;
- 无缝漫游:终端在 AP 之间移动时,由 AC 统一协调,切换更平滑;
- 统一安全策略:认证、加密、访问控制策略一次下发,全网生效;
- 易于扩展:新增 AP 只需上电接入,由 AC 自动纳管。
华为 eNSP(Enterprise Network Simulation Platform)作为一款免费的华为网络设备模拟器,内置了 AC、AP 等无线设备模型,非常适合学习和验证 AC+AP 配置流程。本教程将带你从零开始,在 eNSP 中完成一套完整的 AC+AP 无线网络搭建。
说明:eNSP 中的 AP 为模拟设备,部分功能与真实设备存在差异,但核心配置逻辑与真机一致,学习价值很高。
2. 实验环境与拓扑规划
2.1 软件准备
| 软件 | 版本建议 | 说明 |
|---|---|---|
| eNSP | 1.3.00 及以上 | 华为官方网络模拟器 |
| VirtualBox | 5.2.x / 6.0.x | eNSP 依赖的虚拟化平台 |
| WinPcap | 4.1.3 | 抓包组件 |
| Wireshark | 3.x | 可选,用于抓包分析 |
安装顺序建议:先装 WinPcap → 再装 Wireshark → 再装 VirtualBox → 最后装 eNSP。安装完成后在 eNSP 中注册设备,确保 AC、AP 设备可以正常启动。
2.2 拓扑设计
本实验采用如下拓扑:
┌─────────────┐
│ AC6005 │
│ (AC 控制器) │
└──────┬──────┘
│ GE0/0/1
│
┌──────┴──────┐
│ LSW1 │
│ (接入交换机) │
└──┬───────┬──┘
│ │
GE0/0/1 │ │ GE0/0/2
┌────┴──┐ ┌──┴────┐
│ AP1 │ │ AP2 │
└───────┘ └───────┘
设备清单:
- AC6005 × 1:无线接入控制器
- S5700 交换机 × 1:作为 AP 的接入交换机
- AP 设备 × 2:模拟无线接入点
- 终端 × 1:模拟无线客户端(可用 PC 代替)
2.3 IP 地址规划
| 设备 | 接口/VLAN | IP 地址 | 说明 |
|---|---|---|---|
| AC6005 | Vlanif 100 | 192.168.100.1/24 | AC 管理地址 |
| AC6005 | Vlanif 101 | 192.168.101.1/24 | 业务地址(无线用户网关) |
| AP1 | - | 192.168.100.11/24 | AP 管理地址(DHCP 获取) |
| AP2 | - | 192.168.100.12/24 | AP 管理地址(DHCP 获取) |
| 无线终端 | - | 192.168.101.x/24 | 业务地址(DHCP 获取) |
VLAN 规划:
- VLAN 100:AP 管理 VLAN,用于 AC 与 AP 之间的 CAPWAP 隧道通信;
- VLAN 101:业务 VLAN,无线终端接入后获取的地址段。
3. 基础网络配置
3.1 交换机配置
交换机需要为 AP 划分管理 VLAN,并将连接 AP 的端口配置为 Trunk 模式,放行管理 VLAN 和业务 VLAN。
<Huawei> system-view
[Huawei] sysname LSW1
# 创建 VLAN
[LSW1] vlan batch 100 101
# 配置连接 AC 的上行口
[LSW1] interface GigabitEthernet 0/0/1
[LSW1-GigabitEthernet0/0/1] port link-type trunk
[LSW1-GigabitEthernet0/0/1] port trunk allow-pass vlan 100 101
[LSW1-GigabitEthernet0/0/1] quit
# 配置连接 AP1 的端口
[LSW1] interface GigabitEthernet 0/0/2
[LSW1-GigabitEthernet0/0/2] port link-type trunk
[LSW1-GigabitEthernet0/0/2] port trunk pvid vlan 100
[LSW1-GigabitEthernet0/0/2] port trunk allow-pass vlan 100 101
[LSW1-GigabitEthernet0/0/2] quit
# 配置连接 AP2 的端口
[LSW1] interface GigabitEthernet 0/0/3
[LSW1-GigabitEthernet0/0/3] port link-type trunk
[LSW1-GigabitEthernet0/0/3] port trunk pvid vlan 100
[LSW1-GigabitEthernet0/0/3] port trunk allow-pass vlan 100 101
[LSW1-GigabitEthernet0/0/3] quit
关键点:AP 的端口
pvid设置为管理 VLAN 100,这样 AP 上电后发出的 DHCP 请求会打上 VLAN 100 的标签,从而获取管理地址。
3.2 AC 基础配置
AC 需要配置管理地址、业务网关,并开启 DHCP 服务为 AP 和无线终端分配地址。
<AC6005> system-view
[AC6005] sysname AC1
# 创建 VLAN
[AC1] vlan batch 100 101
# 配置连接交换机的接口
[AC1] interface GigabitEthernet 0/0/1
[AC1-GigabitEthernet0/0/1] port link-type trunk
[AC1-GigabitEthernet0/0/1] port trunk allow-pass vlan 100 101
[AC1-GigabitEthernet0/0/1] quit
# 配置管理 VLAN 接口
[AC1] interface Vlanif 100
[AC1-Vlanif100] ip address 192.168.100.1 24
[AC1-Vlanif100] quit
# 配置业务 VLAN 接口
[AC1] interface Vlanif 101
[AC1-Vlanif101] ip address 192.168.101.1 24
[AC1-Vlanif101] quit
3.3 DHCP 服务配置
AC 上需要配置两个地址池:一个给 AP 分配管理地址,一个给无线终端分配业务地址。
# 开启 DHCP 服务
[AC1] dhcp enable
# AP 管理地址池
[AC1] ip pool ap-pool
[AC1-ip-pool-ap-pool] network 192.168.100.0 mask 255.255.255.0
[AC1-ip-pool-ap-pool] gateway-list 192.168.100.1
[AC1-ip-pool-ap-pool] option 43 sub-option 2 ip-address 192.168.100.1
[AC1-ip-pool-ap-pool] quit
# 无线终端业务地址池
[AC1] ip pool user-pool
[AC1-ip-pool-user-pool] network 192.168.101.0 mask 255.255.255.0
[AC1-ip-pool-user-pool] gateway-list 192.168.101.1
[AC1-ip-pool-user-pool] dns-list 114.114.114.114
[AC1-ip-pool-user-pool] quit
# 在接口上应用地址池
[AC1] interface Vlanif 100
[AC1-Vlanif100] dhcp select global
[AC1-Vlanif100] quit
[AC1] interface Vlanif 101
[AC1-Vlanif101] dhcp select global
[AC1-Vlanif101] quit
重点:
option 43 sub-option 2 ip-address 192.168.100.1这一行非常关键。它告诉 AP 去哪里找 AC(即 AC 的管理地址)。如果缺少这条配置,AP 可能无法自动发现 AC,需要手动指定。
4. AC 无线业务配置
4.1 配置 CAPWAP 源接口
CAPWAP(Control And Provisioning of Wireless Access Points)是 AC 与 AP 之间通信的协议。需要指定 AC 使用哪个接口作为 CAPWAP 隧道的源接口。
[AC1] capwap source interface Vlanif 100
4.2 配置 AP 认证模式
AC 需要对上线的 AP 进行认证,防止非法 AP 接入。常见模式有 MAC 认证和 SN 认证,本实验使用 MAC 认证。
[AC1] wlan
[AC1-wlan-view] ap auth-mode mac-auth
[AC1-wlan-view] quit
4.3 创建 AP 组
AP 组用于对 AP 进行分组管理,同一组内的 AP 共享相同的配置。
[AC1] wlan
[AC1-wlan-view] ap-group name ap-group1
[AC1-wlan-ap-group-ap-group1] quit
[AC1-wlan-view] quit
4.4 添加 AP 并绑定 AP 组
在 eNSP 中,AP 的 MAC 地址可以在 AP 设备启动后通过 display interface 或设备面板查看。假设 AP1 的 MAC 为 00e0-fc00-0001,AP2 的 MAC 为 00e0-fc00-0002。
[AC1] wlan
[AC1-wlan-view] ap-id 1 ap-mac 00e0-fc00-0001
[AC1-wlan-ap-1] ap-name AP1
[AC1-wlan-ap-1] ap-group ap-group1
[AC1-wlan-ap-1] quit
[AC1-wlan-view] ap-id 2 ap-mac 00e0-fc00-0002
[AC1-wlan-ap-2] ap-name AP2
[AC1-wlan-ap-2] ap-group ap-group1
[AC1-wlan-ap-2] quit
[AC1-wlan-view] quit
4.5 配置 WLAN 业务
WLAN 业务配置遵循"安全模板 → SSID 模板 → VAP 模板"的层次结构:
[AC1] wlan
# 1. 配置安全模板(WPA2-PSK 认证)
[AC1-wlan-view] security-profile name sec-profile1
[AC1-wlan-sec-prof-sec-profile1] security wpa2 psk pass-phrase Huawei@123 aes
[AC1-wlan-sec-prof-sec-profile1] quit
# 2. 配置 SSID 模板
[AC1-wlan-view] ssid-profile name ssid-profile1
[AC1-wlan-ssid-prof-ssid-profile1] ssid Huawei-WLAN
[AC1-wlan-ssid-prof-ssid-profile1] quit
# 3. 配置 VAP 模板
[AC1-wlan-view] vap-profile name vap-profile1
[AC1-wlan-vap-prof-vap-profile1] service-vlan vlan-id 101
[AC1-wlan-vap-prof-vap-profile1] security-profile sec-profile1
[AC1-wlan-vap-prof-vap-profile1] ssid-profile ssid-profile1
[AC1-wlan-vap-prof-vap-profile1] quit
# 4. 将 VAP 模板绑定到 AP 组
[AC1-wlan-view] ap-group name ap-group1
[AC1-wlan-ap-group-ap-group1] vap-profile vap-profile1 wlan 1 radio all
[AC1-wlan-ap-group-ap-group1] quit
[AC1-wlan-view] quit
说明:
radio all表示同时应用到 2.4G 和 5G 射频。如果只想在 5G 上启用,可以改为radio 1(具体编号以设备为准)。
5. 验证与测试
5.1 检查 AP 上线状态
[AC1] display ap all
正常情况下,输出中 AP 的 State 字段应显示为 nor(normal),表示 AP 已成功上线。
Total AP information:
nor : normal [2]
-----------------------------------------------------------------------------
ID MAC Name Group IP Type State STA Uptime
-----------------------------------------------------------------------------
1 00e0-fc00-0001 AP1 ap-group1 192.168.100.11 AP6050DN nor 0 00:05:23
2 00e0-fc00-0002 AP2 ap-group1 192.168.100.12 AP6050DN nor 0 00:03:11
5.2 检查 VAP 状态
[AC1] display vap ssid Huawei-WLAN
如果 VAP 状态为 ON,说明无线信号已经正常发射。
5.3 终端连接测试
在 eNSP 中添加一台 PC,配置无线网卡(或使用支持无线的终端设备),搜索 SSID Huawei-WLAN,输入密码 Huawei@123 连接。连接成功后,终端应能通过 DHCP 获取到 192.168.101.x 网段的地址。
# 在终端上验证
ipconfig
ping 192.168.101.1
能 ping 通网关,说明无线业务链路已经打通。
5.4 查看在线用户
[AC1] display station all
该命令可以查看当前接入的无线终端信息,包括 MAC 地址、关联的 AP、信号强度等。
6. 常见问题排查
6.1 AP 无法上线
现象:display ap all 中看不到 AP,或状态一直为 fault。
排查思路:
- 检查 AP 是否获取到 IP 地址:在 AP 上执行
display ip interface brief,确认是否拿到 192.168.100.x 的地址。如果没拿到,检查交换机端口的 PVID 和 DHCP 配置。 - 检查 option 43 配置:确认 AC 的 DHCP 地址池中配置了
option 43 sub-option 2 ip-address <AC管理地址>。 - 检查 CAPWAP 源接口:确认
capwap source interface Vlanif 100已配置,且该接口地址可达。 - 检查 AP 认证模式:如果使用 MAC 认证,确认 AP 的 MAC 地址与 AC 上配置的一致(注意 MAC 格式,华为设备通常为
xxxx-xxxx-xxxx)。 - 检查 VLAN 放行:确认交换机与 AC 之间的 Trunk 链路放行了 VLAN 100。
6.2 终端连不上 Wi-Fi
现象:能搜到 SSID,但连接失败或获取不到 IP。
排查思路:
- 检查安全模板密码:确认终端输入的密码与
security wpa2 psk pass-phrase配置一致。 - 检查业务 VLAN:确认 VAP 模板中
service-vlan vlan-id 101与 DHCP 地址池网段匹配。 - 检查 VAP 绑定:执行
display vap ssid Huawei-WLAN确认 VAP 状态为ON。 - 检查 DHCP 地址池:确认
user-pool地址池未耗尽,且dhcp select global已在 Vlanif 101 上配置。
6.3 终端获取到地址但无法上网
现象:终端能 ping 通网关,但无法访问外网。
排查思路:
- 检查 AC 上是否配置了默认路由指向出口设备;
- 检查出口设备(如路由器)是否配置了回程路由指向 192.168.101.0/24;
- 检查 NAT 配置是否正确。
7. 进阶优化建议
7.1 双频合一
现代 AP 通常支持 2.4G 和 5G 双频。可以通过配置让两个频段使用同一个 SSID,终端自动选择更优频段:
[AC1-wlan-view] ap-group name ap-group1
[AC1-wlan-ap-group-ap-group1] vap-profile vap-profile1 wlan 1 radio all
配合射频调优功能,可以让 AC 自动为 AP 分配信道和功率,减少干扰:
[AC1-wlan-view] rrm-profile name rrm-profile1
[AC1-wlan-rrm-prof-rrm-profile1] calibrate auto-channel-select enable
[AC1-wlan-rrm-prof-rrm-profile1] calibrate auto-txpower-select enable
[AC1-wlan-rrm-prof-rrm-profile1] quit
7.2 漫游优化
对于多 AP 场景,可以开启快速漫游功能,减少终端在 AP 间切换时的断线时间:
[AC1-wlan-view] vap-profile name vap-profile1
[AC1-wlan-vap-prof-vap-profile1] roam-enable
[AC1-wlan-vap-prof-vap-profile1] quit
7.3 用户隔离
在酒店、公共区域等场景,通常需要隔离无线用户之间的二层通信,提升安全性:
[AC1-wlan-view] traffic-profile name traffic-profile1
[AC1-wlan-traffic-prof-traffic-profile1] user-isolate l2
[AC1-wlan-traffic-prof-traffic-profile1] quit
[AC1-wlan-view] vap-profile name vap-profile1
[AC1-wlan-vap-prof-vap-profile1] traffic-profile traffic-profile1
[AC1-wlan-vap-prof-vap-profile1] quit
8. 总结
本文完整演示了在华为 eNSP 中搭建 AC+AP 无线网络的全过程,核心配置可以归纳为以下几个步骤:
关键记忆点:
- option 43 是 AP 自动发现 AC 的关键;
- CAPWAP 源接口 必须指向 AP 可达的管理接口;
- 模板化配置(安全模板、SSID 模板、VAP 模板)是华为 WLAN 配置的核心思想;
- AP 组 让批量配置变得简单,新增 AP 只需绑定到对应组即可。
掌握这套流程后,你可以进一步尝试 Portal 认证、802.1X 认证、AC 冗余备份等更高级的无线特性。建议在 eNSP 中反复练习,并对照真机文档理解每条命令的实际作用。
DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。
更多推荐



所有评论(0)