ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

ROS 2 talker-listener on 2 machines not working

asked 2022-07-11 14:41:17 -0600

ccpjBoss gravatar image

updated 2022-07-11 14:41:49 -0600

ROS 2: Galactic

RMW: default

OS: Ubuntu

Hello! I am trying to run the talker-listener example but instead of running both nodes locally I am trying to reproduce the same behavior but using two different machines connected to the same network.

Machine 1 (Ethernet): ros2 run demo_nodes_cpp talker

Machine 2 (Wifi): ros2 run demo_nodes_cpp listener


Machine 1: String being published

Machine 2: Empty

I have also tried to run ros2 multicast send and ros2 multicast receive between both machines and nothing happens. When I run these two commands in the same machine, I see the desired output.

I am also not using the ROS_DOMAIN_ID variable, so they should be communicating.

Any help on how to debug this problem?

edit retag flag offensive close merge delete


Can you ping these computers between each other normally?

ljaniec gravatar image ljaniec  ( 2022-07-11 15:34:20 -0600 )edit

Yes I can, but from what I have seen this does not necessarily mean that ROS 2 is able to work in this condition. I think that the problem is that UDP multicast does not work

ccpjBoss gravatar image ccpjBoss  ( 2022-07-11 16:52:17 -0600 )edit

As per, checking with the ping is the first thing to do :) Can you check your firewall settings?

ljaniec gravatar image ljaniec  ( 2022-07-11 16:56:00 -0600 )edit

sudo ufw status returns Status: inactive so I suppose that it is not affecting communications

ccpjBoss gravatar image ccpjBoss  ( 2022-07-11 16:59:52 -0600 )edit

Another thing I should add: When I try this example but with my laptop and a docker container, it also does not work.

ccpjBoss gravatar image ccpjBoss  ( 2022-07-11 17:00:42 -0600 )edit

Interesting... If I run 2 docker containers, they can communicate with each other and the talker-listener example works as expected.

ccpjBoss gravatar image ccpjBoss  ( 2022-07-11 17:02:38 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2022-07-11 17:40:22 -0600

ccpjBoss gravatar image

updated 2022-07-12 02:10:08 -0600

ljaniec gravatar image

I just solved the issue. I'm going to drop the answer here.

So ROS 2 Galactic default rmw implementation is Eclipse Cyclone DDS which does not enable multicast by default. Unfortunately I was not able to get Eclipse Cyclone DDS working.

So I changed to eProsima Fast DDS with export RMW_IMPLEMENTATION=rmw_fastrtps_cpp After changing I learned that multicast is not enabled by default in eProsima Fast DDS either... So I needed to create a file named fastrtps-profile.xml with the following content inside:

<?xml version="1.0" encoding="UTF-8" ?>
<profiles xmlns="" >

<participant profile_name="participant_profile" is_default_profile="true">


This enabled multicast in eProsima Fast DDS. To make DDS use this configuration file, you do: export FASTRTPS_DEFAULT_PROFILES_FILE=<path_to_config_file_created>.

Do this in both machines and it should work!

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2022-07-11 14:41:17 -0600

Seen: 867 times

Last updated: Jul 12 '22