ROS 2 nodes only see each other when they use the same ROS_DOMAIN_ID and can reach each other on the network.
What the message means
Discovery is automatic inside a domain. Different domain numbers keep nodes apart, and a firewall can block the discovery traffic between machines.
Fix it in this order
- Print echo $ROS_DOMAIN_ID in both terminals and make them the same.
- Check that both machines are on the same network and can reach each other.
- Allow the discovery traffic through the firewall, or test with the firewall off on a safe network.
- Make sure both sides use the same ROS 2 distribution and middleware.
- Run the node and ros2 topic list in terminals that both sourced the setup file.
Why it happens
ROS 2 nodes find each other automatically, but only inside the same domain, which is set by ROS_DOMAIN_ID. Two terminals with different values, or with the variable set in one and not the other, cannot see each other’s topics.
Between machines, discovery also needs the network to carry the traffic. A firewall, a network that blocks multicast, or machines on different networks can hide nodes even when the domain numbers match.
If you see this, do this
| You see | Do this |
|---|---|
| List empty on a second machine | Domain ID, network or firewall. |
| Works on one machine only | Check discovery between machines. |
Related
ros2 command not found, Gazebo and ROS 2.
Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.
Why this happens
ROS 2 uses DDS for discovery. Each node announces itself over UDP, and the domain ID decides which UDP ports are used, so nodes in different domains never hear each other. The ROS 2 documents give 0 to 101 as the range that is safe on all systems. The variable is read when a process starts, so changing it in one terminal does not affect programs already running.
Between two machines the announcements also have to travel across the network. Default discovery relies on multicast, which some routers, Wi-Fi access points with client isolation, virtual machines and containers do not pass on. Two nodes can then have matching domain IDs and still be invisible to each other. A different middleware (RMW) on each side is another way to get an empty list.
How to confirm the cause
- In each terminal run
echo $ROS_DOMAIN_IDandecho $RMW_IMPLEMENTATION. An empty value means the default domain 0. All sides must match. - Run
ros2 topic list --no-daemon. The command normally asks a background daemon that can hold old results; if the fresh list differs, stop it withros2 daemon stopand try again. - On two machines run
ros2 multicast receiveon one andros2 multicast sendon the other. If the message does not arrive, multicast is being blocked and the problem is the network, not ROS. - Ping each machine from the other by IP address. No reply means a routing or firewall problem before ROS is involved.
- In Docker or a virtual machine, check whether the container shares the host network.
Worked example
A minimal pair of terminals in the same domain. The nodes come from the standard demo package.
# terminal 1
export ROS_DOMAIN_ID=7
ros2 run demo_nodes_cpp talker
# terminal 2 (same or another machine)
export ROS_DOMAIN_ID=7
ros2 topic list --no-daemon
ros2 run demo_nodes_cpp listenerCommon mistakes
- Setting the variable in .bashrc and then testing in a terminal that was opened before the edit.
- Running a container without host networking and expecting multicast to cross into it.
- Mixing two ROS 2 distributions or two RMW choices across machines.
- Leaving a localhost-only discovery setting switched on, which hides nodes on other machines by design.
- Forgetting to source the workspace, so the topics exist but the message types are unknown.
If this did not fix it
- Firewall rules on one machine dropping UDP discovery traffic.
- Wi-Fi access point isolation, which stops wireless clients from talking to each other.
- A VPN or a second network adapter that makes ROS choose the wrong interface.
- Heavy discovery traffic on a large network; a discovery server setup is then worth reading about.