Skip to content

Add TCP console for remote management via telnet/netcat (ESP32)#2197

Open
ndrpri wants to merge 7 commits intomeshcore-dev:devfrom
ndrpri:feature/tcp-console
Open

Add TCP console for remote management via telnet/netcat (ESP32)#2197
ndrpri wants to merge 7 commits intomeshcore-dev:devfrom
ndrpri:feature/tcp-console

Conversation

@ndrpri
Copy link
Copy Markdown

@ndrpri ndrpri commented Mar 30, 2026

Overview

This PR adds a TCP console feature for ESP32-based repeaters and room servers,
allowing remote management via telnet or netcat over WiFi or Ethernet,
without requiring a physical LoRa radio link.

Motivation

When a repeater or room server is installed in a remote or hard-to-reach location
(e.g. rooftop, mountain), firmware updates and diagnostics currently require either
physical USB access or a working LoRa radio link. This feature adds a third option:
TCP/IP access over the existing network connection (WiFi or Ethernet).

How it works

  • A TCP server listens on a configurable port (defined via -D TCP_CONSOLE_PORT=4242)
  • On connection, the client is prompted for the admin password (ADMIN_PASSWORD)
  • After authentication, all standard CLI commands are available (same as serial/USB console)
  • Inactivity timeout after 5 minutes (configurable via TCP_CONSOLE_MAX_TIMEOUT_MS)
  • Up to 2 simultaneous connections (configurable via TCP_CONSOLE_MAX_CLIENTS)

Usage

telnet <device-ip> 4242
# or
nc <device-ip> 4242

Changes

New files

  • src/helpers/esp32/TCPConsole.h — header-only TCP console implementation

Modified files

  • examples/simple_repeater/main.cpp — integrate TCPConsole when TCP_CONSOLE_PORT and ADMIN_PASSWORD are defined
  • examples/simple_room_server/main.cpp — same
  • examples/companion_radio/main.cpp — same (no-op if ADMIN_PASSWORD not defined)

Configuration

Add to your platformio.ini environment:

-D TCP_CONSOLE_PORT=4242          ; TCP port to listen on
-D TCP_CONSOLE_MAX_CLIENTS=2      ; optional, default 2
-D TCP_CONSOLE_TIMEOUT_MS=300000  ; optional, default 5 minutes

Security

  • Password protected (uses existing ADMIN_PASSWORD)
  • Only active when TCP_CONSOLE_PORT is explicitly defined — opt-in, not enabled by default
  • Disabled automatically if ADMIN_PASSWORD is not defined

Tested

  • Repeater via Ethernet (LilyGo T-ETH-Elite)
  • Authentication with password
  • CLI commands working remotely
  • Inactivity timeout
  • WiFi SoftAP (to be tested)

@ndrpri
Copy link
Copy Markdown
Author

ndrpri commented Mar 31, 2026

Update: Fixed a bug where the TCP console was using the compile-time ADMIN_PASSWORD instead of the runtime password stored in NodePrefs. Now the console correctly uses the password set via set password command, even after it has been changed without reflashing the firmware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant