Skip to content

Add EthernetBridge: UDP mesh packet tunneling over Ethernet#1

Open
rfb wants to merge 1 commit intorgregg:rak-ethernetfrom
rfb:rak-ethernet-bridge
Open

Add EthernetBridge: UDP mesh packet tunneling over Ethernet#1
rfb wants to merge 1 commit intorgregg:rak-ethernetfrom
rfb:rak-ethernet-bridge

Conversation

@rfb
Copy link
Copy Markdown

@rfb rfb commented Mar 25, 2026

Hi Ryan - Just wanted to share this with you. My goal here is to bridge to remote repeaters.. I know - not in the spirit of meshcore, but I live in an isolated location and I want to connect to a friend's isolated mesh so we can share messages...

I don't imagine you'll pull this - Just wanted to share what I built off your work.

  Introduces EthernetBridge, a new bridge implementation that transports
  mesh packets over UDP datagrams. Follows the same BridgeBase pattern as
  RS232Bridge and ESPNowBridge, using identical wire framing (magic header,
  length, Fletcher-16 checksum) for cross-bridge compatibility.

  Features:
  - Broadcast mode (default): forwards packets to 255.255.255.255 for
    passive network analysis / monitor mode
  - Unicast mode: set ETHERNET_BRIDGE_DEST_IP to bridge two ethernet-
    enabled nodes together over IP
  - Bidirectional: listens on the same UDP port for packet injection back
    into the mesh
  - Enabled via WITH_ETHERNET_BRIDGE build flag; port defaults to 5005

  Changes:
  - src/helpers/bridges/EthernetBridge.h/.cpp — new bridge class
  - src/helpers/CommonCLI.h — add WITH_ETHERNET_BRIDGE to WITH_BRIDGE guard
  - examples/simple_repeater/MyMesh.h/.cpp — wire in EthernetBridge
  - variants/rak4631/platformio.ini — enable bridge in RAK_4631_repeater_ethernet env
  - tools/bridge_monitor.py — Python UDP monitor that decodes mesh packets,
    including group channel decryption (AES128-ECB + HMAC-SHA256)

  ---
  Setting up a RAK4631 repeater in monitor mode

  1. Build and flash

  In variants/rak4631/platformio.ini the RAK_4631_repeater_ethernet environment already has WITH_ETHERNET_BRIDGE
  enabled. Flash it:

  pio run -e RAK_4631_repeater_ethernet --target upload

  2. Configure the repeater via serial or telnet

  Once booted, connect on serial (pio device monitor) or telnet to port 23, then:

  # Forward every packet the repeater hears (not just ones it sends)
  set bridge.source rx

  # Confirm it's running
  get bridge.enabled     → on
  get bridge.source      → logRx

  These settings persist across reboots.

  3. Run the monitor on your workstation

  # Install optional dependency for channel decryption
  pip install pycryptodome

  # Basic — shows all packet types, group messages shown as encrypted
  python3 tools/bridge_monitor.py

  # With Public channel decryption
  python3 tools/bridge_monitor.py \
    --channel "Public:8b3387e9c5cdea6ac9e5edbaa115cd72"

  # With a custom private channel (get the secret from the companion app export)
  python3 tools/bridge_monitor.py \
    --channel "Public:8b3387e9c5cdea6ac9e5edbaa115cd72" \
    --channel "MyTeam:<your-64-char-hex-secret>"

  # Show raw hex dump of every packet
  python3 tools/bridge_monitor.py --hex

  4. Example output

  [21:12:20.568] 192.168.88.170
    Type:    ADVERT  (FLOOD, ver=0)
    Node:    Alice's Node  [chat]
    ID:      8b3387...  (pub_key prefix)
    Time:    2025-03-24 21:12:18 UTC

  [21:12:45.101] 192.168.88.170
    Type:    GRP_TXT  (FLOOD, ver=0)
    Channel: Public (0x11)
    Time:    21:12:43 UTC
    Message: Alice: anyone on?

  Notes

  - The bridge uses UDP broadcast by default — the monitor just needs to be on the same LAN segment, no IP
  configuration required.
  - For bridging two nodes together instead of monitoring, set ETHERNET_BRIDGE_DEST_IP in the build flags to the
  peer node's IP on both devices.
  - bridge.source rx captures everything the repeater hears. bridge.source tx (the default) only forwards packets
  the node itself transmitted.
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