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

restrict the traffic to the localhost

asked 2020-08-10 06:45:19 -0500

vincewu gravatar image

Hi Everyone,

When I only have the subscribers on the same host with the publisher, is it possible to restrict the packet published by publisher only to this host instead of letting packet go out via the network interface?

Thanks.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2020-08-10 10:58:34 -0500

Dirk Thomas gravatar image

Since ROS 2 Eloquent you can restrict all communication of an RMW implementation to localhost using the environment variable ROS_LOCALHOST_ONLY(see https://index.ros.org/doc/ros2/Releas...).

edit flag offensive delete link more

Comments

Hi Dirk,

Thanks for your reply. ROS_LOCALHOST_ONLY will restrict all traffic to localhost. However, what I need is restricting the traffic "by topic". For those topics publisher and subscriber are on the same host, restrict the traffic to localhost. For those topics publisher and subscriber are on the different hosts, send out the traffic via the network interface. Is it possible to do this? Thanks.

vincewu gravatar image vincewu  ( 2020-08-12 21:10:56 -0500 )edit

ROS does not have a configuration for that. Maybe with RMW specific configuration you can achieve this.

Dirk Thomas gravatar image Dirk Thomas  ( 2020-08-12 21:14:08 -0500 )edit

You're starting to get into very specific requrements that this might be starting to be a bit of an XY problem. http://xyproblem.info/ For example you may want to look at the Security options which allow you fine grained control of topics access: https://design.ros2.org/articles/ros2...https://ubuntu.com/blog/what-is-sros-2

tfoote gravatar image tfoote  ( 2020-08-12 21:23:34 -0500 )edit
0

answered 2020-08-10 10:04:32 -0500

gvdhoorn gravatar image

If there are no subscribers on other hosts, there should already be no traffic transmitted.

Topic subscriptions are peer-to-peer (in ROS 2 as well as ROS 1), they are not broadcast.

Have you observed topic traffic being sent to other hosts even if they are not subscribing?

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-08-10 06:45:19 -0500

Seen: 703 times

Last updated: Aug 10 '20