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

Topic sharing in two different newtworks.

asked 2014-09-04 23:50:31 -0500

enddl22 gravatar image

updated 2014-09-04 23:59:17 -0500


I am trying to share a topic between two different networks.

There are three computers and let's call them as PC1,PC2, and PC3. (all are ubuntu and running ROS)

Each PC has the following network settings.


wlan0 (obtaining IP from ISP's DHCP) IP:

eth0 IP:

PC2: eth0 (Static IP address) IP: Gateway:

PC3: wlan0 (obtaining IP from ISP's DHCP) IP:

For more explanations, I have two network adaptors named: wlan0 and eth0 on PC1.

wlan0 connects to ISP's network (the Internet is connected) and obtain a IP address through ISP's DHCP. (let's say

eth0 is a gateway that has a static IP address ( and PC2 is connected to PC1 through wired for the Internet sharing. (It works). iptable is properly set up for forwarding from wlan0 to eth0.

ROS master is running on PC2 which has a IP address ( This machine publish a simple topic such as "/test/topic" with std_msgs/String type.

What I want is that subscribing the topic "/test/topic" from PC3. I can subscribe the topic on PC2 by setting ROS_MASTER_URI to but PC3 can't connect to PC2 since they are belongs to different networks. (192.169.x.x) and (121.131.x.x).

I already attempted ros multimaster_fkie but still couldn't subscribe anything on PC3.

I think I do need some iptable settings from eth0 to wlan0 on PC1 as it done for the Internet sharing (from wlan0 to to eth0).

Any comments on this issue would be appreciate.


PS: I am bit afraid whether the explanation is understandable or deliver my point or not as my network setting environments is messy.

edit retag flag offensive close merge delete


did you set ROS_IP ?

bvbdort gravatar image bvbdort  ( 2014-09-05 00:15:45 -0500 )edit

Yes, but no success.

enddl22 gravatar image enddl22  ( 2014-09-05 02:05:28 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-09-05 01:06:17 -0500

ahendrix gravatar image

ROS does not cross NAT firewalls. You should probably run one ROS master on each network and try to set up some kind of topic forwarding between them.

edit flag offensive delete link more


Thanks for the comment. Do you know any reference for topic forwarding? I guess you refer to packet forwarding using "iptables". I attempted to forward all packet from PC2 to PC3 by setup iptables rules on PC1. It is possible to send a message using netcat but roscore running on PC3 can't subscirbe.

enddl22 gravatar image enddl22  ( 2014-09-05 02:05:19 -0500 )edit

Hello. I ran into the same problem. Have you solved this?

DufeRob gravatar image DufeRob  ( 2017-05-19 06:18:21 -0500 )edit

Question Tools

1 follower


Asked: 2014-09-04 23:50:31 -0500

Seen: 506 times

Last updated: Sep 05 '14