Network Prerequisites and Troubleshooting
Read this before your first Hello World if you are on a VPN, in a container, behind a firewall, or on a machine you do not administer.
What discovery needs
HDDS participants find each other with the standard RTPS discovery protocols: SPDP announces each participant, SEDP then matches writers and readers. By default both run over UDP multicast:
| What | Default (domain 0) |
|---|---|
| SPDP multicast group | 239.255.0.1 |
| Discovery multicast port | UDP 7400 |
| Discovery unicast port | UDP 7410 + 2 x participant index |
| User data unicast port | UDP 7411 + 2 x participant index |
For domain d, add 250 x d to every port (the RTPS port mapping). The
participant index is the first free one on the host (0, 1, 2, ...), so it
follows the order in which participants start.
So, for two participants to talk:
- multicast must be delivered between them (same host: through an interface that loops multicast back; several hosts: a LAN that forwards multicast);
- the UDP ports of the domain (
7400 + 250 x Dto7649 + 250 x D: 7400-7649 for domain 0) must not be filtered; - both sides must use the same domain ID and the same topic name, with compatible QoS.
What failure looks like
Nothing fails. When discovery cannot happen, both programs start, writes return success, and the subscriber simply never receives anything. There is no error, because from each participant's point of view it is alone on the network, which is a legal state.
Usual causes:
| Environment | What happens |
|---|---|
| VPN client (WireGuard, corporate VPN, ...) | The VPN's routing table captures 239.0.0.0/8, so multicast leaves through the tunnel instead of reaching the local peer. HDDS logs IP_MULTICAST_IF=<ip> blocked (VPN/tunnel policy?) when it detects this. |
| Docker / Podman on a bridge network | Multicast between the host and containers may not get through. Inside a container, HDDS uses the container's eth0 (see Containers). |
Firewall (ufw, firewalld, Windows Defender) | Inbound UDP 7400+ is dropped. |
| Cloud VPC, most Wi-Fi guest networks | Multicast is not forwarded at all. |
| Host without a multicast route | The kernel has nowhere to send 239.255.0.1. |
How to tell that discovery failed
-
Turn logging on. Each participant logs one
discovery config:line at startup (multicast state, unicast peers, Discovery Server), plus a warning when multicast is blocked.Language Enable logging Rust HDDS logs through the logcrate: addenv_logger, callenv_logger::init(), run withRUST_LOG=hdds=infoC hdds_logging_init(HDDS_LOG_INFO);C++ hdds::logging::init(hdds::LogLevel::Info);Python hdds.logging.init(hdds.LogLevel.INFO) -
Ask the writer how many readers it matched. A reader on another participant is matched once discovery found it and its QoS is compatible. Zero after a few seconds means the two sides never met (or their QoS is incompatible).
Language Matched readers Rust writer.matched_reader_count()C hdds_writer_matched_reader_count(writer, &count)orhdds_writer_wait_for_matched_readers(writer, 1, timeout_ms)Python writer.matched_reader_count()orwriter.wait_for_readers(1, timeout=5.0)C++ writer.get_publication_matched_status().current_count(typed writer) -
Check the route. On Linux,
ip route get 239.255.0.1shows which interface multicast leaves through. If it names a VPN or tunnel device, that is your problem.
Fixes
Same machine: use loopback
Pin every participant to the loopback interface. Set it in both terminals:
export HDDS_INTERFACE=lo # an interface name, or an IPv4 address: 127.0.0.1
HDDS logs a warning that remote peers cannot reach a loopback participant; that is expected for a single-machine test.
Several machines on one LAN: choose the interface
When a host has several interfaces (VPN, Docker bridges, Wi-Fi plus Ethernet), HDDS may pick one that does not reach the other machines. Force the right one:
export HDDS_INTERFACE=eth0 # or its address, e.g. 192.168.1.20
HDDS_INTERFACE sets the interface used for multicast and the address HDDS
announces to its peers. To keep automatic selection but restrict it to some
interfaces, use HDDS_INTERFACE_ALLOW (names or CIDR blocks, comma
separated). See Environment Variables.
By default HDDS uses every non-loopback IPv4 interface for multicast, except
the bridge devices that container runtimes create on the host. A bridge is
recognised by its device name, never by its address: docker0, br- followed
by 12 hexadecimal digits, veth*, podman<N> and cni-podman<N>, and on
Windows the WSL and NAT switches (vEthernet (WSL...), vEthernet (Default Switch),
vEthernet (nat), vEthernet (DockerNAT)). A LAN addressed in 172.16.0.0/12
is therefore used, and so is the eth0 of a container at 172.17.0.2.
No multicast at all: unicast peers
List the peers' discovery unicast endpoints. HDDS then sends its SPDP announcements to them directly, and they answer the same way:
# IPv4:port of each peer's discovery unicast port (7410 + 250 x domain + 2 x index)
export HDDS_SPDP_UNICAST_PEERS=10.0.0.5:7410,10.0.0.6:7410
Each side must list the other. If several participants run on one peer host,
list one port per participant (:7410, :7412, ...). Invalid entries are
ignored, and only logged at debug level, so check the discovery config:
line (static=N) to confirm the list was taken.
Programmatic equivalents: ParticipantBuilder::add_static_peer("10.0.0.5:7410")
in Rust, hdds_config_add_static_peer(config, "10.0.0.5:7410") in C.
Many participants, or no multicast across subnets: Discovery Server
Run hdds-discovery-server on a host every participant can reach, and point
the participants at it. The server only brokers discovery: after it, data
flows directly between peers, so they must still reach each other's unicast
addresses (there is no NAT traversal). See
Discovery Server.
Containers
Use host networking (docker run --network host) for local tests. On a
bridge network, HDDS uses the container's eth0 without any setting, because
that device is not a container bridge by name. Set HDDS_INTERFACE=eth0 only
to pin the choice explicitly, and list the other containers in
HDDS_SPDP_UNICAST_PEERS if multicast still does not get through.
Firewall
Open the UDP ports of your domain: 7400 + 250 x D to 7649 + 250 x D (7400-7649
for domain 0, 17900-18149 for domain 42). See
Linux installation.
Still nothing?
- Same domain ID on both sides? A domain set in code wins; otherwise every
SDK reads
HDDS_DOMAIN_ID(see Environment Variables). - Same topic name, character for character?
- Compatible QoS: a RELIABLE reader never matches a BEST_EFFORT writer; a TRANSIENT_LOCAL reader never matches a VOLATILE writer. See QoS Policies.
- Started the subscriber first? With VOLATILE durability, samples written before the reader is matched are not delivered to it.
More symptoms and fixes: Common Issues.