Overview

Supported Features

The networking IP stack is modular and configured at build time. Enable only the features your application needs to minimize memory use; almost all of them can be disabled.

  • IPv6 (RFC 8200), with build-time configurable sub-features:

    • Number of unicast and multicast addresses active at the same time.

    • Static addresses or SLAAC (Stateless Address Autoconfiguration, RFC 4862).

    • Multiple prefixes, up to a configurable maximum.

    • Optional neighbor cache of configurable size.

    • Neighbor Discovery (RFC 4861) and Multicast Listener Discovery v2 (RFC 3810), enabled by default.

    • 6LoWPAN header compression for IEEE 802.15.4 networks (RFC 4944).

    • DHCPv6 (RFC 8415) client and server, including prefix delegation. See DHCPv6.

    • DNS server addresses from Router Advertisements (RDNSS, RFC 8106).

    • Privacy extensions (RFC 8981).

    • Fragmentation and Path MTU Discovery (RFC 8201).

    • Multicast routing and forwarding.

  • IPv4 (RFC 791), for example on Ethernet, Wi-Fi and cellular networks. IEEE 802.15.4 is IPv6 only.

    • DHCPv4 (RFC 2131) client and server. See DHCPv4.

    • Static addresses, enabled by default.

    • Link-local address autoconfiguration (RFC 3927) and address conflict detection (RFC 5227). Sample: IPv4 autoconf client.

    • IGMPv2 (RFC 2236) and IGMPv3 (RFC 3376).

    • Fragmentation and Path MTU Discovery (RFC 1191).

    • NAT (Network Address Translation): SNAT and DNAT between interfaces, with connection tracking and iptables-like rules to filter and forward packets across subnets.

  • Dual stack. IPv6 and IPv4 can be used at the same time.

  • UDP (RFC 768), for sending datagrams and listening on a port, and UDP options (RFC 9868). Datagram Packetization Layer Path MTU Discovery (DPLPMTUD, RFC 8899) for UDP-based protocols, and for plain UDP sockets through UDP options (RFC 9869). See DPLPMTUD.

  • TCP (RFC 9293), client and server, with a build-time configurable number of sockets. Selective acknowledgment (RFC 2018) of received data with CONFIG_NET_TCP_SACK.

  • QUIC (RFC 9000) with integrated TLS 1.3 (RFC 9001). See QUIC. Samples: Echo client (QUIC), Echo server (QUIC).

  • BSD Sockets API, a subset of the BSD sockets API: blocking and non-blocking datagram (UDP) and stream (TCP) sockets, and packet sockets (AF_PACKET).

  • Secure Sockets API, TLS and DTLS for the sockets API, backed by Mbed TLS. See secure sockets.

  • MQTT (ISO/IEC PRF 20922) versions 3.1.1 and 5.0. Sample: MQTT publisher.

  • MQTT-SN version 1.2. Sample: MQTT-SN publisher.

  • CoAP (RFC 7252), with block-wise transfers (RFC 7959), resource observation (RFC 7641), OSCORE (RFC 8613), and CoAP over TCP and TLS (RFC 8323) for the client. Samples: CoAP client, CoAP service.

  • LwM2M OMA Lightweight Machine-to-Machine Protocol (LwM2M specification 1.0.2, and LwM2M specification 1.1.1 through a Kconfig option): Bootstrap, Client Registration, Device Management & Service Enablement and Information Reporting interfaces, the required core objects and several IPSO Smart Objects. Sample: LwM2M client.

  • HTTP client for HTTP/1.1 (RFC 2616) and server for HTTP/1.1, HTTP/2 (RFC 9113) and HTTP/3 (RFC 9114). Samples: HTTP Client, HTTP Server.

  • Websocket (RFC 6455) client, and Websocket upgrade in the HTTP server. Sample: WebSocket Client.

  • DNS (RFC 1035) resolver for IPv4 (A) and IPv6 (AAAA) records, multicast DNS (mDNS, RFC 6762), DNS Service Discovery (DNS-SD, RFC 6763) and the deprecated LLMNR (RFC 4795). An mDNS responder answers queries and advertises DNS-SD services. Sample: mDNS responder.

  • Network Management API to receive events from the network stack, for example when an IP address is added or an interface comes up.

  • Wi-Fi Management API to manage Wi-Fi interfaces, for example to scan for and connect to networks.

  • Wi-Fi Network Manager API for network managers that register with the Wi-Fi stack and implement the Wi-Fi Management API.

  • Multiple network technologies, such as Ethernet, Wi-Fi and IEEE 802.15.4, enabled at the same time in Kconfig. No automatic routing is done between them; applications send data to the interface they choose.

  • Minimal copy buffer management. The stack avoids copying application data on the transmit path.

  • Virtual LANs partition physical Ethernet networks into logical networks. See VLAN.

  • Traffic classification prioritizes sent and received packets. See traffic classification.

  • Time Sensitive Networking with gPTP (generalized Precision Time Protocol) and PTP (IEEE 1588). See gPTP and PTP.

  • SNTP (RFC 5905) client and server. See SNTP. Samples: SNTP client, SNTP server.

  • SOCKS5 proxy (RFC 1928).

  • TFTP (RFC 1350) client. Sample: TFTP client.

  • FTP (RFC 959) client. See FTP client. Sample: FTP client shell sample.

  • SSH SSH-2 (RFC 4251 to RFC 4254) server and client. Session channels carry shell, exec and subsystem requests, and the Zephyr shell is available over SSH. Sample: SSH server and client.

  • WireGuard VPN (WireGuard protocol). Sample: Wireguard VPN.

  • RTP Real-time Transport Protocol (RFC 3550). Sample: RTP.

  • MIDI2 MIDI 2.0 UDP network transport. Sample: MIDI2 network transport.

  • OCPP Open Charge Point Protocol. Sample: OCPP charge point.

  • Prometheus metrics server. Sample: Prometheus Sample.

  • MCP Model Context Protocol server, exposing device tools that AI agents discover and invoke over HTTP. See MCP server. Sample: MCP Server Hello World.

  • Packet filtering and capture. Filter sent and received packets with rules, and capture traffic to a remote host for analysis. See packet filtering and network packet capture.

  • Network shell to inspect network status, enable or disable features and run commands such as ping or DNS queries. See network shell.

  • zperf network performance and bandwidth measurement tool, client and server, compatible with iPerf v2 and iperf3. Sample: zperf: Network Traffic Generator.

Supported network technologies (link layers):

  • IEEE 802.15.4

  • Ethernet, IEEE 802.3

  • Wi-Fi, IEEE 802.11

  • Cellular / PPP (RFC 1661)

  • Thread (samples: OpenThread)

  • CAN bus for SocketCAN

  • SLIP (IP over serial line), used to connect QEMU targets to the host as an Ethernet interface so that host applications can exchange data with Zephyr.

Source Tree Layout

The networking stack source code tree is organized as follows:

subsys/net/

Various optional network stack components like connection manager, packet filter code and hostname handling are located here.

subsys/net/ip/

This is where the core network stack code is located.

subsys/net/l2

This is where the IP stack layer 2 code is located. This includes generic support for Ethernet, IEEE 802.15.4 and Wi-Fi.

subsys/net/lib/

Application-level protocols (DNS, MQTT, etc.) and additional stack components (BSD Sockets, etc.).

include/zephyr/net/

Public API header files. These are the header files applications need to include to use IP networking functionality.

samples/net/

Sample networking code. This is a good reference to get started with network application development.

tests/net/

Test applications. These applications are used to verify the functionality of the IP stack, but are not the best source for sample code (see samples/net/ instead).