$git clone https://github.com/martin-ger/esp32_nat_routerThis is a firmware to use the ESP32 as WiFi NAT router. It routes between the network of the AP interface and the STA or ETH interface as uplink network. It can also work as a VPN router using WireGuard as uplink.
| 1 | # ESP32 NAT Router |
| 2 | |
| 3 | This is a firmware to use the ESP32 as WiFi NAT router. It routes between the network of the AP interface and the STA or ETH interface as uplink network. It can also work as a VPN router using WireGuard as uplink. |
| 4 | |
| 5 | ## Other WiFi Router/Repeater Projects |
| 6 | Starting from this code base I started several spin-off projects with slightly differrent scope. These are all (ab)using the ESP as a minimal network device. |
| 7 | |
| 8 | - **Layer 2 WiFi Repeater**: Finally we have it - the **WiFi Repeater**, a layer 2 network bridge between STA and AP (no NAT, no DHCP, just plain frame forwarding in one broadcast domain, i.e. one IP network segment). You currently find it's sources in the [esp32_wifi_repeater](https://github.com/martin-ger/esp32_nat_router/tree/esp32_wifi_repeater) branch of this repo, that is still under development, but it works generally with good performance and makes it a >2$ WiFi extender. |
| 9 | - **WiFi Access Point**: If you have a **W32-ET01 board** and you are looking for a plain ESP32 **Ethernet AP**, or correctly for an **Ethernet to WiFi Layer 2 Bridge**, check out [esp32_eth_wifi_bridge](https://github.com/martin-ger/esp32_eth_wifi_bridge). |
| 10 | - **Ethernet Router**: If you are looking for an ESP32 NAT router with reverse direction, i.e. **WiFi STA as uplink** (Internet) and **Ethernet as downlink** (LAN), check out [esp32_ethernet_router](https://github.com/martin-ger/esp32_ethernet_router). Here I also experiment with support for the common WIZnet W5500 SPI Ethernet NIC. |
| 11 | - **PPPoE Router**: If you ever consider using the ESP32 as an open-source ISP router, have a look at the [esp32_PPPoE_router](https://github.com/martin-ger/esp32_PPPoE_router). It adds PPPoE as additional Ethernet uplink option. So it could be used directly on an ISP modem. |
| 12 | - **ESP8266 NAT Router/Repeater**: The *grandfather* of all these projects, a feature monster once build on the NONOS-SDK for the [ESP8266](https://github.com/martin-ger/esp_wifi_repeater). |
| 13 | |
| 14 | ## Use cases for the NAT Router: |
| 15 | - Simple range extender for an existing WiFi network |
| 16 | - An additional WiFi network with different SSID/password and restricted access for guests or IoT devices |
| 17 | - VPN-Router using WireGuard |
| 18 | - Converter from a corporate (WPA2-Enterprise) network to a regular (WPA-PSK) network for simple devices |
| 19 | - Classic WiFi router with Ethernet uplink |
| 20 | - MCP-server to control your network using agentic AI |
| 21 | - Presence detection and network monitoring in a Home Assistant IoT network |
| 22 | - Debugging and monitoring of WiFi devices |
| 23 | |
| 24 | ## Key Features |
| 25 | |
| 26 | - **NAT Routing**: Full WiFi NAT router with IP forwarding (15+ Mbps throughput) |
| 27 | - **WireGuard VPN**: Optional VPN tunnel for upstream traffic with automatic MSS clamping and Path MTU |
| 28 | - **DHCP Reservations**: Assign fixed IPs to specific MAC addresses |
| 29 | - **Port Forwarding**: Map external ports to internal devices |
| 30 | - **Firewall**: Define ACL to restrict or monitor traffic |
| 31 | - **PCAP Capture**: Live packet capture can be streamed to Wireshark or other network tools |
| 32 | - **WPA2-Enterprise Support**: Connect to corporate networks (PEAP, TTLS, TLS) and convert them to WPA2-PSK |
| 33 | - **5 GHz WiFi**: Dual-band support on ESP32-C5 with configurable band preference (auto/2.4 GHz/5 GHz) |
| 34 | - **Ethernet Support**: Use a W32-ET01 board with LAN8720 PHY to get Ethernet uplink |
| 35 | - **Web Interface**: Web UI with password protection for easy configuration |
| 36 | - **Serial Console**: Full CLI for advanced configuration |
| 37 | - **Remote Console**: Network-accessible CLI via TCP (password protected, per-interface binding) |
| 38 | - **LED Status Indicator**: Visual feedback via plain GPIO LED or addressable LED strip (WS2812/SK6812) with color-coded status |
| 39 | - **OLED Display**: Status display on 72x40 I2C SSD1306 OLEDs (as found on some ESP32-C3 mini boards) |
| 40 | - **MQTT Home Assistant**: Publish telemetry and per-client stats to MQTT with HA auto-discovery |
| 41 | - **MCP Bridge (AI-Ready)**: BETA - Control the router from AI assistants (Claude, etc.) via the Model Context Protocol |
| 42 | - **mDNS**: The router |