交换机SW2连接AP的端口做access:
[SW2]vlan 100
[SW2-GigabitEthernet0/0/2]port link-type access
[SW2-GigabitEthernet0/0/2]port default vlan 100
交换机互联(或连接终端)的端口做trunk:
[SW2-GigabitEthernet0/0/1]port link-type trunk
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan 100
[SW1]vlan 100
[SW1-GigabitEthernet0/0/2]port link-type trunk
[SW1-GigabitEthernet0/0/2]port trunk allow-pass vlan 100
SW1的GE0/0/1接口规划为单臂路由:
[SW1-GigabitEthernet0/0/1]port link-type trunk
[SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan 100
(单臂路由是路由器接口上配置子接口连接不同VLAN)
[AR2-GigabitEthernet0/0/2.100]dot1q termination vid 100
[AR2-GigabitEthernet0/0/2.100]arp broadcast enable
[AR2-GigabitEthernet0/0/2.100]ip ad 192.168.100.254 24 AR2作为AP的网关的地址
AR1作为DHCP服务器
[DHCP]ip pool VLAN100 管理vlan
[DHCP-ip-pool-VLAN100]network 192.168.100.0 mask 24
[DHCP-ip-pool-VLAN100]gateway-list 192.168.100.254
AP获取IP地址:
AR2设备需要做DHCP中继:
[AR2]dhcp enable
[AR2-GigabitEthernet0/0/2.100]dhcp select relay
[AR2-GigabitEthernet0/0/2.100]dhcp relay server-ip 10.1.12.1
(AR请求IP流程:AP发送DHCP请求报文到网关AR2的子接口2.100,AR2做中继转发给DHCP服务器)
[DHCP]dhcp enable
[DHCP-GigabitEthernet0/0/0]dhcp select global
DHCP服务器配置静态路由到网关:
[DHCP]ip route-static 192.168.100.0 24 10.1.12.2
途径交换机创建vlan:
[SW1]vlan 100
[SW2]vlan 100
上述配置完成后,AP1获取到DHCP服务器IP地址:
AC与AR2通信(三层组网)
[AC6605]vlan 200
[AC6605-GigabitEthernet0/0/1]port link-type access
[AC6605-GigabitEthernet0/0/1]port default vlan 200
[AC6605]int Vlanif 200
[AC6605-Vlanif200]ip ad 10.1.200.1 24
[AR2-GigabitEthernet0/0/1]ip ad 10.1.200.2 24
AC和AP1发起capwap隧道连接(AP向AC发起,AC等待连接)
[AC6605]ip route-static 192.168.100.0 24 10.1.200.2 AC配置去往AP网段的静态
[AC6605]capwap source interface Vlanif 200 将Vlanif 200作为CAPWAP源接口(通过该接口发起连接)
::: warning 在地址池中设置能够发起通信的地址:
[DHCP-ip-pool-VLAN100]option 43 sub-option 3 ascii 10.1.200.1
上述命令作用是将AC的地址告知AP,AP获取到AC的地址后,才会主动向AC发起连接。 ::: SW1的GE0/0/2接口抓包,DHCP的offer报文携带了option43:
[AC6605]wlan
[AC6605-wlan-view]regulatory-domain-profile name 1
[AC6605-wlan-regulate-domain-1]country-code CN
[AC6605-wlan-view]ap-group name 1
[AC6605-wlan-ap-group-1]regulatory-domain-profile 1
[AC6605-wlan-view]ap-id 1 ap-mac 00e0-fc99-10d0 AP设备执行dis int Vlanif 1查看MAC
[AC6605-wlan-ap-1]ap-name AP1
[AC6605-wlan-ap-1]ap-group 1
上述命令执行后,可以管理到AP: AP上线同时,AP1提示capwap隧道建立成功: ::: tip AP上线后名字会变为AP的MAC地址,可以在AC中wlan——ap-id——ap-name中修改。 :::
AC其他配置
安全模板:
[AC6605]wlan
[AC6605-wlan-view]security-profile name 1
[AC6605-wlan-sec-prof-1]security wpa-wpa2 psk pass-phrase Huawei@123 aes 设置密码
SSID模板:
[AC6605-wlan-view]ssid-profile name 1
[AC6605-wlan-ssid-prof-1]ssid Huawei 设置信号名称
VAP模板:
[AC6605-wlan-view]vap-profile name 1
[AC6605-wlan-vap-prof-1]ssid-profile 1 关联SSID模板
[AC6605-wlan-vap-prof-1]security-profile 1 关联安全模板
[AC6605-wlan-vap-prof-1]service-vlan vlan-id 10 设置服务vlan-id
[AC6605-wlan-vap-prof-1]forward-mode tunnel 设置转发模式
[AC6605-wlan-view]ap-group name 1
[AC6605-wlan-ap-group-1]vap-profile 1 wlan 1 radio 0 将VAP模板关联到ap-group
上述命令执行完毕后,AP可以发出信号。 ::: tip 转发模式: AP下有用户接入时,如果使用隧道的转发模式,会直接通过隧道从AP转发到AC上,AC帮助转发到网关,中间途径的设备如SW2、SW1不需要放行业务vlan。如果使用直连的转发模式,必须在途径交换机SW3、SW1上相应接口放行业务vlan。 :::
将PC放在AP1信号范围下,但此时无法获取IP信息。 如上,终端发起请求后,由于VAP模板中服务vlan的vlan-id设为10,即AC通过capwap隧道告知AP:如果是通过SSID(HUAWEI)接入的用户,将会分配业务vlan(vlan10)。AP将DHCP发现报文封装在vlan10中,隧道模式封装管理vlan(vlan100),数据通过管理vlan向上传输。 管理vlan封装上层IP信息(S:192.168.100.253,D:10.1.200.1),到达AR2(192.168.100.253)后vlan100解封装,再根据源目IP转发到AC。 AC上需要创建vlan10,为终端用户分配地址。
由于AC和AR2只有一个接口对应且已经分配给vlan200,需要使用子接口支持vlan10。
修改AC的接口模式
[AC6605-GigabitEthernet0/0/1]undo port default vlan
[AC6605-GigabitEthernet0/0/1]undo port link-type
[AC6605-GigabitEthernet0/0/1]port link-type trunk
[AC6605-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 200
AR2全部做子接口连接
AR2上vlan200原有的IP信息转到子接口1.200
[AR2-GigabitEthernet0/0/1]undo ip ad
[AR2]int g0/0/1.200
[AR2-GigabitEthernet0/0/1.200]dot1q termination vid 200
[AR2-GigabitEthernet0/0/1.200]ip ad 10.1.200.2 24
[AR2-GigabitEthernet0/0/1.200]arp broadcast enable
AR2上vlan10原有的IP信息转到子接口1.10
[AR2]int gi 0/0/1.10
[AR2-GigabitEthernet0/0/1.10]dot1q termination vid 10
[AR2-GigabitEthernet0/0/1.10]ip ad 192.168.10.254 24 vlan10发来的终端用户数据的网关
[AR2-GigabitEthernet0/0/1.10]arp broadcast enable
DHCP做业务vlan地址池
[DHCP]ip pool VLAN10
[DHCP-ip-pool-VLAN10]gateway-list 192.168.10.254
[DHCP-ip-pool-VLAN10]network 192.168.10.0 mask 24
AR2相应子接口开启DHCP中继
[AR2-GigabitEthernet0/0/1.10]dhcp select relay
[AR2-GigabitEthernet0/0/1.10]dhcp relay server-ip 10.1.12.1
此时终端用户可以获取到IP信息: ::: warning AC的GE0/0/1口从access模式改为trunk模式后,需要对端路由器使用子接口进行连接。 路由器不能处理vlan标签,需要使用单臂路由中的dot1q协议剥离vlan标签,即使用子接口,否则对端端口模式必须为access或hybrid。 ::: ::: tip 终端获取IP流程: :::
上述AP1使用隧道模式转发,下面AP2使用直连模式转发。
[SW1-GigabitEthernet0/0/3]port link-type trunk
[SW1-GigabitEthernet0/0/3]port trunk allow-pass vlan 100
[SW3]vlan 100
[SW3-GigabitEthernet0/0/1]port link-type trunk
[SW3-GigabitEthernet0/0/1]port trunk allow-pass vlan 100
直连转发时,SW3的GE0/0/2口需要转发管理vlan和业务vlan:
[SW3-GigabitEthernet0/0/2]port link-type trunk
[SW3-GigabitEthernet0/0/2]port trunk pvid vlan 100
[SW3-GigabitEthernet0/0/2]port trunk allow-pass vlan 100
上述SW1和SW3建立连接后,SW3可以将AP2的DHCP discover报文上传到(DHCP服务器)AR1获取IP地址: 此时将AP2加入AC的ap-group组中就可以实现AP2上线。
[AC6605]wlan
[AC6605-wlan-view]ap-id 2 ap-mac 00e0-fc92-07c0
[AC6605-wlan-ap-2]ap-name AP2
[AC6605-wlan-ap-2]ap-group name 2
AC可以管理到两台AP:
AC给AP2下发配置(模板):
[AC6605]wlan
[AC6605-wlan-view]ssid-profile name 2
[AC6605-wlan-ssid-prof-2]ssid ADMIN
[AC6605-wlan-view]vap-profile name 2
[AC6605-wlan-vap-prof-2]security-profile 1 认证模板和AP1保持一致
[AC6605-wlan-vap-prof-2]ssid-profile 2
[AC6605-wlan-vap-prof-2]service-vlan vlan-id 20 终端设备加入vlan20
[AC6605-wlan-vap-prof-2]forward-mode direct-forward 默认是直连转发
[AC6605-wlan-view]ap-group name 2
[AC6605-wlan-ap-group-2]regulatory-domain-profile 1
[AC6605-wlan-ap-group-2]vap-profile 2 wlan 2 radio 0
::: warning 如果将AP2加入ap-group1,AP2会发射出和AP1的SSID相同的“HUAWEI”信号。 ::: AP2通过直连转发时,直接将报文转发到上层设备,不需要封装vlan100。
[SW3]vlan 20
[SW3-GigabitEthernet0/0/1]p t a v 20
[SW3-GigabitEthernet0/0/2]p t a v 20
[SW1]vlan 20
[SW1-GigabitEthernet0/0/1]p t a v 20
[SW1-GigabitEthernet0/0/3]p t a v 20
AR2需要使用子接口对应vlan20:
[AR2]int gi 0/0/2.20
[AR2-GigabitEthernet0/0/2.20]ip ad 192.168.20.254 24
[AR2-GigabitEthernet0/0/2.20]dot1q termination vid 20
[AR2-GigabitEthernet0/0/2.20]arp broadcast enable
[AR2-GigabitEthernet0/0/2.20]dhcp select relay
[AR2-GigabitEthernet0/0/2.20]dhcp relay server-ip 10.1.12.1
[DHCP-ip-pool-VLAN.20]ip pool VLAN20
[DHCP-ip-pool-VLAN20]gateway-list 192.168.20.254
[DHCP-ip-pool-VLAN20]network 192.168.20.0 mask 24
[DHCP]ip rou 192.168.20.0 24 10.1.12.2
两台终端设备也可以进行通信: