skip to content

In CAPWAP, what do the control channel on UDP 5246 and the data channel on UDP 5247 carry, and which is protected by DTLS?

level: middleimportance: must knowfreq 34%

answer

  1. two flows, two ports
  2. the WTP opens toward the AC
  3. discovery travels in the clear
  4. data DTLS is a capability
  5. the next consecutive port

basics

~20 s

CAPWAP's control channel, UDP 5246 at the controller, carries join, configuration, firmware and station management inside DTLS; only discovery messages go in the clear. The data channel, UDP 5247, carries tunnelled frames, and DTLS on it is optional.

solid answer

~50 s

CAPWAP (RFC 5415) runs two UDP flows between the AP, the **WTP**, and the controller, the **AC**. The **control channel** to the AC's well-known port `5246` carries management messages: join, configuration, firmware download, adding and removing stations, statistics and echo keep-alives. It is protected by **DTLS**, except the Discovery Request and Discovery Response, which must travel in the clear. The **data channel** to `5247` carries the 802.11 or 802.3 frames being tunnelled, plus keep-alives that bind it to the control session; DTLS on it is an **optional** capability the AC advertises. Because the WTP opens both flows, it can sit behind NAT, and if the AC's control port is changed the data port must be the next consecutive number. In a review, an unencrypted data channel over an untrusted network matters: in Local MAC the AP has already removed 802.11 encryption, so the tunnelled frames are readable.

code

pseudocode · 11 lines
pseudocode
WTP -> AC   Discovery Request          (clear text; optional if AC is pre-configured)
AC  -> WTP  Discovery Response         (clear text)
WTP <-> AC  DTLS handshake on UDP 5246 (mutual auth: certificates or pre-shared key)
WTP -> AC   Join Request               (inside DTLS)
AC  -> WTP  Join Response              (names the expected firmware image)
if image differs: Image Data download (unless already stored), WTP resets, starts again
WTP <-> AC  Configuration Status Request / Response
WTP <-> AC  Change State Event Request / Response  -> WTP enters Run
WTP -> AC   Data Channel Keep-Alive on UDP 5247 (DTLS only if negotiated)
AC          enters Run when the keep-alive arrives, and echoes it back
Run: Echo Request when EchoInterval (default 30 s) expires; keep-alive on the data channel

go deeper

for a junior

Remember that CAPWAP uses two UDP ports at the controller, 5246 for control and 5247 for data, and that the AP starts the session.

for a middle

Explain what each channel carries, that control is always inside DTLS apart from discovery, and that data-channel DTLS is an optional capability.

for a senior

Show how you would troubleshoot an AP that joins but never passes traffic, and when an unencrypted data channel exposes decrypted user frames.

for a principal

Set the policy for data-channel encryption and AP-to-controller paths across sites, weighing tunnel overhead against traffic crossing untrusted networks.

