# Running ROS Network on Non-Loopback Network Interface

Hello! I'm currently running a very simple ROS network based on the publisher/subscriber Python tutorials using ROS Melodic on Ubuntu 18.04.

I want for this network to be visible to machines outside of the network. However this doesn't seem to be possible and i believe it's because when I run the ROS network, it runs on the loopback network interface. This is very clear from the fact that if I run tshark -i lo, the HTTP/XML messages characteristic of ROS topic communication show up, as well as the default master node port (11311). This does not occur if I run tshark on any of the other network interfaces available from the server.

I've tried configuring the environmental variables (i.e. setting the ROS_MASTER_URI, ROS_HOSTNAME, and ROS_IP variables on the respective master/slave instances). Specifically, I've followed instructions from the following tutorials/forums, with no luck:

http://wiki.ros.org/ROS/Tutorials/Mul...

https://forums.balena.io/t/accessing-...

I've also tried suppressing the loopback interface in hopes of forcing the ROS network to use some other interface (eth0, eno1, etc.), but ROS just doesn't seem to run at all when I do that (and it also does not show up on tshark).

I think what I want to accomplish is something similar to the section "Alternate Network Interface" in this Turtlebot tutorial:

I just don't know how to configure the instructions to work more generally. (i.e. I don't know where the install.sh/install.bash files that I need to change are located).

Thank you so much in advance for any tips, suggestions, pointers, etc.!

UPDATE: I have gotten the ROS network to run on a non-loopback network interface, with the condition that one of the nodes I'm running is on a different machine. However, I'd still like to know if there's a way to move the ROS network onto a different interface when the network is contained on one machine.

edit retag close merge delete

I want for this network to be visible to machines outside of the network

Can you please more clearly describe what you mean by this?

Are you trying to make it possible for ROS nodes on other machines (and/or other networks) to be able to subscribe to topics published to by nodes on your "very simple ROS network"?

The things you describe you did seem rather convoluted and should not at all be necessary.

Please also show any errors or warnings you've observed, as right now your post basically comes down to "I've tried A, B and C and it doesn't work", which is not something we can do anything with.

( 2020-08-04 03:05:02 -0600 )edit

In terms of clarifying my question, I want to run the ROS network on a non-loopback interface, like eth0 or eno2. It is my assumption that if the ROS network is not running on the loopback interface, which is completely internal on a single machine, that it will then be "visible" outside the network (i.e. another node from a different machine can connect to the master node and thus publish to those topics).

I haven't observed any errors or warnings. The issue lies more in the fact that no matter how I configure the environment, the ROS network only shows up on the loopback interface (when I run tshark).

( 2020-08-05 14:42:40 -0600 )edit
1

I want to run the ROS network on a non-loopback interface

this is not really an answer to my question.

You've reiterated why you want to use your chosen solution, not why you believe what you chose is necessary.

It is my assumption that if the ROS network is not running on the loopback interface, which is completely internal on a single machine, that it will then be "visible" outside the network (i.e. another node from a different machine can connect to the master node and thus publish to those topics).

No, that's not really how it works.

There is no need to "disable lo" or any difficult reconfigurations of anything.

Setting ROS_IP on each host to a reachable IP address and then setting ROS_MASTER_URI to http://<IP_OF_THE_HOST_RUNNING_THE_MASTER>:11311 should be ...(more)

( 2020-08-06 03:47:59 -0600 )edit
1

Without more information on why using the regular approach didn't work -- or: what you observed which made you conclude it wasn't working -- it's going to be difficult to help.

1. involved hosts
3. what runs where (ie: ROS Master on PC1, PC2 runs other nodes)
( 2020-08-06 03:50:20 -0600 )edit

Sort by » oldest newest most voted

There is no "ROS" network. ROS doesn't explicitly associate with a specific network, but leverages the IP routing on your host system. If you're setting things up in a container. You just need to make sure that the addresses that you're using are routable on all the systems in both directions and then it should work.

If you're using multiple networks you may need to setup appropriate routing rules to connect the networks appropriately. There are built in linux tools as well as most container infrastructure provide network configuration tools that you can use to make sure that the addresses are routeable.

more