Using meshtasticd for Virtual Nodes β
meshtasticd is a virtual Meshtastic node daemon that simulates a Meshtastic device in software. It's perfect for development, testing, and running virtual mesh networks without physical hardware.
What is meshtasticd? β
meshtasticd provides virtual node simulation - running a software Meshtastic node without physical hardware.
Use cases include:
- Testing MeshMonitor without physical hardware
- Running a virtual Meshtastic node on a server or Raspberry Pi
- Developing and testing mesh applications
- Creating virtual mesh networks for simulation and testing
Physical Device Connections β
For physical Meshtastic devices, use the appropriate bridge:
- Serial/USB devices: Use the Meshtastic Serial Bridge instead
- Bluetooth (BLE) devices: Use the MeshMonitor BLE Bridge instead
meshtasticd is designed for virtual node simulation, not for connecting physical hardware.
Installing meshtasticd β
From Python Package β
The easiest way to install meshtasticd is via pip:
pip install meshtasticThis installs both the Meshtastic Python library and the meshtasticd daemon.
From Source β
To install from source:
git clone https://github.com/meshtastic/python.git
cd python
pip install -e .Running meshtasticd β
Basic Usage β
Start meshtasticd with a hardware model:
meshtasticd --hwmodel RAK4631Available hardware models include:
RAK4631- RAK WisBlock CoreTBEAM- TTGO T-BeamTLORA_V2- TTGO LoRa32 V2HELTEC_V3- Heltec V3BETAFPV_2400_TX- BetaFPV 2.4GHz TX
With Custom Port β
By default, meshtasticd listens on localhost:4403. To specify a different port:
meshtasticd --hwmodel RAK4631 --port 4404With Configuration File β
You can specify a custom configuration file:
meshtasticd --hwmodel RAK4631 --config ./meshtastic-config.yamlConfiguring MeshMonitor β
Point to localhost β
When using meshtasticd, set the node IP to localhost:
export MESHTASTIC_NODE_IP=localhostOr in your .env file:
MESHTASTIC_NODE_IP=localhostDocker Compose Setup β
When running both meshtasticd and MeshMonitor in Docker, you need to ensure they can communicate:
version: '3.8'
services:
meshtasticd:
image: meshtastic/meshtasticd:latest
command: meshtasticd --hwmodel RAK4631
ports:
- "4403:4403"
networks:
- mesh-network
meshmonitor:
image: meshmonitor:latest
environment:
- MESHTASTIC_NODE_IP=meshtasticd
ports:
- "8080:8080"
networks:
- mesh-network
depends_on:
- meshtasticd
networks:
mesh-network:
driver: bridgeUsing Docker Host Network β
Alternatively, use host networking to simplify connectivity:
services:
meshmonitor:
image: meshmonitor:latest
network_mode: "host"
environment:
- MESHTASTIC_NODE_IP=localhostInitial Configuration β
After starting meshtasticd, you may want to configure it using the Meshtastic CLI:
# Connect to the virtual node
meshtastic --host localhost
# Set your node name
meshtastic --set node.name "My Virtual Node"
# Configure LoRa region
meshtastic --set lora.region US
# Enable WiFi (if desired)
meshtastic --set network.wifi_enabled trueTesting the Connection β
Verify MeshMonitor can connect to your meshtasticd instance:
Start
meshtasticd:bashmeshtasticd --hwmodel RAK4631In another terminal, test connectivity:
bashmeshtastic --host localhost --infoStart MeshMonitor and check the logs for successful connection
Virtual Mesh Network β
You can create a virtual mesh network by running multiple meshtasticd instances:
# Terminal 1: First node
meshtasticd --hwmodel RAK4631 --port 4403
# Terminal 2: Second node
meshtasticd --hwmodel TBEAM --port 4404
# Terminal 3: Third node
meshtasticd --hwmodel HELTEC_V3 --port 4405Connect MeshMonitor to any of these nodes, and configure them to communicate with each other using MQTT or other Meshtastic networking features.
Troubleshooting β
Port Already in Use β
If you see "Address already in use" errors:
# Find what's using port 4403
lsof -i :4403
# Kill the process or use a different port
meshtasticd --hwmodel RAK4631 --port 4404Connection Refused β
If MeshMonitor cannot connect:
Verify
meshtasticdis running:bashps aux | grep meshtasticdCheck if the port is open:
bashnetstat -an | grep 4403Test with the Meshtastic CLI:
bashmeshtastic --host localhost --info
Permission Denied β
On Linux, you may need permissions for virtual serial ports:
sudo usermod -aG dialout $USER
# Log out and back inProduction Use β
For production deployments of meshtasticd:
Using systemd β
Create a systemd service file /etc/systemd/system/meshtasticd.service:
[Unit]
Description=Meshtastic Daemon
After=network.target
[Service]
Type=simple
User=meshtastic
ExecStart=/usr/local/bin/meshtasticd --hwmodel RAK4631
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.targetEnable and start the service:
sudo systemctl enable meshtasticd
sudo systemctl start meshtasticdUsing Docker β
Run meshtasticd as a Docker container:
docker run -d \
--name meshtasticd \
--restart unless-stopped \
-p 4403:4403 \
meshtastic/meshtasticd:latest \
meshtasticd --hwmodel RAK4631Next Steps β
- Connect Serial/USB devices with the Serial Bridge
- Connect Bluetooth devices with the BLE Bridge
- Configure SSO for authentication
- Set up a reverse proxy for external access
- Deploy to production with proper monitoring