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 (170)

View All 170 Projects →
Geek Magic Firmware

Geek Magic Firmware

A custom ESP8266 firmware for Geek Magic smart clock clones featuring NTP synchronization, Pomodoro timers, and a web-based configuration dashboard. It utilizes the TFT_eSPI library for display management and LittleFS for asset storage. The project also includes a Linux-based companion server for forwarding system notifications to the device display.

tft-espilittlefslwip
13
p3a — Pixel Art Player

p3a — Pixel Art Player

A Wi-Fi-enabled pixel art player built on the ESP32-P4 platform featuring multi-buffer rendering for gapless playback of animated WebP, GIF, and PNG files. It integrates with the Makapix Club social network via secure MQTTS and provides a local web interface for device management.

freertos littlefsspiffslwip
46
ESP32 Voice Assistant

ESP32 Voice Assistant

An end-to-end conversational AI assistant using an ESP32 for real-time audio capture and playback. It leverages a Python backend for Speech-to-Text (Whisper), Language Modeling (Gemini), and Text-to-Speech (Piper) via WebSocket streaming. The system targets ESP32 hardware with I2S peripherals for high-quality voice interaction.

freertos lwip
30

ESP32 RTSP Mic for BirdNET-Go

An ESP32-C6 firmware designed to stream high-quality mono PCM audio from an I²S microphone over RTSP for bird sound identification. It features a comprehensive Web UI, JSON API for integration, and real-time audio processing including a configurable high-pass filter. The project is optimized for the Seeed XIAO ESP32-C6 and the ICS-43434 digital microphone.

freertos lwip
34
PIXLPAL-M1 Firmware

PIXLPAL-M1 Firmware

A modular AIoT firmware for the Pixlpal desktop companion based on the ESP32-S3 SoC. It utilizes the ESP-IDF framework and FreeRTOS to power an interactive 128x64 RGB LED matrix display with features like Wi-Fi connectivity, BLE control, and audio processing.

freertos littlefslwipnimble
11

RadioJKK32 - Multifunctional Internet Radio Player

An advanced internet radio player based on the ESP32-A1S Audio Kit, utilizing the ESP-ADF framework and FreeRTOS. It features a local web server for remote control, support for multiple audio formats, 10-band equalization, and SD card recording capabilities.

freertos lvgllwip
26

Tab5 Launcher

A custom firmware launcher for the Tab5 device based on M5Launcher, utilizing the LVGL graphics library for its user interface. It allows users to load and flash binary firmwares from a FAT32-formatted SD card onto the ESP32-P4 based hardware.

freertos lvgllwip
14
Zigbee Gas Counter

Zigbee Gas Counter

A DIY Zigbee-enabled gas meter built on the ESP32-C6 using the ESP-IDF framework. It tracks real-time gas consumption and flow rates, integrating with Zigbee2MQTT and Home Assistant for energy management. The device features battery optimization, non-volatile storage for data persistence, and OTA firmware updates.

freertos lwip
26