Skip to content
AsimmimxPublic
forked from CamM2325/microlink

About

Tailscale for ESP32-C3/C6/S3, works without PSRAM. ESP-IDF component: WireGuard, DERP relay, DISCO NAT traversal. Maintained fork of MicroLink.

Topics

Resources

Security policy

Stars

17 stars

Watchers

1 watching

Forks

Β 
Β 

Latest commit

Β 

History

78 Commits

Folders and files

Repository files navigation

TailTiny: Tailscale for ESP32

Release CI License: MIT Buy Me a Coffee

Put an ESP32 on your Tailscale network. Once it's on your tailnet, any of your devices can reach it from anywhere: phone, laptop, server. You don't need port forwarding or a public IP.

TailTiny is an ESP-IDF component, tested on a $3 ESP32-C3 board without PSRAM. It's a fork of MicroLink by Cameron Malone, renamed in v3.0.0, and focuses on small boards, low power and a quick setup.

TailTiny is unofficial and not affiliated with Tailscale Inc. It works with Tailscale's hosted control server.


TailTiny or MicroLink?

MicroLink became active again in November 2026 (v2.3.0) and took in several of TailTiny's fixes; TailTiny 3.3.0 in turn has the security fixes from MicroLink's audit that apply to its code. Both are good choices; pick by what you need:

MicroLink TailTiny
Best for ESP32-S3 with PSRAM; 4G/LTE, Ethernet, subnet router and exit node, firmware updates over the tailnet ESP32-C3/C6 and boards without PSRAM; automatic light sleep; setup in about 15 minutes, or by an AI assistant (AGENTS.md)
Tested on ESP32-S3 + PSRAM (WiFi and 4G) ESP32-C3 without PSRAM, on every release
Control servers Tailscale, Headscale, Ionscale Tailscale
Install ESP Component Registry git clone (below)

Using ESPHome? Have a look at esphome-tailscale.


Which ESP32 works?

ESP32 compatibility chart: ESP32-C3 tested; ESP32-S3, ESP32 and ESP32-C6 should work; ESP32-S2 and C2 have too little RAM without PSRAM; ESP32-C5/C61 need a newer ESP-IDF; ESP32-H2 and P4 are not supported

Same table as text
Chip Status Notes
ESP32-C3 βœ… Tested on hardware Tested with this fork: no PSRAM, single core
ESP32-S3 🟑 Should work The original author's main board. PSRAM recommended. A contributor runs it on an ESP32-S3 inside their own firmware, built with ESP-IDF 6.1 (#3, #12)
ESP32 🟑 Should work Tested by the original author (no PSRAM)
ESP32-C6 🟑 Should work Builds. Single core like the C3, with more RAM
ESP32-S2 🟠 Low RAM Builds. RAM use not measured on an S2 yet; use a board with PSRAM (most S2 boards have it)
ESP32-C2 🟠 Low RAM Builds. TailTiny needs about 185 KB free after WiFi connects to keep reconnecting reliably (about 156 KB just to join once). A C2 has about 95 KB by default, and about 169 KB with Espressif's deepest RAM tuning on ESP-IDF 5.5 (Espressif), so it is still short
ESP32-C5 / C61 ❔ Unknown WiFi support needs ESP-IDF 5.5+. Not built yet
ESP32-H2 ❌ No No WiFi (Thread/Zigbee/BLE only)
ESP32-P4 ❌ No No built-in WiFi

"Should work" means it builds with ESP-IDF v5.3.2 using this fork, but hasn't been run on hardware with this fork yet. The RAM numbers come from an ESP32-C3 with part of its memory held back to mimic a smaller chip (details). If you try one, please open an issue with the result.


Set it up with an AI assistant

Working with Claude Code, Codex, Cursor or Copilot? Open this repository and say:

Set up TailTiny on my ESP32 board.

The assistant reads AGENTS.md. It detects your chip and serial port, asks you only for your WiFi details and Tailscale key, then builds, flashes and checks the connection.


Quick start (about 15 minutes)

You need: an ESP32 board from the table above, a USB cable, and a free Tailscale account.

1. Install ESP-IDF

Follow Espressif's installer for your OS (v5.3 or newer; ESP-IDF 6 works too): Windows Β· Linux / macOS

Run the commands below in the ESP-IDF terminal that the installer sets up.

2. Download TailTiny

git clone https://github.com/Asimmimx/tailtiny.git
cd tailtiny/examples/basic_connect

3. Get a Tailscale auth key

