A fast, cross-platform mDNS relay written in Rust with multi-arch Docker support
2.5K
A lightweight, high-performance mDNS (multicast DNS) relay written in Rust.
It forwards mDNS packets between network interfaces for both IPv4 and IPv6, enabling service discovery across isolated subnets ā ideal for Matter, HomeKit, and other protocols that rely on link-local multicast.
š Full source and documentation: https://github.com/engel0/mdns-relayā
224.0.0.251) and IPv6 (ff02::fb)tokio async runtimeNET_RAW support)systemd (for native service management)# Build or download binary
make build
# Copy config and binary
sudo cp target/x86_64-unknown-linux-musl/release/mdns-relay /usr/local/bin/
sudo cp etc/mdns-relay.toml /etc/
# Run manually (uses /etc/mdns-relay.toml)
mdns-relay
# Show version or help
mdns-relay --version
mdns-relay --help
/etc/mdns-relay.toml)The service is fully config-driven using a TOML file.
By default, it loads /etc/mdns-relay.toml, but this path can be overridden via --config.
ā”ļø See the full documented config file at mdns-relay.tomlā for all supported options and examples.
# Interface bridging
[[interface]]
src = "eth0"
dst = "wlan0"
stack = "dual"
[[interface]]
src = "wlan0"
dst = "eth0"
stack = "dual"
# TTL-based cache to prevent loops
ttl = 10
cache_size = 1000
# Logging
log_level = "info"
log_format = "pretty"
# Performance tuning
buffer_size = 2048
max_events = 64
loop_detection_ms = 200
stats_interval_seconds = 300
cleanup_interval_seconds = 30
max_packet_size = 9000
š See example configurationsā for VLANs, Docker, and Proxmox setups.
# Install binary + service
make install
# Start service
sudo systemctl enable --now mdns-relay
sudo systemctl status mdns-relay
# Logs
sudo journalctl -u mdns-relay -f
docker build -t mdns-relay .
docker run --rm --net=host --cap-add=NET_RAW \
-v /etc/mdns-relay.toml:/etc/mdns-relay.toml:ro \
mdns-relay:latest
version: '3.8'
services:
mdns-relay:
build: .
image: engeloded/mdns-relay:latest
network_mode: host
cap_add: [NET_RAW]
volumes:
- /etc/mdns-relay.toml:/etc/mdns-relay.toml:ro
restart: unless-stopped
š” The
:latesttag is a multi-arch manifest (x86_64, arm64, armv7). You can also pull a specific image like:docker pull engeloded/mdns-relay:1.0.0-aarch64-unknown-linux-musl
# Build for your native system
make build
# Build for ARM64 (RPi 4+)
make build TARGET=aarch64-unknown-linux-musl
# Build for ARMv7 (RPi 3)
make build TARGET=armv7-unknown-linux-musleabihf
# Build for all supported platforms
make build-all
mdns-relay --help
Usage: mdns-relay [OPTIONS]
Options:
-c, --config <FILE> Configuration file path [default: /etc/mdns-relay.toml]
-v, --version Print version information
-h, --help Print help
[[interface]]
src = "eth0"
dst = "wlan0"
stack = "dual"
[[interface]]
src = "wlan0"
dst = "eth0"
stack = "dual"
[[interface]]
src = "eth0"
dst = "eth0.100"
stack = "ipv4"
[[interface]]
src = "docker0"
dst = "eth0"
stack = "ipv4"
[[interface]]
src = "vmbr0"
dst = "eth0"
stack = "dual"
log_level = "debug"
[[interface]]
src = "eth0"
dst = "eth1"
stack = "dual"
mdns-relay --config debug.toml
# View services
avahi-browse -a
dns-sd -B _services._dns-sd._udp
# systemd logs
sudo journalctl -u mdns-relay -f
# Docker logs
docker logs -f mdns-relay
stack = "dual" for maximum compatibilityip link show--net=host --cap-add=NET_RAWlog_level = "debug" to confirm packet flowPublished with make release, tags include:
engeloded/mdns-relay:latest ā multi-arch (auto-selects arch)engeloded/mdns-relay:<version>-<target> ā arch-specificSupported targets:
x86_64-unknown-linux-muslaarch64-unknown-linux-muslarmv7-unknown-linux-musleabihfi686-unknown-linux-muslMIT License ā see LICENSEā
Created by Engel Oded Contributions and feedback welcome!
Content type
Image
Digest
sha256:0441074fcā¦
Size
5.1 MB
Last updated
about 1 year ago
docker pull engeloded/mdns-relay