对比基于旁挂式直接转发和数据隧道转发的无线网络搭建

Clevebitr Lv2

本实验使用ensp仿真模拟器配置

一、组网需求

企业用户通过 WLAN 接入网络,以满足移动办公的最基本需求。且在覆盖区域内移动发生漫游时,不影响用户的业务使用,对比两种数据转发方式的区别。
AC 组网方式:旁挂二层组网。
DHCP 部署方式:
AC 作为 DHCP 服务器,基于接口为 AP 和 STA2 分配 IP 地址;S1 作为 DHCP 服务器,基于接口为 STA1 分配 IP 地址。
AC 作为 DHCP 服务器,基于全局地址池为 AP 和 STA2 分配 IP 地址;S1 作为 DHCP 服务器,基于全局地址池为 STA1 分配 IP 地址。
AC 作为 DHCP 服务器,S1作为DHCP中继服务器,基于中继为 AP 和 STA2 分配 IP 地址;S1 作为 DHCP 服务器,基于全局地址池为 STA1 分配 IP 地址。

业务数据转发方式:直接转发&隧道转发。

二、实验条件和实验器材

1.华为AC6605设备一台
2.华为AP4050DN设备2台
3.华为S5700设备1台
4.华为R2240设备1台(eNSP使用AR1220)
5.无线终端设备2台
6.管理主机1台
7.配置电缆1根
8.电源插座5个
9.吉比特以太网网线3根。
拓扑

三、数据规划

为了实现AC对AP的配置管理和STA业务的正常转发,AC作为DHCP服务器为AP和STA分配IP地址。具体数据规划如下:

配置项规划数据
管理 VLANVLAN100
STA 业务 VLANVLAN10、20
DHCP 服务器三种方式
AP 的 IP 地址池10.23.100.2~10.23.100.254/24
STA 的 IP 地址池10.23.10.2~10.23.10.254/24
10.23.20.2~10.23.20.254/24
AC 的源接口 IP 地址VLANIF100:10.23.100.1/24
AP 组名称:ap1
引用模板:VAP 模板 vap1、域管理模板 default
名称:ap2
引用模板:VAP 模板vap2、域管理模板 default
域管理模板名称:default
国家码:中国
SSID 模板名称:ss1
SSID 名称:111
名称:ss2
SSID 名称:222
安全模板名称:se
安全策略:WEP Open
VAP 模板名称:vap1
转发模式:直接转发
业务 VLAN:VLAN10
引用模板:SSID 模板 ss1、安全模板se
名称:vap2
转发模式:隧道转发
业务 VLAN
VLAN20
引用模板:SSID 模板ss2、安全模板se

四、配置思路

  1. 配置 AP、AC 和周边网络设备之间实现网络互通。
  2. 配置 AP 上线。
    1. 创建 AP 组,用于将需要进行相同配置的 AP 都加入到 AP 组,实现统一配置。
    2. 配置 AC 的系统参数,包括国家码、AC 与 AP 之间通信的源接口。
    3. 配置 AP 上线的认证方式并离线导入 AP,实现 AP 正常上线。
  3. 配置 WLAN 业务参数,实现 STA 访问 WLAN 网络功能。

五、实验步骤

实验前准备工作 标注每个端口允许通过的vlan

规则:

AP和AC之间允许管理vlan通过
直接转发:AP和外网之间允许业务vlan通过
隧道转发:AC和外网之间允许业务vlan通过

步骤 1 配置周边设备交换机S1

创建vlan
划分端口
在入口处,配置PVID

