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

Network setup for multiple ethernet ports

asked 2020-02-11 20:33:35 -0500

wlee gravatar image

updated 2020-02-13 03:04:56 -0500

gvdhoorn gravatar image

Currently, I'm considering below multi-machine topology using ros1.



I assigned static ip to each eth port as below.

  • eth-sm1-1:
  • eth-sm2-1:
  • eth-mm-1:
  • eth-mm-2:

In the above topology/settings, how do I set ROS_MASTER_URIs of slave machines?


The reason why I connect multi-machine directly, rather than using switch is that

  • Master machine publishes large size of data
  • But the data needed for slave machine 1 is not for slave machine 2, vice versa
  • I want full bandwidth through assigning the dedicated eth-line for each slave

Edit: Thank you for your reply.

Could you possibly clarify below settings based on your answer?

I'm still a bit confused.

Assume that all IP assignments follow the above diagram(in the main text)

On slave machne #1

  • export ROS_MASTER_URI=

  • export ROS_HOSTNAME=

On slave machine #2

  • export ROS_MASTER_URI=

  • export ROS_HOSTNAME=

On master machine

  • export ROS_IP=

  • export ROS_MASTER_URI=http://localhost:11311


The point I'm confused about is ROS_IP of master machine.

I've exported one of IP addresses as ROS_IP at the master(, rather than

In this case, it seem like that slave machine #2 is unreachable from the master since slave machine #2 regards as a master.

Best regards,

edit retag flag offensive close merge delete


An observation:

I connect multi-machine directly, rather than using switch [because] the data needed for slave machine 1 is not for slave machine 2, vice versa

If you get a good switch, the backplane should have sufficient bandwidth to accommodate packet exchange at full speed over all (most) ports. Layer 2 routing will make sure packets only get sent to where they should go. A hub would broadcast all traffic. A switch does not.

gvdhoorn gravatar image gvdhoorn  ( 2020-02-12 03:47:37 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-02-12 04:09:44 -0500

gvdhoorn gravatar image

updated 2020-02-13 03:04:34 -0500

In case of a multi-homed system that is running the master, you need to make sure to set ROS_MASTER_URI to a hostname or IP address that is reachable by the hosts on each respective segment.

As you have all interfaces in the same network, it doesn't really matter what you do, as all hosts will be able to reach all hosts.

So you could choose to either use the .3 or .4 address for ROS_MASTER_URI.

If you'd used different networks, then it would start to matter which IP address you'd use for each host.

Edit: after your edit:

All your network interfaces are in the same network (ie: 192.168.0). Or at least, that's what I'm assuming, as you don't mention the netmask that you've configured (but I'll assume it's /24 or

So it shouldn't matter which IP for your master you configure, as both .3 and .4 should be reachable by all machines. Try ping and ping from both Slave1 and Slave2. You should always get responses.

Pick one of the IPs of your master and configure it as the ROS_MASTER_URI on all machines (including the master itself).

Don't set ROS_HOSTNAME to an IP. Use ROS_IP only.

And don't set ROS_MASTER_URI to localhost for your master. Set it to http://$ROS_IP:11311.

And again I will state that with a good switch, this should not be necessary.

edit flag offensive delete link more


Thank you again for your kind reply.

I'm sorry but I couldn't understand the last comment you gave(i.e. good switch).

Could you point out my misunderstanding?

My understanding is as follow:

Let's assume that the master machine publishes 6 topics(topic 1~6) through one eth port that connected to the good switch.

And assume that both of slave machine #1, #2 are also connected to this good switch using dedicated eth line.

If the required bandwidth of each topic is 0.333Gbps each, the single eth btw master machine and good switch will be overloaded.

wlee gravatar image wlee  ( 2020-02-17 01:16:40 -0500 )edit

A good switch (ie: not a consumer level device) would support trunking or link aggregation (wikipedia article here).

You'd use multiple NICs on your "master machine", combine their bandwidth and end up with a single, logical link between the switch and your PC. This logical link would have only a single IP (it would be seen as a single device by the OS).

That way you could combine multiple Gbit links into 2, 3, 4 or higher Gbit/s links.

An alternative could be to get a switch which supports 10Gbit/s links. Give you master PC a 10Gbit/s link to the switch. Use regular 1 Gbit links for the slaves.

gvdhoorn gravatar image gvdhoorn  ( 2020-02-17 02:05:02 -0500 )edit

Question Tools

1 follower


Asked: 2020-02-11 20:33:35 -0500

Seen: 1,392 times

Last updated: Feb 13 '20