Open Tailscale admin β†’ Settings β†’ Keys and click Generate auth key:

  • Reusable: off
  • Ephemeral: off (otherwise the device disappears when it powers off)
  • Pre-approved: on (if you see the option)

Copy the key. It starts with tskey-auth-.

4. Add your WiFi and key

Copy the template:

cp sdkconfig.credentials.example sdkconfig.credentials

Open sdkconfig.credentials in any text editor and fill in the three lines:

CONFIG_ML_WIFI_SSID="your-wifi-name"
CONFIG_ML_WIFI_PASSWORD="your-wifi-password"
CONFIG_ML_TAILSCALE_AUTH_KEY="tskey-auth-..."

sdkconfig.credentials is git-ignored, so your secrets stay local.

5. Build and flash

Replace esp32c3 with your chip and COM5 with your board's port (/dev/ttyUSB0 on Linux, /dev/cu.usbserial-* on macOS):

idf.py set-target esp32c3
idf.py -p COM5 flash monitor

After about 15 seconds you should see:

TailTiny state: CONNECTED
Connected! VPN IP: 100.x.y.z

The device now shows up in your Tailscale machines list. Click "…" β†’ Disable key expiry there, or it will drop off the network after 180 days.

6. Try it

From any computer on your tailnet:

ping 100.x.y.z
echo "hello" | nc -u 100.x.y.z 9000      # the example echoes it back

Use it in your own project

  1. Copy examples/basic_connect/sdkconfig.defaults into your project. It enables the crypto and network options TailTiny needs.

  2. Add one line to your project's top-level CMakeLists.txt, before include(...project.cmake):

    set(EXTRA_COMPONENT_DIRS "path/to/tailtiny/components/tailtiny")
  3. Start TailTiny once WiFi is connected:

    #include "tailtiny.h"
    
    tailtiny_config_t cfg = {
        .auth_key    = "tskey-auth-...",
        .device_name = "my-esp32",
        .enable_derp = true, .enable_stun = true, .enable_disco = true,
    };
    tailtiny_t *ml = tailtiny_init(&cfg);
    tailtiny_start(ml);
    
    /* once tailtiny_is_connected(ml) is true: */
    tailtiny_udp_socket_t *sock = tailtiny_udp_create(ml, 9000);
    tailtiny_udp_send(sock, tailtiny_parse_ip("100.64.0.5"), 9000, "hi", 2);

examples/basic_connect/main/main.c is a complete, working program. The full API is in the reference.


What this fork fixes