配置接入交换机 Switch 的 GE0/0/1 、GE0/0/2 、GE0/0/3、GE0/0/4 接口划分端口,GE0/0/1 加入 VLAN10 、VLAN20、VLAN11,GE0/0/2 加入 VLAN10 、VLAN100,GE0/0/3 加入 VLAN100,GE0/0/4加入 VLAN100 、VLAN20。GE0/0/3 、GE0/0/4的缺省 VLAN 为 VLAN100。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[Huawei]sysname Switch
[Switch]vlan batch 10 11 20 100
[Switch]int g0/0/1
[Switch-GigabitEthernet0/0/1]port link-type trunk
[Switch-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 11 20
[Switch-GigabitEthernet0/0/1]q
[Switch]int g0/0/2
[Switch-GigabitEthernet0/0/2]port link-type trunk
[Switch-GigabitEthernet0/0/2]port trunk allow-pass vlan 10 100
[Switch-GigabitEthernet0/0/2]q
[Switch]int g0/0/3
[Switch-GigabitEthernet0/0/3]port link-type trunk
[Switch-GigabitEthernet0/0/3]port trunk allow-pass vlan 100
[Switch-GigabitEthernet0/0/3]port trunk pvid vlan 100
[Switch-GigabitEthernet0/0/3]q
[Switch]int g0/0/4
[Switch-GigabitEthernet0/0/4]port link-type trunk
[Switch-GigabitEthernet0/0/4]port trunk allow-pass vlan 20 100
[Switch-GigabitEthernet0/0/4]port trunk pvid vlan 100
[Switch-GigabitEthernet0/0/4]q

配置周边设备路由器R1
创建vlan
划分端口
Vlanif接口配置IP地址,方便测试STA与外网的连通性

配置 Router 的接口 E0/0/0 加入 VLAN10、VLAN20、VLAN11,创建接口 VLANIF11并配置 IP 地址为11.0.0.1/24。

1
2
3
4
5
6
7
8
9
[Huawei]sysname Router
[Router]vlan batch 10 20 11
[Router]int e0/0/0
[Router-Ethernet0/0/0]port link-type trunk
[Router-Ethernet0/0/0]port trunk allow-pass vlan 10 20 11
[Router-Ethernet0/0/0]q
[Router]int vlanif 11
[Router-Vlanif11]ip address 11.0.0.1 24
[Router-Vlanif11]q

配置交换机S1,创建接口 VLANIF11并配置 IP 地址为11.0.0.2/24。

1
2
3
[Switch]int vlanif 11
[Switch-Vlanif11]ip address 11.0.0.2 24
[Switch-Vlanif11]q

步骤 2 配置 AC 与其它网络设备互通

  • 创建vlan
  • 划分端口
  • 配置DHCP服务器
  • 创建AP组
  • 配置AC源端口
  • 手动离线配置AP上线AC

配置 AC 的接口 GE0/0/1 加入 VLAN10 和 VLAN100。

1
2
3
4
5
6
7
[AC6605]sysname AC
[AC]vlan batch 10 100
Info: This operation may take a few seconds. Please wait for a moment...done.
[AC]int g0/0/1
[AC-GigabitEthernet0/0/1]port link-type trunk
[AC-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 100
[AC-GigabitEthernet0/0/1]q

步骤 3 配置 DHCP 服务器为 STA 和 AP 分配 IP 地址

  • 方法一:基于接口的DHCP服务器(AC作为AP和STA1的DHCP服务器,S1作为STA2的DHCP服务器或S1作为AP、STA1、STA2的DHCP服务器)

AC作为AP和STA1的DHCP服务器,S1作为STA2的DHCP服务器

1
2
3
4
5
6
7
8
9
10
[AC]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[AC]interface vlanif100
[AC-Vlanif100]ip address 100.0.0.1 24
[AC-Vlanif100]dhcp select interface
[AC-Vlanif100]q
[AC]interface Vlanif 10
[AC-Vlanif10]ip address 10.0.0.1 24
[AC-Vlanif10]dhcp select interface
[AC-Vlanif10]q

在S1上配置 VLANIF20 接口为 STA 2提供 IP 地址。

1
2
3
4
5
6
[Switch]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[Switch]interface vlanif20
[Switch-Vlanif20]ip address 20.0.0.1 24
[Switch-Vlanif20]dhcp select interface
[Switch-Vlanif20]q

S1作为AP、STA1、STA2的DHCP服务器

在 S1上配置 VLANIF100 接口为 AP 提供 IP 地址,配置 VLANIF10 接口为 STA 1提供 IP 地址,配置 VLANIF20 接口为 STA 2提供 IP 地址。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[Switch]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[Switch]interface vlanif100
[Switch-Vlanif100]ip address 100.0.0.1 24
[Switch-Vlanif100]dhcp select interface
[Switch-Vlanif100]q
[Switch]interface Vlanif 10
[Switch-Vlanif10]ip address 10.0.0.1 24
[Switch-Vlanif10]dhcp select interface
[Switch-Vlanif10]q
[Switch]interface vlanif20
[Switch-Vlanif20]ip address 20.0.0.1 24
[Switch-Vlanif20]dhcp select interface
[Switch-Vlanif20]q
  • 方法二:基于全局的DHCP服务器(AC作为AP和STA1的DHCP服务器,S1作为STA2的DHCP服务器或S1作为AP、STA1、STA2的DHCP服务器)

AC作为AP和STA1的DHCP服务器,S1作为STA2的DHCP服务器

在 AC 上创建IP地址池“AP-POOL”为 AP 提供 IP 地址,创建vlanif100接口引用“AP-POOL”地址池;创建IP地址池“STA1-POOL”为 STA 1提供 IP 地址,创建vlanif10接口引用“STA1-POOL”地址池。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[AC]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[AC]ip pool AP-POOL
[AC-ip-pool-AP-POOL]network 100.0.0.0 mask 24
[AC-ip-pool-AP-POOL]gateway-list 100.0.0.1

[AC]interface vlanif100
[AC-Vlanif100]ip address 100.0.0.1 24
[AC-Vlanif100]dhcp select global
[AC-Vlanif100]q

[AC]ip pool STA1-POOL
[AC-ip-pool-STA1-POOL]network 10.0.0.0 mask 24
[AC-ip-pool-STA1-POOL]gateway-list 10.0.0.1

[AC]interface vlanif10
[AC-Vlanif10]ip address 10.0.0.1 24
[AC-Vlanif10]dhcp select global
[AC-Vlanif10]q

在S1上创建IP地址池“STA2-POOL”为 STA2 提供 IP 地址,创建vlanif200接口引用“STA2-POOL”地址池。

1
2
3
4
5
6
7
8
9
10
[Switch]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[Switch]ip pool STA2-POOL
[Switch-ip-pool-STA2-POOL]network 20.0.0.0 mask 24
[Switch-ip-pool-STA2-POOL]gateway-list 20.0.0.1

[Switch]interface vlanif20
[Switch-Vlanif20]ip address 20.0.0.1 24
[Switch-Vlanif20]dhcp select global
[Switch-Vlanif20]q

S1作为AP、STA1、STA2的DHCP服务器

在 S1上创建IP地址池“AP-POOL”为 AP 提供 IP 地址,创建vlanif100接口引用“AP-POOL”地址池;创建IP地址池“STA1-POOL”为 STA 1提供 IP 地址,创建vlanif10接口引用“STA1-POOL”地址池;创建IP地址池“STA2-POOL”为 STA2 提供 IP 地址,创建vlanif200接口引用“STA2-POOL”地址池。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[Switch]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[Switch]ip pool AP-POOL
[Switch-ip-pool-AP-POOL]network 100.0.0.0 mask 24
[Switch-ip-pool-AP-POOL]gateway-list 100.0.0.1
[Switch]interface vlanif100
[Switch-Vlanif100]ip address 100.0.0.1 24
[Switch-Vlanif100]dhcp select global
[Switch-Vlanif100]q

[Switch]ip pool STA1-POOL
[Switch-ip-pool-STA1-POOL]network 10.0.0.0 mask 24
[Switch-ip-pool-STA1-POOL]gateway-list 10.0.0.1
[Switch]interface Vlanif 10
[Switch-Vlanif10]ip address 10.0.0.1 24
[Switch-Vlanif10]dhcp select global
[Switch-Vlanif10]q

[Switch]ip pool STA2-POOL
[Switch-ip-pool-STA2-POOL]network 20.0.0.0 mask 24
[Switch-ip-pool-STA2-POOL]gateway-list 20.0.0.1
[Switch]interface vlanif20
[Switch-Vlanif20]ip address 20.0.0.1 24
[Switch-Vlanif20]dhcp select global
[Switch-Vlanif20]q
  • 方法三:基于中继的DHCP服务器(AC作为AP和STA1的DHCP服务器,S1作为AC的代理服务器,S1基于全局或接口作为STA2的DHCP服务器)

AC作为AP和STA1的DHCP服务器,S1作为AC的代理服务器,S1基于全局或接口作为STA2的DHCP服务器

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[AC]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[AC]ip pool AP-POOL
[AC-ip-pool-AP-POOL]network 100.0.0.0 mask 24
[AC-ip-pool-AP-POOL]gateway-list 100.0.0.2

[AC]interface vlanif100
[AC-Vlanif100]ip address 100.0.0.1 24
[AC-Vlanif100]dhcp select global
[AC-Vlanif100]q

[AC]ip pool STA1-POOL
[AC-ip-pool-STA1-POOL]network 10.0.0.0 mask 24
[AC-ip-pool-STA1-POOL]gateway-list 10.0.0.2

[AC]interface vlanif10
[AC-Vlanif10]ip address 10.0.0.1 24
[AC-Vlanif10]dhcp select global
[AC-Vlanif10]q

在 S1上创建vlanif100端口,配置基于中继的DHCP服务器,并设置中继代理IP地址为AC上vlanif100的IP地址;创建vlanif10端口,配置基于中继的DHCP服务器,并设置中继代理IP地址为AC上vlanif10的IP地址。

1
2
3
4
5
6
7
8
9
10
11
12
13
[Switch]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[Switch]interface vlanif100
[Switch-Vlanif100]ip address 100.0.0.2 24
[Switch-Vlanif100]dhcp select relay
[Switch-Vlanif100]dhcp relay service-ip 100.0.0.1
[Switch-Vlanif100]q

[Switch]interface vlanif10
[Switch-Vlanif10]ip address 10.0.0.2 24
[Switch-Vlanif10]dhcp select relay
[Switch-Vlanif10]dhcp relay service-ip 10.0.0.1
[Switch-Vlanif10]q

步骤 4 配置 AP 上线

创建 AP 组,用于将相同配置的 AP 都加入同一 AP 组中。

1
2
3
4
5
6
7
8
9
[AC]wlan 
[AC-wlan-view]ap-group name ap1
Info: This operation may take a few seconds. Please wait for a moment.done.
[AC-wlan-ap-group-ap1]q

[AC]wlan
[AC-wlan-view]ap-group name ap2
Info: This operation may take a few seconds. Please wait for a moment.done.
[AC-wlan-ap-group-ap2]q

创建域管理模板,在域管理模板下配置 AC 的国家码并在 AP 组下引用域管理模板。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[AC-wlan-view]regulatory-domain-profile name default
[AC-wlan-regulate-domain-default]country-code cn
Info: The current country code is same with the input country code.
[AC-wlan-regulate-domain-default]q

[AC-wlan-view]ap-group name ap1
[AC-wlan-ap-group-ap1]regulatory-domain-profile default
Warning: Modifying the country code will clear channel, power and antenna gain c
onfigurations of the radio and reset the AP. Continue?[Y/N]:y
[AC-wlan-ap-group-ap1]q

[AC-wlan-view]ap-group name ap2
[AC-wlan-ap-group-ap2]regulatory-domain-profile default
Warning: Modifying the country code will clear channel, power and antenna gain c
onfigurations of the radio and reset the AP. Continue?[Y/N]:y
[AC-wlan-ap-group-ap2]q

[AC-wlan-view]q

配置 AC 的源接口

1
[AC] capwap source interface vlanif 100

在 AC 上离线导入 AP,并将 AP 加入 AP 组“ap1”中

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[AC]wlan
[AC-wlan-view]ap auth-mode mac-auth
[AC-wlan-view]ap-id 0 ap-mac 00E0-FCBD-77B0
[AC-wlan-ap-0]ap-name AP1
[AC-wlan-ap-0]ap-group ap1
Warning: This operation may cause AP reset. If the country code changes, it will clear channel, power and antenna gain configurations of the radio, Whether to continue? [Y/N]:y
Info: This operation may take a few seconds. Please wait for a moment.. done.
[AC-wlan-ap-0]q

[AC]wlan
[AC-wlan-view]ap auth-mode mac-auth
[AC-wlan-view]ap-id 1 ap-mac 00E0-FCD8-7B40
[AC-wlan-ap-1]ap-name AP2
[AC-wlan-ap-1]ap-group ap2
Warning: This operation may cause AP reset. If the country code changes, it will clear channel, power and antenna gain configurations of the radio, Whether to continue? [Y/N]:y
Info: This operation may take a few seconds. Please wait for a moment.. done.
[AC-wlan-ap-1]q

将 AP 上电后,当执行命令 display ap all 查看到 AP 的“State”字段为“nor”时,表示 AP正常上线。

1
2
[AC-wlan-view]display ap all
Info: This operation may take a few seconds. Please wait for a moment.done.

步骤 5 配置 WLAN 业务参数

创建安全策略模板
创建ssid模板
创建vap模板,设置转发方式、业务vlan、引用安全策略模板和ssid模板
进入AP组,引用vap模板

创建名为“se”的安全模板,并配置安全策略。

1
2
3
[AC-wlan-view] security -profile name se
[AC-wlan-sec-prof-se]security open
[AC-wlan-sec-prof-se]q

创建名为“ss1”的 SSID 模板,并配置 SSID 名称为“111”;创建名为“ss2”的 SSID 模板,并配置 SSID 名称为“222”。

1
2
3
4
5
6
7
8
9
[AC-wlan-view]ssid-profile  name ss1
[AC-wlan-ssid-prof-ss1]ssid 111
Info: This operation may take a few seconds, please wait.done.
[AC-wlan-ssid-prof-ss1]q

[AC-wlan-view]ssid-profile name ss2
[AC-wlan-ssid-prof-ss2]ssid 222
Info: This operation may take a few seconds, please wait.done.
[AC-wlan-ssid-prof-ss2]q

创建名为“vap1”的 VAP 模板,配置业务数据转发模式为直接转发、业务 VLAN是vlan 10,并且引用安全模板和 SSID 模板;创建名为“vap2”的 VAP 模板,配置业务数据转发模式为隧道转发、业务 VLAN是vlan 20,并且引用安全模板和 SSID 模板。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[AC-wlan-view]vap-profile name vap1
[AC-wlan-vap-prof-vap1]forward-mode tunnel
[AC-wlan-vap-prof-vap1]service-vlan vlan-id 10
Info: This operation may take a few seconds, please wait.done.
[AC-wlan-vap-prof-vap1]security-profile se
Info: This operation may take a few seconds, please wait.done.
[AC-wlan-vap-prof-vap1]ssid-profile ss1
Info: This operation may take a few seconds, please wait.done.
[AC-wlan-vap-prof-vap1]q

[AC-wlan-view]vap-profile name vap2
[AC-wlan-vap-prof-vap2]forward-mode direct-forward
[AC-wlan-vap-prof-vap2]service-vlan vlan-id 20
Info: This operation may take a few seconds, please wait.done.
[AC-wlan-vap-prof-vap2]security-profile se
Info: This operation may take a few seconds, please wait.done.
[AC-wlan-vap-prof-vap2]ssid-profile ss2
Info: This operation may take a few seconds, please wait.done.
[AC-wlan-vap-prof-vap2]q

配置 AP1 组引用 VAP 1模板,AP 上射频 0 和射频 1 都使用 VAP 模板“vap1”的配置;配置 AP2 组引用 VAP 模板,AP 上射频 0 和射频 1 都使用 VAP 模板“vap2”的配置。WLAN 后面数字表示 WLAN ID,表示其在 VAP 内部编号。

1
2
3
4
5
6
7
8
9
10
[AC-wlan-view]ap-group name ap1
[AC-wlan-ap-group-ap1]vap-profile vap1 wlan 1 radio 0
[AC-wlan-ap-group-ap1]vap-profile vap1 wlan 1 radio 1
Info: This operation may take a few seconds, please wait...done.
[AC-wlan-ap-group-ap1]q

[AC-wlan-view]ap-group name ap2
[AC-wlan-ap-group-ap2]vap-profile vap2 wlan 1 radio all
Info: This operation may take a few seconds, please wait...done.
[AC-wlan-ap-group-ap2]q

步骤 6 验证配置结果

查看AP的射频信号:display vap ssid 111
查看AP上连接的STA信息:display station ssid 111
测试STA与外网的连通性:ping

WLAN 业务配置会自动下发给 AP,配置完成后,通过执行命令 display vap ssid 查看如下信息,当“Status”项显示为“ON”时,表示 AP 对应的射频上的 VAP 已创建成功。

1
2
[AC-wlan-view] display vap ssid 111
[AC-wlan-view] display vap ssid 222

STA 搜索到名为“111”和“222”的无线网络,组网采用 Open-system 认证,用户不需要输入密码。用户关联到无线网络上后,无线 PC 能够被分配相应的 IP 地址。在 AC 上执行 display station ssid ly 命令,可以查看到已经接入到无线网络中的用户。

1
2
[AC-wlan-view] display station ssid 111
[AC-wlan-view] display station ssid 222

测试STA1、STA2和外网的连通性。由于路由器未知10.0.0.0和20.0.0.0网段的路由信息,需在R1上配置路由协议。

1
2
3
4
5
6
[Router]ip route-static 10.0.0.0 24 11.0.0.2
[Router]ip route-static 20.0.0.0 24 11.0.0.2
[Router]dislay ip routing-table

STA1-> ping 11.0.0.1
STA2-> ping 11.0.0.1
  • 标题: 对比基于旁挂式直接转发和数据隧道转发的无线网络搭建
  • 作者: Clevebitr
  • 创建于 : 2025-04-17 22:44:26
  • 更新于 : 2025-04-18 21:22:39
  • 链接: https://blog.clevebitr.dpdns.org/2025/04/17/对比基于旁挂式直接转发和数据隧道转发的无线网络搭建/
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
目录
对比基于旁挂式直接转发和数据隧道转发的无线网络搭建