lwIP

start
lwIP (lightweight IP) is a widely-used, open-source TCP/IP stack designed specifically for resource-constrained embedded systems. It minimizes RAM usage while providing a full-scale TCP implementation, making it suitable for devices with only tens of kilobytes of free memory.

Features

  • 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 (287)

View All 287 Projects →
Web3 Pi UPS

Web3 Pi UPS

An open-source DC uninterruptible power supply designed specifically for the Raspberry Pi 5, featuring triple-input power paths and smart battery management. It utilizes a dual-MCU architecture with a CH32X035 for power delivery and an RP2040 for the user interface, while supporting remote monitoring via FreeRTOS and the lwIP stack.

freertos lwipplatformio-platformio-core

Xaloqi Embedded Diagnostics Suite (EDS)

A production-grade UDS diagnostic stack for Zephyr RTOS and FreeRTOS that automates ISO 14229 compliance through a YAML-driven code generation workflow. It features ASIL-B safety wrappers, ISO-TP and DoIP transport support, and comprehensive testing tools for automotive and industrial ECUs.

zephyr lwipmcuboot

WaveSight

WaveSight is an ESP32-based radar system that utilizes Wi-Fi Channel State Information (CSI) to detect human presence and movement without the need for cameras or PIR sensors. Built on the ESP-IDF framework and FreeRTOS, it features a real-time web dashboard for signal visualization, auto-calibration routines, and GPIO outputs for integration with external hardware.

freertos nimblelwip

ViewOwl

ViewOwl is an IoT platform that enables ESP32-based displays to show live data from any API using standard HTML and CSS instead of complex embedded graphics code. It features a .NET 8 backend that renders web content via a headless browser and streams compressed frames to ESP32, ESP32-C3, and ESP32-S3 devices over a custom reliable UDP protocol.

freertos lwip

AES67/RAVENNA for ESP32-P4

A high-performance ESP-IDF component implementing AES67 and RAVENNA audio-over-IP standards on the ESP32-P4 microcontroller. It features hardware-accelerated PTP synchronization, sub-millisecond latency, and ISR-driven DMA playback to ensure glitch-free audio streaming over Ethernet.

freertos lwip
NRSuite

NRSuite

NRSuite is a modular wireless research toolkit that offloads the radio layer to an ESP32 connected via USB OTG to an unrooted Android device. It enables advanced Wi-Fi operations, BLE HID emulation, and BadUSB functionality within the Termux environment using a custom binary bridge protocol.

freertos h2zero-esp-nimble-cppnimblelwip
LuxDMX

LuxDMX

LuxDMX is an open-source Art-Net and sACN to DMX512 gateway designed for ESP32 and ESP32-S3 microcontrollers, featuring a live web-based diagnostic interface. It provides professional-grade lighting control with support for RDM, source merging (HTP/LTP), and multiple network interfaces including WiFi and wired Ethernet. The project utilizes a FreeRTOS-based architecture to ensure low-jitter DMX timing while simultaneously serving high-speed telemetry via WebSockets.

freertos lwip

ESP8266 Secure Weather Clock (TJ-56-654)

An open-source firmware replacement for the TJ-56-654 weather clock kit, focusing on security, privacy, and performance. It features a fully asynchronous architecture for the ESP8266, utilizing NTP for time synchronization and the Open-Meteo API for weather data. The project provides a secure web interface, REST API, and Over-the-Air (OTA) update capabilities to replace insecure factory firmware.

lwip