How to configure CycloneDDS to use multiple network interfaces?

38 views (last 30 days)
When you use CycloneDDS as the ROS 2 middleware (RMW), communication may fail across one or multiple network interfaces such as, Ethernet, WSL virtual adapter, or WiFi. Even though the host is able to connect to multiple networks, MATLAB may not be able to discover nodes across all the network interfaces. How to enable discovery of nodes on all desired interfaces?

Accepted Answer

Abhishek
Abhishek on 30 Oct 2025 at 5:59
Edited: Abhishek on 30 Oct 2025 at 6:02
By default, CycloneDDS may not be able to evaluate if communication is possible across multiple network interfaces, unless you explicitly configure them. To configure desired network interfaces, follow the steps below:
  1. Open a MATLAB® session.
  2. Create a file named “cyclonedds.xml”.
  3. Copy and paste the following XML content into the file.
<CycloneDDS xmlns="https://cdds.io/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://cdds.io/config https://raw.githubusercontent.com/eclipse-cyclonedds/cyclonedds/master/etc/cyclonedds.xsd">
<Domain>
<General>
<Interfaces>
<NetworkInterface name="vEthernet (WSL (Hyper-V firewall))"/>
</Interfaces>
<DontRoute>true</DontRoute>
</General>
</Domain>
</CycloneDDS>
  • Set the value of <NetworkInterface name=""/> in the code to define each network interface.For example, if your interface is vEthernet (WSL (Hyper-V firewall)), add <NetworkInterface name="vEthernet (WSL (Hyper-V firewall))"/>.
  • Set the General/DontRoute tag to prevent automatic routing that can interrupt communication when multiple interfaces are configured.
4. In MATLAB command window, run the following command to set the 'CYCLONEDDS_URI’ environment variable to point to the “cyclonedds.xml“ file.
setenv("CYCLONEDDS_URI", "<path/to/cyclonedds.xml>")
5. After you set the environment variable, run the following command in the MATLAB command window to clear existing resources and then list the nodes available in network:
clear all;
ros2 node list

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!