WLAN网络中的报文分为管理报文(控制报文)和数据报文(业务报文)。管理报文通过CAPWAP的控制隧道进行转发;用户数据报文则根据是否通过CAPWAP的数据隧道转发分为隧道转发(又称为“集中转发”)方式、直接转发(又称为“本地转发”)方式和Soft-GRE转发方式。
隧道转发方式是指用户的数据报文到达AP后,需要经过CAPWAP数据隧道封装后发送给AC,然后由AC再转发到上层网络,如图所示。

隧道转发
直接转发方式是指用户的数据报文到达AP后,不经过CAPWAP的隧道封装而直接转发到上层网络,如图1-2所示。

表1-1 隧道转发与直接转发的优缺点
| 数据转发方式 | 优点 | 缺点 |
|---|---|---|
| 隧道转发 | AC集中转发数据报文,安全性好,方便集中管理和控制,新增设备部署配置方便,对现网改动小。 | 业务数据必须经过AC转发,报文转发效率比直接转发方式低,AC所受压力大。 |
| 直接转发 | 业务数据不需要经过AC转发,报文转发效率高,AC所受压力小。 | 业务数据不便于集中管理和控制,新增设备部署对现网改动大。 |
配置调整原则
直接转发和隧道转发之间的配置调整,除了VAP下的转发方式的配置调整外,最主要的就是各接口下管理VLAN和业务VLAN的配置调整。
- 直接转发方式下,建议管理VLAN和业务VLAN分别使用不同的VLAN,否则可能导致业务不通。例如,业务VLAN如果和管理VLAN相同,且交换机连接AP的端口配置了PVID为管理VLAN,则下行到用户的报文出连接AP的交换机时业务VLAN会被终结,从而导致业务不通。
- 隧道转发方式下,管理VLAN和业务VLAN不能配置为同一VLAN,否则会导致MAC漂移,报文转发出错。并且AP和AC之间只能放通管理VLAN,不能放通业务VLAN。
实验拓扑


sw1 配置
vlan batch 100 to 105
#
stp disable
interface Vlanif100
ip address 10.1.100.1 255.255.255.0
dhcp select relay
dhcp relay server-ip 10.1.102.2
#
interface Vlanif101
#
interface Vlanif102
ip address 10.1.102.1 255.255.255.0
#
interface Vlanif103
ip address 10.1.103.1 255.255.255.0
dhcp select relay
dhcp relay server-ip 10.1.102.2
#
interface Vlanif104
ip address 10.1.104.1 255.255.255.0
dhcp select relay
dhcp relay server-ip 10.1.102.2
#
interface Vlanif105
ip address 10.1.105.1 255.255.255.0
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 100 // 和AC 相连的接口只允许管理vlan通过
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 105
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 100 to 105 //允许业务vlanc通
#
interface GigabitEthernet0/0/4
port link-type access
port default vlan 102
ip route-static 0.0.0.0 0.0.0.0 10.1.105.2
Sw2配置
vlan batch 100 103 to 104
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 100 to 105
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk pvid vlan 100
port trunk allow-pass vlan 100 to 105
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 104
stp edged-port enable
#
interface GigabitEthernet0/0/4
port link-type trunk
port trunk pvid vlan 100
port trunk allow-pass vlan 100 to 105
【思考1】:如果 为隧道转发为什么SW2只创建VLAN100,不用创建VLAN103,104?
解析:因为我们用的是隧道转发,数据到达AC1后,才会打上103,104标记然后发给LSW1
【思考2】:为什么连接AP的接口要打port trunk pvid vlan 100?
解析:交换机收到AP的数据帧打上100的tag发送,把带上100tag的数据帧去掉然后发给AP
AC 配置
vlan batch 100
interface Vlanif100
ip address 10.1.100.2 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 100 //如果为隧道转发要加上业务vlan ID,业务vlan 要通过AC 转发
第一步 创建AP 组
wlan
ap-group apgoup01
第二步 创建管理模板并关联到AP 组
wlan
regulatory-domain-profile name profile01 //创建域管理模板,名字叫profile01
country-code cn //国家代码选择中国
ap-group name apgroup01
regulatory-domain-profile profile01 //AP组的域管理模板是profile01
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的接口源地址
[AC1]capwap source interface Vlanif 100 //AC的接口源地址为VLAN100
第四步:离线导入AP
wlan
ap auth-mode mac-auth //AP的认证模式为MAC认证
ap-id 1 ap-mac 00e0-fc94-4640 //AP的编号和MAC地址
ap-name AP1 //AP的名字为ds
ap-group apgroup01 //AP属于AP组x
ap-id 2 ap-mac 00e0-fc19-42c0 //AP的编号和MAC地址
ap-name AP2 //Ap的名字
ap-group apgroup01 //AP属于AP组x
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 c
ontinue? [Y/N]:y
思考:AP的MAC地址是怎么知道的?
读者可以通过在ap上使用命令“display interface Vlanif 1”查看当前ap的mac地址,然后再将mac地址进行绑定。

第五步:配置VLAN业务参数
第1步:创建安全模板
wlan
security-profile name secprofile01 //安全模板的名字叫secprofile01
security wpa-wpa2 psk pass-phrase huawei@123 aes //密码是huawei@123,用AES加密。
quit
第2步:创建SSID模板
wlan
ssid-profile name ssidprofile01 //ssid的模板名字叫ssidprofile01
ssid wifi01 //ssid的名称叫wifi01
quit
第3步:创建VAP模板
wlan
vap-profile name vapprofile01 //vap模板的名字叫vapprofile01
forward-mode direct-forward //转发模式为隧道
service-vlan vlan-id 103 //服务的VLAN为103
security-profile secprofile01//调用安全模板secprofile01
ssid-profile ssidprofile01 //调用SSID模板ssidprofile01
quit
第4步:在AP组里面调用VAP模板
[AC1-wlan-view]ap-group name x
[AC1-wlan-ap-group-x]vap-profile vapprofile01 wlan 1 radio 0 //调用VAP模板
[AC1-wlan-ap-group-x]vap-profile y wlan 1 radio 1 //
思考:radio0 1 2 是什么意思?
DHCP Server 配置
vlan batch 100 to 105
#
stp disable
dhcp enable
#
ip pool vlan103
gateway-list 10.1.103.1
network 10.1.103.0 mask 255.255.255.0
#
ip pool vlan104
gateway-list 10.1.104.1
network 10.1.104.0 mask 255.255.255.0
#
ip pool vlan100
gateway-list 10.1.100.2
network 10.1.100.0 mask 255.255.255.0
option 43 sub-option 2 ip-address 10.1.100.2
interface Vlanif100
dhcp select global
#
interface Vlanif103
dhcp select global
#
interface Vlanif104
dhcp select global
interface GigabitEthernet0/0/0
ip address 10.1.102.2 255.255.255.0
dhcp select global
ip route-static 0.0.0.0 0.0.0.0 10.1.102.1