Compared with MicroLink v2.1.0, the version TailTiny was forked from (latest TailTiny release: v3.3.0). MicroLink v2.3.0 has since fixed many of the same problems, some of them with TailTiny's fixes. Unless an item says otherwise, it was checked on an ESP32-C3 without PSRAM, and the numbers are from there:

  • Security fixes from MicroLink's and other forks' audits (v3.3.0). A forged WireGuard cookie reply or DISCO pong could redirect a peer's traffic; a tailnet peer could crash the device by naming a tailnet address as its endpoint; anyone who could send to the device's UDP port could keep it busy with DISCO key derivations or set the public address it advertises through a fake STUN reply. The optional config web UI now needs a password and only answers on the tailnet address. Details: CHANGELOG.

  • Runs on ESP32-C3/C6 and boards without PSRAM. Upstream reboot-looped on single-core chips and ran out of memory without PSRAM.

  • No more crash when a packet arrives while a socket is opening (#17).

  • Much less RAM to join a tailnet. The lowest point was 9.7 KB free; now it's 84–93 KB.

  • No packet loss under load. 50 msg/s used to lose 71% of packets with 784 ms latency; 100 msg/s now loses none, at 19 ms.

  • Closest DERP relay instead of Dallas (#19). From Turkey, relay latency dropped from 168 ms to about 60 ms.

  • No more "offline" in the admin console while the device thinks it's connected. A dead control connection is now noticed (GOAWAY, RST_STREAM, no keepalive for 120 s) and re-opened (#40).

  • Stable direct path on your LAN. It used to flip between a peer's LAN and public address every couple of minutes, re-handshaking each time.

  • Registration errors are logged with the server's reason instead of an endless MapRequest failed (#23). The rejection itself wasn't reproduced on hardware.

  • Quieter background traffic: no flood of DISCO PONG unmatched warnings, and endpoints go to the control server only when they change.

  • DERP keeps reconnecting and no longer leaks memory (#37).

  • Correct peer online status (#24), plus fixes for #34, #36 and #39.

  • WireGuard keys are no longer used by two tasks at once. A keepalive and a data packet could get the same nonce under the same key (#1). Checked on an ESP32-S3: 38 minutes of two-way traffic with no stall.

  • The DERP relay's certificate is checked. Before, anyone on the network path could pose as the relay. It's on by default (CONFIG_ML_DERP_VERIFY_CERT) and adds about 70 KB of flash. Checked on an ESP32-S3 against Tailscale's relays.

  • Builds with ESP-IDF 6 (cJSON from the registry, the driver split, GCC 15, Mbed TLS 4). Checked on an ESP32-S3 built with ESP-IDF 6.1.

  • Automatic light sleep works with TailTiny running. On an ESP32-S3 idle on the tailnet, time in light sleep went from 0% to about 12% (#12), and to about 33% with the coord and net_io waits in v3.2.0 (#13). Your project turns it on (how); the examples don't.

  • No more one-way tunnel to peers behind CGNAT (#18, #41). Replies went to an address the peer had advertised but couldn't be reached on; they now go over DERP until a direct path is confirmed. With direct UDP blocked and the peer sending first, 40 of 40 echoes came back, against none before.

  • Removed peers go away. Removals and small peer updates from the control server were never applied (they name peers by NodeID), so deleted nodes kept peer slots, also across reboots through the NVS cache.

  • WireGuard handshakes behave like wireguard-go: an unanswered one is dropped after 90 s instead of retried every 5 s forever, outgoing traffic starts one, a session that stops answering is renewed after 15 s, and a reboot without SNTP isn't refused as a replay any more.

  • tailtiny_stop() is safe: it waits for the tasks to exit (115 ms instead of a fixed 3 s) and frees the WireGuard device and the DERP session, which leaked on every restart.

  • Easier setup: one component folder, Windows builds, any chip, and a credentials file that actually gets read.

Full list with before/after measurements, behaviour changes and what's still open: CHANGELOG.md.


Troubleshooting

Symptom Fix
Device never shows up in Tailscale The log says why (Registration needs a login / rejected). Usually the auth key is wrong or already used. Make a new one, and erase the old identity with idf.py -p PORT erase-flash
Changed sdkconfig.credentials but nothing changed Delete the sdkconfig file and build again. Settings are only copied in on the first build
First message right after boot gets no reply Normal. The first tunnel takes about 15 s to set up
Failed to resolve component 'wireguard_lwip' You're on the old upstream repo. Use this fork
DERP connect attempt N failed, retrying in ... Outbound HTTPS (port 443) is blocked or the internet is down. It keeps retrying by itself
DERP certificate for ... not accepted: ... Your DERP server's certificate isn't in ESP-IDF's certificate bundle (for example, a self-hosted relay with a private certificate). Add its CA to the bundle, or turn off CONFIG_ML_DERP_VERIFY_CERT
Config web UI asks for a login, or answers 403 / 400 Since v3.3.0 it needs a password (user admin; the password is printed in the boot log as Config UI login: ..., or set CONFIG_ML_CONFIG_HTTPD_PASSWORD). Open it at http://100.x.y.z/ from a tailnet device, by IP address, not by name

More in the full reference.


More documentation

Support

The most useful help is a report: an issue with your chip and what happened, especially from boards not tested yet (ESP32-C6, S3, classic ESP32). If TailTiny saved you an afternoon and you'd like to say thanks, you can buy me a coffee. It's free and MIT-licensed either way.

Credits & license

TailTiny is based on MicroLink, created by Cameron Malone (CamM2325). This fork keeps his work and adds fixes on top.

Thanks also to:

  • tozes, for the idle-power, ESP-IDF 6 and WireGuard locking work.
  • The MicroLink forks whose fixes are credited in the CHANGELOG: Csontikka, fugo101, espkvm, antmanler, jetkvm, cplewes and djorr5.
  • Tomasz Fiedoruk, for the WireGuard roaming test that tests/host/check_wg_roaming.py is adapted from.

MIT License, see LICENSE. Bundled third-party code (wireguard-lwip, BSD-3-Clause; X25519, MIT) and trademark notes: NOTICE.md.

About

Tailscale for ESP32-C3/C6/S3, works without PSRAM. ESP-IDF component: WireGuard, DERP relay, DISCO NAT traversal. Maintained fork of MicroLink.

Topics

Resources

Security policy

Stars

17 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages