Robotics StackExchange | Archived questions

ROS Network Setup with Port Forwarding Question

Hello,

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

Computer 1:

Computer 2:

Computer 3:

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.

Asked by msaka on 2016-04-12 18:48:17 UTC

Comments

Answers

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

network

(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.

Asked by gvdhoorn on 2016-04-13 03:33:26 UTC

Comments

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

Asked by msaka on 2016-04-15 17:44:37 UTC

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 192.168.1.101 but with the gateway set to Computer 1 IP i.e. 192.168.1.112?

Asked by msaka on 2016-04-15 18:08:59 UTC

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.

Asked by gvdhoorn on 2016-04-16 01:33:42 UTC