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-...
https://answers.ros.org/question/2101...
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:
http://wiki.ros.org/Robots/TurtleBot/....
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.
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.
Thank you for your response!
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).
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.
No, that's not really how it works.
There is no need to "disable
lo
" or any difficult reconfigurations of anything.From your description it doesn't sound like there is anything special about your system/network.
Setting
ROS_IP
on each host to a reachable IP address and then settingROS_MASTER_URI
tohttp://<IP_OF_THE_HOST_RUNNING_THE_MASTER>:11311
should be ...(more)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.
If you still want us to help you: please provide more information on your network configuration: