# How to run example talker/listener on 2 machines with different ipaddr?

**URL:** <https://discourse.openrobotics.org/t/how-to-run-example-talker-listener-on-2-machines-with-different-ipaddr/2106>\
**Category:** ROS General\
**Created:** [July 2, 2017, 1:49am UTC](https://discourse.openrobotics.org/t/how-to-run-example-talker-listener-on-2-machines-with-different-ipaddr/2106 "2017-07-02T01:49:19Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![marguedas](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/marguedas/32/1633_2.png) [@marguedas](https://discourse.openrobotics.org/u/marguedas)\
**Post date:** [July 2, 2017, 2:09am UTC](https://discourse.openrobotics.org/t/how-to-run-example-talker-listener-on-2-machines-with-different-ipaddr/2106/2 "2017-07-02T02:09:36Z")

</div>

Hi @jwang11

ROS2 (and more precisely DDS) uses UDP multicast to communicate the metadata allowing different node to discover each other and establish communication.  
Additionaly DDS allows you to specify a domain ID that is a logical barrier to segregate networks.

If your two machines are on the same network and your network configuration allows UDP multicast communication you should be able to run talker/listener across machines by running:  
On machine 1:

```auto
source <YOUR_ROS2_WORKSPACE>/setup.bash
ros2 run demo_nodes_cpp talker

```

On machine 2:

```auto
source <YOUR_ROS2_WORKSPACE>/setup.bash
ros2 run demo_nodes_cpp listener

```

If you don’t want to interfere with other DDS systems on the same network you can set a domain ID, the domain ID is a number between 0 and 255, I’ll use 42 in the following example:  
On machine 1:

```auto
export ROS_DOMAIN_ID=42
source <YOUR_ROS2_WORKSPACE>/setup.bash
ros2 run demo_nodes_cpp talker

```

On machine 2:

```auto
export ROS_DOMAIN_ID=42
source <YOUR_ROS2_WORKSPACE>/setup.bash
ros2 run demo_nodes_cpp listener

```

---

_[View the full topic](https://discourse.openrobotics.org/t/how-to-run-example-talker-listener-on-2-machines-with-different-ipaddr/2106)._
