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

View All 181 Projects →
ILDAWaveX16 - Open Source Laser DAC

ILDAWaveX16 - Open Source Laser DAC

A high-resolution, wireless laser Digital-to-Analog Converter (DAC) powered by the ESP32-S3. It features 16-bit 8-channel output, SD card playback, and support for ILDA Digital Network (IDN) and custom UDP streaming protocols.

freertos lwipplatformio-platformio-core
26
FlatSphere Clock

FlatSphere Clock

An ESP32-S3 powered smart clock project featuring a round touch display, Text-to-Speech capabilities, and integrated battery monitoring. Built using the ESP-IDF framework and LVGL graphics library, it serves as a comprehensive hardware abstraction layer and demo for the WaveShare 1.85-inch Touch LCD development board.

freertos lvgllwip
LiXee-Box

LiXee-Box

A multi-protocol Zigbee gateway and energy management hub built on the ESP32-S3 platform. It integrates Zigbee devices, Linky smart meters, and energy sensors into home automation systems via MQTT and a local web interface.

freertos littlefslwip
11
M5Apps

M5Apps

A comprehensive multi-application launcher and management system for the M5 CardPuter. Built on ESP-IDF and FreeRTOS, it enables users to install and run multiple applications from cloud repositories, SD cards, and USB storage.

freertos lwip
16
CMSIS-DAP over TCP for ESP32

CMSIS-DAP over TCP for ESP32

A firmware implementation for ESP32 that enables remote ARM microcontroller debugging and flashing via the CMSIS-DAP protocol over TCP/IP. It supports both JTAG and SWD interfaces, allowing OpenOCD to connect to target hardware over WiFi. The project includes a UART-to-TCP bridge for remote serial console access.

freertos lwip
MicroLink: Tailscale VPN for ESP32

MicroLink: Tailscale VPN for ESP32

A production-ready Tailscale protocol implementation for ESP32 microcontrollers using the ESP-IDF framework. It enables secure VPN connectivity via WireGuard encryption, supporting NAT traversal through DERP and STUN.

freertos lwip
12
PocketSSH

PocketSSH

A portable SSH terminal client for the ESP32-S3 T-Deck Plus handheld device. It provides a full SSH2 terminal with PTY support, hardware keyboard integration, and a graphical interface built on FreeRTOS and LVGL. The project targets secure remote server management on compact, battery-powered hardware.

freertos lvgllwip
79
ESP32-CAM MCP Server

ESP32-CAM MCP Server

A Model Context Protocol (MCP) server implementation for the ESP32-CAM that enables remote camera control and system monitoring through a standardized JSON-RPC 2.0 API. It supports image capture optimized for AI assistants, LED/flash management, and comprehensive hardware diagnostics.

freertos spiffslwip
19