Overview
Supported Features
The networking 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. Buffer management keeps copies to a minimum: the stack avoids copying application data on the transmit path.
Link Layer
Ethernet, IEEE 802.3
Wi-Fi, IEEE 802.11
IEEE 802.15.4 and 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.
Offloaded network devices, such as Wi-Fi and cellular modems that run their own IP stack, through network offloading or socket offloading.
Several technologies can be enabled at the same time. Each packet is sent on the interface that matches its destination, or on the default interface if none does, unless the socket is bound to an interface. Packets are forwarded between interfaces only when IPv4 or IPv6 forwarding or Ethernet bridging is enabled.
Ethernet and TSN
Virtual LANs partition physical Ethernet networks into logical networks.
Bridging of Ethernet interfaces, with a forwarding database that learns addresses and the Rapid Spanning Tree Protocol (RSTP). Sample: bridge.
Distributed Switch Architecture (DSA) for Ethernet switches. Sample: DSA (Distributed Switch Architecture).
LLDP (Link Layer Discovery Protocol). Sample: Link Layer Discovery Protocol (LLDP).
Traffic classification prioritizes sent and received packets.
Time Sensitive Networking with gPTP (generalized Precision Time Protocol), PTP (IEEE 1588) and configuration of IEEE 802.1Qav credit-based shapers.
Network Layer
IPv6 (RFC 8200)
Static addresses or SLAAC (Stateless Address Autoconfiguration, RFC 4862), with a configurable number of addresses and prefixes.
Neighbor Discovery (RFC 4861) with an optional neighbor cache, and Multicast Listener Discovery v2 (RFC 3810).
6LoWPAN (RFC 4944) for IEEE 802.15.4 networks, with IPHC header compression (RFC 6282) and fragmentation.
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).
Route table, forwarding between interfaces with
CONFIG_NET_IPV6_FORWARDING, and multicast routing and forwarding.
IPv4 (RFC 791). Not available on IEEE 802.15.4, which is IPv6 only.
Static addresses, link-local address autoconfiguration (RFC 3927) and address conflict detection (RFC 5227). Sample: IPv4 autoconf client.
Fragmentation and Path MTU Discovery (RFC 1191).
Route table, and forwarding between interfaces with
CONFIG_NET_IPV4_FORWARDING.NAT (Network Address Translation): source NAT (masquerading) of forwarded packets that match iptables-like rules, with connection tracking that translates the replies back.
IPv6 and IPv4 can be used at the same time (dual-stack).
Filtering and tunneling
Packet filtering of sent and received packets with rules.
WireGuard VPN (WireGuard protocol). Sample: Wireguard VPN.
IP-in-IP tunnels on virtual network interfaces. Sample: Virtual network interface.
Transport and Sockets
UDP (RFC 768) and UDP options (RFC 9868), with 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, and window scaling (RFC 7323) withCONFIG_NET_TCP_WINDOW_SCALE.QUIC (RFC 9000) with integrated TLS 1.3 (RFC 9001). See QUIC. Samples: Echo client (QUIC), Echo server (QUIC).
BSD sockets, a subset of the BSD sockets API: blocking and non-blocking datagram (UDP), stream (TCP) and packet (
AF_PACKET) sockets.TLS and DTLS sockets backed by Mbed TLS. See secure sockets. A device can generate its own private key and certificate signing request, see TLS credentials. Sample: TLS on-device key generation.
Application Protocols
The protocol name links to its documentation, when there is one.
Protocol |
Standard |
Role |
Samples |
|---|---|---|---|
client, server |
|||
resolver |
|||
resolver, responder |
|||
LLMNR (deprecated) |
resolver, responder |
||
client |
|||
HTTP |
|||
client |
|||
MCP (Model Context Protocol) |
2025-11-25 |
server |
|
MIDI 2.0 |
Network UDP transport |
endpoint host |
|
3.1.1, 5.0 |
client |
||
1.2 |
client |
||
OCPP (Open Charge Point Protocol) |
1.6 |
charge point |
|
Prometheus |
metrics server |
||
RTP (Real-time Transport Protocol), SRTP |
source, sink |
||
client, server |
|||
client |
|||
SSH |
client, server (shell, exec and subsystem channels), shell backend |
||
message codec |
|||
client |
|||
client, HTTP server upgrade |
Management
Network management API to receive events from the network stack, for example when an IP address is added or an interface comes up.
Connection Manager to monitor IP connectivity and control network association through one API, whatever the network technology.
Network configuration library to set up network interfaces at boot from Kconfig options.
Wi-Fi management API to scan for and connect to networks, and Wi-Fi network managers that register with the Wi-Fi stack to implement it.
Diagnostics
Network shell to inspect network status, enable or disable features and run commands such as ping or DNS queries.
zperf network performance and bandwidth measurement, client and server, compatible with iPerf v2 and iperf3. Sample: zperf: Network Traffic Generator.
Packet capture of network traffic to a remote host for analysis.
Network statistics, collected for the whole stack and per interface. Sample: Network statistics.
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).