lwIP
startFeatures
-
Dual-stack IPv4 and IPv6 support with packet forwarding over multiple network interfaces.
-
Full TCP implementation featuring congestion control, RTT estimation, fast recovery, and fast retransmit.
-
UDP and experimental UDP-lite extensions for low-overhead transport.
-
ICMP and ICMPv6 support for network maintenance and diagnostic functions.
-
IGMP and MLDv1 support for managing multicast traffic and listener discovery.
-
Neighbor Discovery (ND) and stateless address autoconfiguration for IPv6 compliance (RFC 4861/4862).
-
Comprehensive IP addressing via DHCP, DHCPv6, AutoIP/APIPA (Zeroconf), and Address Conflict Detection (ACD).
-
DNS client including support for mDNS (Multicast DNS) responder.
-
Layered TCP (altcp) abstraction for transparent TLS integration, typically ported to mbedTLS.
-
Point-to-Point Protocol support including PPPoS (over Serial) and PPPoE (over Ethernet).
-
6LoWPAN adaptation layer for low-power wireless networks like IEEE 802.15.4 and BLE.
-
Integrated HTTP/HTTPS server with support for Server Side Includes (SSI) and CGI.
-
SNMPv2c/v3 agent with an included MIB compiler for network management.
-
MQTT client with optional TLS encryption for secure IoT messaging.
-
SNTP (Simple Network Time Protocol) implementation for clock synchronization.
-
NetBIOS name service responder and iPerf server for network performance testing.
Architecture
lwIP is designed with a modular architecture that balances the need for a layered protocol stack with the performance requirements of resource-constrained hardware. The core stack is contained within the src directory, while platform-specific ports and optional applications reside in the contrib directory. A central feature of its architecture is the pbuf (packet buffer) structure, which allows for zero-copy data handling as packets move through the various layers of the stack, significantly reducing CPU and memory overhead.
To accommodate different system designs, lwIP provides three distinct Application Programming Interfaces (APIs):
- Raw API: A callback-based, event-driven interface that provides the highest performance and lowest memory footprint by running directly in the TCP/IP thread.
- Netconn API: A sequential, thread-safe API that requires an operating system (RTOS) and provides a simplified programming model.
- Socket API: A BSD-compatible socket layer built on top of the Netconn API, facilitating the porting of existing standard networking code.
Use Cases
This library is ideal for:
- IoT End-Nodes: Small, battery-powered sensors using 6LoWPAN or BLE to communicate with gateways.
- Industrial Automation: PLCs and industrial controllers requiring reliable TCP/IP communication for Modbus/TCP or Ethernet/IP protocols.
- Embedded Web Servers: Devices providing local configuration or monitoring dashboards via HTTP or HTTPS.
- Network Gateways: Systems bridging traffic between different physical layers, such as Ethernet to Serial (PPP) or WiFi to 6LoWPAN.
- Resource-Constrained Systems: Microcontrollers with limited RAM (e.g., 20KB-50KB) that still require a full-featured, standards-compliant network stack.
Getting Started
Developers can begin by exploring the src directory for the core protocol implementations and the contrib directory for existing ports to various hardware and operating systems. The stack requires a header file named lwipopts.h to be defined by the user, which configures the stack’s features and memory limits at compile-time. For systems using an RTOS, a system abstraction layer (sys_arch) must be implemented to handle threading and synchronization. Comprehensive self-documentation extracted from the source code is available at the official lwIP documentation site, and development is centrally managed via the Savannah Git repository.
Related Projects (35)
Advanced Operating System 2017 (SOS)
A comprehensive implementation of a Simple Operating System (SOS) built on the seL4 microkernel for the UNSW Advanced Operating Systems course. It features a process server, network stack integration via lwIP, and a custom shell, primarily targeting the i.MX6 ARM platform.
Arduino-Pico
A high-performance Arduino core for Raspberry Pi RP2040 and RP2350 microcontrollers, supporting both ARM and RISC-V architectures. It integrates the Raspberry Pi Pico SDK with FreeRTOS SMP support and provides advanced features like multicore processing, PIO-based peripherals, and integrated SSL/TLS.
AsyncESP32_SC_Ethernet_Manager
An asynchronous Ethernet connection manager for ESP32-S2/S3/C3 microcontrollers. It utilizes the LwIP stack with W5500 or ENC28J60 controllers to provide a web-based configuration portal for managing network credentials and static IP settings at runtime.
AsyncESP8266_ENC_Manager
A high-performance asynchronous connection and credentials manager for ESP8266 boards using the ENC28J60 Ethernet controller. It provides a fallback web configuration portal for runtime setup of DHCP/Static IP settings, hostnames, and custom application parameters stored in LittleFS or SPIFFS.
AsyncESP8266_W5500_Manager
A comprehensive connection and credentials manager for ESP8266 boards equipped with W5500 Ethernet shields. It features an asynchronous web configuration portal for runtime network setup, supporting DHCP, static IP, and custom parameters stored via LittleFS or SPIFFS.
AsyncHTTPRequest_ESP32_Ethernet
An asynchronous HTTP client library for ESP32-based microcontrollers using LwIP Ethernet controllers like W5500, W6100, and ENC28J60. It provides a non-blocking interface for REST communication, similar to JavaScript's XMLHttpRequest, and relies on the AsyncTCP library for efficient networking.
AsyncHTTPRequest_RP2040W Library
An asynchronous HTTP request library specifically designed for the Raspberry Pi Pico W using the CYW43439 WiFi chip. It provides a subset of HTTP methods including GET, POST, and PUT, relying on the AsyncTCP_RP2040W library to facilitate non-blocking REST communication.
AsyncESP8266_W5100_Manager
An asynchronous Ethernet credentials and connection manager for ESP8266 boards using Wiznet W5100 or W5100S controllers. It provides a fallback web configuration portal for setting static or DHCP IP addresses, hostnames, and custom parameters at runtime using ESPAsyncWebServer.
AsyncHTTPSRequest_ESP32_Ethernet
An asynchronous HTTPS request library for ESP32-based boards using LwIP-compatible Ethernet controllers like W5500, W6100, and ENC28J60. It leverages AsyncTCP_SSL to provide a non-blocking, XMLHttpRequest-style API for efficient REST communication in embedded systems.
AsyncUDP_ESP32_Ethernet
A fully asynchronous UDP library for ESP32-based boards using LwIP with W5500, W6100, or ENC28J60 Ethernet controllers. It provides a non-blocking interface for Unicast, Broadcast, and Multicast networking, significantly improving performance over standard synchronous implementations.
AsyncHTTPSRequest_Generic
A high-performance asynchronous HTTPS request library for ESP32 and ESP8266, enabling non-blocking REST communication. It supports a wide range of network interfaces including built-in WiFi and various Ethernet controllers like W5500, W6100, and ENC28J60.
AsyncUDP_ESP32_SC_W6100
A fully asynchronous UDP library for ESP32-S2/S3/C3 microcontrollers using the W6100 Ethernet controller and LwIP. It enables non-blocking network communication for unicast, broadcast, and multicast environments, allowing for high-speed multi-connection handling.
AsyncWebServer_ESP32_SC_ENC
An asynchronous web server library specifically designed for ESP32-S2, S3, and C3 microcontrollers using the ENC28J60 Ethernet controller via the LwIP stack. It enables high-performance, non-blocking network communication, supporting concurrent connections, WebSockets, and Server-Sent Events.
AsyncWebServer_ESP32_SC_W5500
An asynchronous web server library designed for ESP32-S2/S3/C3 microcontrollers using the W5500 Ethernet controller. It leverages the LwIP stack to provide high-performance, non-blocking network handling, supporting WebSockets, EventSource, and efficient CString-based memory management.
AsyncWebServer_ESP32_W5500
A high-performance asynchronous web server library for ESP32 microcontrollers using the W5500 Ethernet controller. It leverages the LwIP stack to provide non-blocking network operations, supporting WebSockets, Server-Sent Events, and efficient memory handling for large data transfers.
ChibiOS
ChibiOS is a complete development environment for embedded applications, featuring the RT and NIL real-time kernels along with a comprehensive Hardware Abstraction Layer (HAL). It provides a scalable architecture for microcontrollers ranging from tiny 8-bit AVRs to high-performance ARM Cortex-M7 and SPC5 devices.
Chronothermostat: An AWS-Powered IoT Climate Control System
A comprehensive IoT chronothermostat system utilizing ESP32 nodes and a Raspberry Pi 3 gateway integrated with Amazon Web Services. It features multi-room temperature and humidity monitoring, remote control via MQTT, and a web-based GUI for scheduling and statistics.
D21ecm: USB CDC-ECM for SAMD21
A CDC-ECM implementation for the Microchip SAMD21 microcontroller that enables Ethernet-over-USB functionality. It integrates the lwIP stack to provide a built-in web server, DHCP server, and DNS server, allowing the device to act as a network interface for Linux, macOS, and mobile devices.
D21rndis: USB RNDIS for SAMD21
D21rndis is a USB Remote Network Driver Interface Specification (RNDIS) implementation for the Microchip SAMD21 microcontroller. It integrates the lwIP TCP/IP stack to provide a web server, DHCP server, and DNS server over a USB connection, enabling network connectivity without dedicated Ethernet hardware.
dnx RTOS
dnx RTOS is a Unix-like operating system layer built on the FreeRTOS kernel, designed for 32-bit microcontrollers. It provides a modular architecture featuring a virtual file system (VFS), a C-standard compatible program layer, and support for multiple CPU architectures including STM32 and EFR32.
ESP-Scope
ESP-Scope is a web-based oscilloscope application built on the ESP-IDF framework for ESP32 microcontrollers. It utilizes the ESP32's ADC capabilities to capture analog signals and serves a real-time visualization interface via a web browser, supporting sample rates up to 83.3 kHz.
ESP32-ENC28J60
A specialized Ethernet library for the ESP32 platform that provides driver support for the ENC28J60 SPI Ethernet controller. It leverages the standard Arduino ESP32 Ethernet API, allowing developers to use familiar networking functions with low-cost SPI Ethernet hardware.
ESP32 PPPoS Client Example
A comprehensive example project for the ESP32 that implements a Point-to-Point Protocol over Serial (PPPoS) client. It utilizes the ESP-IDF framework and lwIP stack to provide internet connectivity via GSM modules like the SIM800L, supporting HTTP, HTTPS, and SMS functionality.
ESP32 Sniffer
An ESP32-based firmware designed to capture Wi-Fi Probe Request packets sent by smartphones. Built on the ESP-IDF framework, it extracts metadata such as MAC addresses and signal strength, stores them locally using SPIFFS, and periodically uploads the data to a central server via MQTT.
ESP32_W5500_Manager
A comprehensive connection and credential manager for ESP32 boards using the W5500 Ethernet controller and LwIP. It provides a fallback web configuration portal for runtime setup of static or DHCP IP addresses, custom parameters, and NTP settings, supporting storage via LittleFS or SPIFFS.
RT-Thread ART (Arduino RT-Thread)
ART is an Arduino-compatible development platform based on the STM32F407VGT6 microcontroller running the RT-Thread RTOS. It enables the parallel execution of multiple Arduino programs by leveraging RT-Thread's application module feature while maintaining hardware and software compatibility with the Arduino ecosystem.