Ask Your Question

ROS2 - Remote Node Setup

asked 2018-03-27 13:48:07 -0500

cbquick gravatar image

Is it possible using ROS2, to have two nodes on different networks each connected to the Internet, communicate with each other (i.e. publish and subscribe messages and topics)? If so, any information or insights on how to accomplish this type of setup would be greatly appreciated.

I understand how to setup two nodes on the same network so that they communicate using ROS2 but I can't find the settings or perimeters needed for 'remote' nodes to locate and communicate together.

Any and all help is greatly appreciated.

edit retag flag offensive close merge delete


@cbquick Have you been able to accomplish this in the meanwhile? If so, can you share some insights? Would be greatly appreciated!

coenig gravatar image coenig  ( 2019-02-19 07:25:47 -0500 )edit

Unfortunately no, I don't have a solution at this time. I wish you the best of luck!

cbquick gravatar image cbquick  ( 2019-02-19 10:13:48 -0500 )edit

Thanks anyway! If I find a feasible solution I will write an answer here (but I won't dive too deep as I assume that there will be an official solution at some point...)

coenig gravatar image coenig  ( 2019-02-20 04:49:38 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-03-27 16:08:07 -0500

William gravatar image

We don't have any networking guides for ROS 2 yet.

However, ROS 2 uses DDS by default, so you could draw on those resources to get help configuring your network to allow DDS traffic. For both ROS 1 and ROS 2, communication over the internet has two challenges, discovery and peer-to-peer communication.

tl;dr I'd use VPN between the remote computers, and set it up to forward multicast UDP as well.


But, for the case you specifically laid out, it will be difficult. DDS does discovery over UDP multicast and UDP unicast. So doing discovery across the internet is not going to work that way. This is because UDP multicast will not work over the internet as far as I know.

In ROS 1 you could solve this by making the ROS master publicly accessible on the internet, and pointing the nodes on the remote machine to the public IP and port for the machine running the ROS master. However, the nodes still communicate peer-to-peer.

In ROS 2, I don't know of a generic solution, but individual DDS implementations may have tools for relaying discovery information across the internet. Though I don't think that will be very easy to use with ROS 2 because there isn't a portable way to do it that of which I am aware.

peer-to-peer communication

After connecting discovery, you still need individual nodes to be able to communicate with each other.

In ROS 1 this is very hard because nodes let the OS pick ports randomly, so you don't know how to NAT or open your firewall to let them talk.

In ROS 2, the ports that are used are deterministic according to an algorithm, for example see:


So you could open the right range of ports for peer-to-peer in ROS 2 if you wanted.


So in summary, it's possible to do discovery over the internet with ROS 1, but not realistic to do discovery with ROS 2 over the internet. For peer-to-peer, it's impossible to predict the ports ROS 1 will use, but you can predict and therefore open up ports for ROS 2.

But for both ROS 1 and ROS 2, I wouldn't suggest exposing either publicly to the internet for security reasons.

So in conclusion, I would recommend using VPN for either ROS 1 or ROS 2, for both simplicity and security.

edit flag offensive delete link more


re: VPN: you could take a look at tinc. It's a relatively easy to setup peer-to-peer VPN, works on just about any platform and deals with NAT and other weird networking setups transparently.

gvdhoorn gravatar image gvdhoorn  ( 2018-03-28 02:24:05 -0500 )edit

Thank you both! @William Would it be possible, with the public IP address to the Internet based nodes, to use the fast RTPS 'Advanced Configuration' options for network configuration, listening locators, and sending locators to specify nodes on different networks and get ROS2 communication working?

cbquick gravatar image cbquick  ( 2018-03-28 10:54:35 -0500 )edit

@cbquick, yes, though it depends on whether or not you can do this without changing the code itself (not sure off hand). It might be something the Fast-RTPS community could answer better than me.

William gravatar image William  ( 2018-03-28 16:15:04 -0500 )edit

We don't expose those options through our API, but if you know you're using Fast-RTPS you can get the Fast-RTPS objects directly from our API like this:

William gravatar image William  ( 2018-03-28 16:24:51 -0500 )edit

Does ROS2 still use the ros_master_uri environment variable?

shoemakerlevy9 gravatar image shoemakerlevy9  ( 2018-05-21 23:37:43 -0500 )edit

No, ROS 2 doesn't use any master and therefore also not that environment variable.

Dirk Thomas gravatar image Dirk Thomas  ( 2018-05-21 23:58:55 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-03-27 13:48:07 -0500

Seen: 2,585 times

Last updated: Mar 27 '18