## Two roles and two flows **CAPWAP** (Control And Provisioning of Wireless Access Points, RFC 5415) is the IETF protocol a controller uses to run a fleet of APs; RFC 5416 binds it to IEEE 802.11. The AP is the **Wireless Termination Point (WTP)** and the controller the **Access Controller (AC)**. The WTP always starts the conversation as a UDP client toward the AC's well-known ports, which is why a WTP can sit behind NAT or a firewall. | | Control channel | Data channel | |---|---|---| | Port at the AC | UDP `5246` (well known) | UDP `5247`, or control port + 1 if the control port is changed | | Port at the WTP | Any port the WTP picks | Any port the WTP picks | | Carries | CAPWAP control messages | Tunnelled wireless or 802.3 frames, keep-alives | | DTLS | Always, except Discovery Request and Response | Optional, advertised by the AC | Over IPv6 the data channel may use UDP-Lite, which RFC 5415 makes its default there unless a middlebox is detected; the control channel always uses UDP. ## What the control channel carries The control channel is a lock-step command and response protocol with retransmission and back-off. Its messages include: - **Discovery Request and Discovery Response**, the only two CAPWAP messages never protected by DTLS, because they are exchanged before any session exists, often to a broadcast or multicast address. - **Join Request and Join Response**, after the DTLS handshake, in which the WTP and AC agree versions and the AC names the firmware image it expects. - **Image Data** messages, used to download firmware when the WTP's running image differs. - **Configuration Status** and **Change State Event** exchanges that provision the WTP and move it toward the Run state. - **Echo Request** keep-alives, sent by the WTP when its `EchoInterval` timer (30 seconds by default) expires; the timer restarts whenever the WTP sends a request. - Station and WLAN management: adding and deleting stations and WLANs, delivering a station's session key, and radio settings such as the binding's **IEEE 802.11 Tx Power** element. - Statistics and alarms, plus a **Vendor Specific Payload** element that implementations use for anything the standard does not define. ## What the data channel carries The data channel carries **CAPWAP Data messages**, which encapsulate forwarded frames: - user frames in **802.11 format** (Split MAC) or in **802.3 format** (Local MAC with tunnelling enabled, which RFC 5415 requires to use 802.3 framing for user data); - 802.11 management frames the AC must process, which RFC 5416 says are always carried in 802.11 tunnel format; - **Data Channel Keep-Alive** packets, sent every 30 seconds by default, which bind the data channel to the control session and prove it still works. A WLAN that is **locally bridged** puts no user traffic on the data channel at all; the channel still exists for keep-alives and forwarded management frames. ## What DTLS protects, and what it does not DTLS gives the CAPWAP session **mutual authentication** (X.509 certificates or pre-shared keys provisioned in advance), integrity, anti-replay and confidentiality. RFC 5418, the threat analysis for 802.11 deployments, concludes that DTLS on **both** channels mitigates nearly all the risks of splitting the AP in two. - The control channel always uses DTLS, so configuration and the station session keys the AC sends to the WTP are protected. - Discovery is in the clear, so a WTP may hear an answer from the wrong AC; the mutually authenticated DTLS handshake and the AC's authorization of the WTP are what stop it joining an impostor. - Data-channel DTLS is optional. The AC Descriptor element advertises whether the AC supports a DTLS data channel, a clear-text one, or both. - An AC must not start a data-channel DTLS session without an active control session, and RFC 5415 recommends TLS session resumption so the data channel does not repeat the full handshake. The decision that matters in a review: in **Local MAC** the WTP performs 802.11 encryption and decryption, so frames entering the data channel are **already decrypted**. If that tunnel crosses a network you do not trust and data-channel DTLS is off, user traffic travels readable. ## Operating it 1. **Firewalls:** permit UDP `5246` **and** `5247` from AP subnets to the AC. Opening only the control port lets the AP join, but the AC never reaches Run: it waits for a Data Channel Keep-Alive and gives up, and the AP tears the session down when its own keep-alives go unanswered. 2. **Discovery:** a WTP can use a static address, DHCP (RFC 5417), a DNS SRV lookup such as `_capwap-control._udp.example.com`, the limited broadcast address or the CAPWAP multicast address `224.0.1.140`. 3. **MTU:** encapsulation adds headers, and CAPWAP fragments packets that would exceed the path MTU; check the path when large frames fail. 4. **Data-channel DTLS:** decide it per deployment, and turn it on wherever tunnels cross untrusted hops.

  • Why does CAPWAP run over UDP rather than TCP?
    The WTP initiates toward the AC's well-known port, so UDP lets it sit behind NAT or a firewall, and CAPWAP supplies its own retransmission and back-off on the control channel. RFC 5415 deliberately specifies no congestion control on the data channel, because tunnelling congestion-controlled IP traffic inside another congestion-controlled transport tends to cause more problems than it solves.
  • An AP joins its controller but keeps dropping back to discovery. What does CAPWAP suggest you check first?
    Whether UDP 5247 is reachable as well as 5246. After join and configuration, the WTP sends a Data Channel Keep-Alive on the data channel, and the AC enters Run only when it arrives. If a firewall drops the data port, the AC's data-check timer expires and the session is torn down, so the AP cycles. Path MTU and NAT rewriting of the WTP's data port come next.
  • Why can Discovery messages go unprotected without letting anyone take over the APs?
    Discovery only produces a list of candidate controllers. Before joining, the WTP must complete a mutually authenticated DTLS handshake using credentials provisioned in advance, and each side authorizes the other. A forged Discovery Response can at most point the WTP at a controller that then fails authentication.

  • CAPWAP control and data both share one UDP port, 5246.
  • The data channel is always DTLS-encrypted, so tunnelled traffic is safe on any network.
  • Every CAPWAP message, including discovery, is inside DTLS.
  • The controller initiates the CAPWAP session to each AP.
  • Opening only UDP 5246 is enough for APs to carry tunnelled traffic.