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

ROS Network Setup with Port Forwarding Question

asked 2016-04-12 18:48:17 -0500

msaka gravatar image

updated 2016-04-13 06:53:47 -0500

Airuno2L gravatar image


I have a question regarding ROS Network setup with multiple computers. My current setup is:

Computer 1:

  • local wifi network ip:
  • local ethernet connection to Computer 2 ip:
  • ROS_IP:

Computer 2:

  • local ethernet connection to Computer 1 ip:
  • ROS_IP:

Computer 3:

  • local wifi network ip:

I would like to have Computer 3 as the ROS Master. Computer 2 is running a ROS node which I would like to view on Computer 3. However, Computer 2 doesn't have a local wifi connection and is connected to Computer 1 through an ethernet connection. Therefore Computer 2 can't see Computer 3 as the ROS Master since it's not on the local wifi network. How can I setup my ROS nodes such that I can view topics being published on Computer 2 on Computer 3? Do I have to setup some sort of port forwarding on Computer 1?

Any help would be appreciated.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-04-13 03:33:26 -0500

gvdhoorn gravatar image

updated 2016-04-13 03:42:42 -0500

It always helps me to draw a diagram for networking questions, so here is one:


(note that it was a bit unclear from your description whether Computer 1's IP is .1 or .2. I'm guessing .2, as you have ROS_IP set to .1 for Computer 2, but it doesn't really matter. I'll update the diagram if/when you clarify)

To get Computer 2 to communicate with Computer 3, you should probably setup Computer 1 to route between the two networks. Routing will let any host on the wired network communicate with any host on the wireless network bi-directionally. Port forwarding is possible (that would be masquerading), but is a bit brittle when both sides of the device doing the masquerading want open connections to each other at random ports, as it is (in it's default configuration) a one-way affair.

For routing, see this answer on Ask Ubuntu for an example configuration. Provided you have everything else setup correctly on the ROS side, things should just work.

Note that I've completely ignored any security issues here that could arise when linking two networks together like this, so do make sure to check up on that as well.

Edit: an alternative would be to bridge the two network together. That would essentially make the wired and the wireless network a single network. This might work better for things that rely on broadcasts.

edit flag offensive delete link more


Thank you this is exactly what I was looking for. I will try routing the connection between the two networks on Computer 1.

msaka gravatar image msaka  ( 2016-04-15 17:44:37 -0500 )edit

I'm a little confused by the answer in the routing link. Using my setup, I should enable IP forwarding on Computer 1 by enabling ip_foward and then on Computer 3 I need to edit the Wifi link so Computer 3 IP is still but with the gateway set to Computer 1 IP i.e.

msaka gravatar image msaka  ( 2016-04-15 18:08:59 -0500 )edit

If you also want these computers to be able to reach 'the internet', you probably don't want to set their default gateway to C1, unless C1 knows how to get to the internet. You'd basically have to setup static routes that tell C2 how to get to C3 and vice-versa.

gvdhoorn gravatar image gvdhoorn  ( 2016-04-16 01:33:42 -0500 )edit

Question Tools



Asked: 2016-04-12 18:48:17 -0500

Seen: 3,613 times

Last updated: Apr 13 '16