The error
$ ros2 topic list
/parameter_events
/rosout
# …but /chatter, published from the other terminal or machine, is missingThe short answer
Nodes only talk when they share a ROS_DOMAIN_ID, are allowed to discover each other (ROS_LOCALHOST_ONLY, and since Iron ROS_AUTOMATIC_DISCOVERY_RANGE), can exchange multicast, use the same middleware, and have compatible QoS. Check those in that order: printenv | grep -E 'ROS|RMW', then ros2 multicast receive / send, then ros2 topic info -v.
The 60-second diagnosis — compare both sides (receive first, then send from the other side)
printenv | grep -E 'ROS_DOMAIN_ID|ROS_AUTOMATIC_DISCOVERY_RANGE|ROS_LOCALHOST_ONLY|ROS_STATIC_PEERS|RMW_IMPLEMENTATION'
ros2 daemon stop # clear a stale cache, then list again
ros2 topic list
ros2 multicast receive # on one side…
ros2 multicast send # …and this on the otherWhat is actually going on
ROS 1 had a master: every node registered with roscore, and a node that could not reach it complained loudly. ROS 2 dropped the master. Each node announces itself on the network and listens for the announcements of others, and that conversation is handled by the middleware underneath — DDS by default, Fast DDS unless you chose another.
The official description of discovery has three steps: a node advertises its presence to other nodes with the same ROS domain; nodes keep re-advertising so latecomers find them; and nodes announce when they leave. It adds one more condition that catches people out: nodes only connect if their Quality of Service settings are compatible.
So “my nodes can’t see each other” means one of those steps is failing: the announcement is on a different domain, is not allowed to leave the machine, never crosses the network, is being read by a different middleware — or the nodes did meet and then refused each other’s QoS.
Find your cause
Most likely first. Run the check before you change anything; stop at the first one that matches.
- 1. Different ROS_DOMAIN_ID values
- 2. Discovery is limited to this machine (or switched off)
- 3. Multicast is blocked between the machines
- 4. A stale ros2 daemon is answering your command-line queries
- 5. The two sides use different middleware or different ROS 2 versions
- 6. You switched to rmw_zenoh and there is no router running
- 7. They found each other, but the QoS is incompatible
1. Different ROS_DOMAIN_ID values
You will see: Nothing at all is shared: each side lists only its own topics. Often one terminal has an export ROS_DOMAIN_ID=… from ~/.bashrc and the other was opened differently.
Why: The domain ID is DDS’s way of letting separate groups share one physical network: nodes on the same domain discover each other freely; nodes on different domains cannot. Every node uses domain 0 unless ROS_DOMAIN_ID says otherwise.
Check on each side
echo "domain=${ROS_DOMAIN_ID:-0 (default)}"Fix: same number everywhere (put it in ~/.bashrc on every machine)
export ROS_DOMAIN_ID=7
echo "export ROS_DOMAIN_ID=7" >> ~/.bashrcPick a domain ID between 0 and 101 inclusive. The domain ID is used to compute the UDP ports DDS listens on, so on Linux IDs 102–214 can collide with the operating system’s ephemeral ports (32768–60999 by default); 232 is the highest valid ID.
2. Discovery is limited to this machine (or switched off)
You will see: Two terminals on the same computer work, but a second computer sees nothing — or, with OFF, even two terminals on one computer do not see each other.
Why: Since Iron, ROS_AUTOMATIC_DISCOVERY_RANGE controls how far nodes look: SUBNET (the default: anything reachable by multicast), LOCALHOST (this machine only), OFF (no automatic discovery at all) or SYSTEM_DEFAULT (leave the middleware’s own settings alone). Classroom and lab setups often set LOCALHOST in ~/.bashrc so robots do not interfere, and then forget it is there. The older switch, ROS_LOCALHOST_ONLY=1, is the only one on Humble. Iron deprecated it, but on Jazzy it is still honoured — and while it is set to 1 it overrides ROS_AUTOMATIC_DISCOVERY_RANGE and ROS_STATIC_PEERS, so a leftover line in ~/.bashrc silently cancels the fixes below. It is gone from Kilted onward.
Check
printenv | grep -E 'ROS_AUTOMATIC_DISCOVERY_RANGE|ROS_LOCALHOST_ONLY|ROS_STATIC_PEERS'Fix (Jazzy and later): clear the old switch, then allow the subnet
unset ROS_LOCALHOST_ONLY # and delete it from ~/.bashrc
export ROS_AUTOMATIC_DISCOVERY_RANGE=SUBNET # SUBNET is also the default
ros2 daemon stop # the daemon keeps the old settingsOr keep LOCALHOST and add specific machines as static peers
export ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST
export ROS_STATIC_PEERS='192.168.1.20;192.168.1.21'Fix (Humble)
unset ROS_LOCALHOST_ONLY # and delete it from ~/.bashrc
ros2 daemon stopStatic peers work as long as the other side’s range is not OFF. They are also the way through networks that block multicast (next cause). Humble has no ROS_STATIC_PEERS.
3. Multicast is blocked between the machines
You will see: Same domain, discovery range is SUBNET, still nothing across machines. Common on guest Wi-Fi with client isolation, some corporate networks, many cloud networks and machines running a firewall.
Why: DDS discovery relies on UDP multicast, and the official troubleshooting guide says it plainly: the network interface in use has to be multicast-enabled, and that is not always the default — it has even been missing on the loopback adapter on Ubuntu and macOS. ROS 2 ships a tool that tests exactly this.
Check: run receive on machine A, send on machine B
ros2 multicast receive # machine A
ros2 multicast send # machine B
# success on A looks like: Received from 192.168.1.21:43751: 'Hello World!'Fix a ufw firewall (from the official troubleshooting guide)
sudo ufw allow in proto udp to 224.0.0.0/4
sudo ufw allow in proto udp from 224.0.0.0/4Check the interface has the MULTICAST flag
ip link show # look for MULTICAST in the <…> flagsIf the network itself will not pass multicast and you cannot change it, use ROS_STATIC_PEERS (Iron and later) with the other machine’s IP address, so discovery goes point to point instead. On Humble, the Fast DDS discovery server (ROS_DISCOVERY_SERVER) does the same job without multicast.
4. A stale ros2 daemon is answering your command-line queries
You will see: ros2 topic list or ros2 node list shows nodes that have stopped, misses ones you just started, or disagrees with what the nodes themselves are doing.
Why: To answer quickly, the ros2 command-line tools ask a background daemon that keeps a picture of the ROS graph. It starts automatically the first time you run ros2 node list or ros2 topic list and listens on localhost on a port offset by ROS_DOMAIN_ID, so each domain has its own daemon. It keeps the middleware and discovery settings of the terminal that started it: after you change RMW_IMPLEMENTATION, ROS_AUTOMATIC_DISCOVERY_RANGE or ROS_LOCALHOST_ONLY, it can go on answering with the old view.
Fix: stop it; the next command starts a fresh one
ros2 daemon stop
ros2 topic listOr bypass the daemon for one query
ros2 topic list --no-daemonThis only affects what the CLI shows you. If nodes themselves are not exchanging data, keep going down this list.
5. The two sides use different middleware or different ROS 2 versions
You will see: One machine runs Jazzy and the other Humble, or one terminal has RMW_IMPLEMENTATION=rmw_cyclonedds_cpp and the other uses the default. Discovery works partly or not at all.
Why: ROS 2 can run on several middleware implementations (Fast DDS is the default, Cyclone DDS and Connext are alternatives). The official guidance on cross-vendor communication: different implementations may be compatible in limited circumstances, but this is not guaranteed, so every part of a system should use the same ROS version and the same RMW implementation.
Check on each side
echo "rmw=${RMW_IMPLEMENTATION:-default (Fast DDS)} distro=$ROS_DISTRO"
ros2 doctor --report | grep -A4 "RMW MIDDLEWARE"Fix: set the same implementation everywhere (example)
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
ros2 daemon stop6. You switched to rmw_zenoh and there is no router running
You will see: RMW_IMPLEMENTATION=rmw_zenoh_cpp is set and nodes that should talk do not, even on one machine.
Why: Zenoh is a non-DDS middleware with its own discovery. By default its nodes do not use multicast discovery: they learn about each other through a Zenoh router. Without the router, according to the rmw_zenoh documentation, nodes will not discover each other. The ROS discovery variables (ROS_AUTOMATIC_DISCOVERY_RANGE, ROS_STATIC_PEERS) are not supported by rmw_zenoh either.
Fix: start the router in its own terminal first
ros2 daemon stop # it may still be running another RMW
export RMW_IMPLEMENTATION=rmw_zenoh_cpp
ros2 run rmw_zenoh_cpp rmw_zenohdAcross machines, each side’s Zenoh session or router has to be told where the other router is; the rmw_zenoh README shows how with ZENOH_CONFIG_OVERRIDE.
7. They found each other, but the QoS is incompatible
You will see: The topic appears in ros2 topic list, both nodes are in ros2 node list, and the subscriber still receives nothing. A C++ subscriber logs New publisher discovered on topic '/scan', offering incompatible QoS. No messages will be sent to it. Last incompatible policy: RELIABILITY_QOS_POLICY; a Python one says “No messages will be received from it”.
Why: ROS 2 matches a publisher and a subscription only if the subscription asks for nothing stricter than the publisher offers. The classic case: sensor drivers publish with the sensor-data profile, which is best effort, and a subscriber asks for reliable. Best-effort publisher plus reliable subscriber is incompatible, so no connection is made. The same applies to durability: a transient-local subscriber cannot connect to a volatile publisher.
Check: compare the publisher and subscription QoS
ros2 topic info /scan --verboseFix in the subscriber (Python): match the publisher
from rclpy.qos import qos_profile_sensor_data
from sensor_msgs.msg import LaserScan
self.create_subscription(LaserScan, '/scan', self.on_scan, qos_profile_sensor_data)Fix in the subscriber (C++)
sub_ = create_subscription<sensor_msgs::msg::LaserScan>(
"/scan", rclcpp::SensorDataQoS(), cb);ros2 topic echo already adapts: unless every publisher offers reliable, it subscribes best effort, and it matches durability the same way, so “echo works but my node doesn’t” is a strong hint that QoS is the cause. You can force it with --qos-reliability best_effort.
A quick test that rules out your own code
Before debugging your nodes, prove the plumbing with the demo pair from the official install check (it needs ros-<distro>-desktop, or the demo-nodes-cpp and demo-nodes-py packages). If these two do not talk, the problem is the environment or the network; if they do, it is in your nodes or their QoS.
Terminal (or machine) A, then B
ros2 run demo_nodes_cpp talker
ros2 run demo_nodes_py listener # should print: I heard: [Hello World: 1] …Let ros2 doctor look for you
ros2 doctor checks platform, version, network, environment and running systems, and warns about likely problems. ros2 doctor --report prints everything, including the network interfaces and the RMW in use — the part worth pasting when you ask for help.
Stop it happening again
- Decide one
ROS_DOMAIN_IDper robot or team and set it in~/.bashrcon every machine involved. - Write discovery settings down next to the robot (domain, range, static peers) rather than only in someone’s
~/.bashrc. - Keep every machine on the same ROS 2 distro and the same RMW implementation.
- On networks you do not control, plan on
ROS_STATIC_PEERS(or a discovery server on Humble) from the start. - When a topic is silent, run
ros2 topic info <topic> --verbosebefore touching code: it shows each endpoint’s QoS.
Questions people ask
Why does ros2 topic list show only /parameter_events and /rosout?
Every node creates those two topics by default, including the CLI’s own. Seeing only them means your terminal is not discovering the node that publishes the topic you want — usually a different domain ID, a restricted discovery range, or blocked multicast. If the list looks stale instead, run ros2 daemon stop and try again.
Is ROS_LOCALHOST_ONLY still used?
On Humble it is the only switch. Iron introduced ROS_AUTOMATIC_DISCOVERY_RANGE and ROS_STATIC_PEERS and deprecated it; on Jazzy it still works, prints a deprecation warning, and overrides the new variables while it is set to 1. It was removed in Kilted. On Jazzy and later, use ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST instead.
Can a Humble machine talk to a Jazzy machine?
Sometimes, for simple messages, but it is not guaranteed and not supported: the ROS 2 documentation advises using the same ROS version and the same middleware across a system. Mixed fleets are a common source of “some topics work, some don’t”.
Does ROS 2 work over Wi-Fi?
Yes, as long as the network passes multicast, or you use static peers (a discovery server on Humble). Test with ros2 multicast receive and ros2 multicast send before blaming your nodes.