Robotics StackExchange | Archived questions

Network setup for multiple ethernet ports

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

topo

img-alt-link: https://photos.app.goo.gl/RyRpa77DDowk8vgr6

I assigned static ip to each eth port as below.

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

p.s.

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


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

On slave machine #2

On master machine

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(192.168.0.3, rather than 192.168.0.4).

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

Best regards,

Asked by wlee on 2020-02-11 21:33:35 UTC

Comments

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.

Asked by gvdhoorn on 2020-02-12 04:47:37 UTC

Answers

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 255.255.255.0).

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 192.168.0.3 and ping 192.168.0.4 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.

Asked by gvdhoorn on 2020-02-12 05:09:44 UTC

Comments

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.

Asked by wlee on 2020-02-17 02:16:40 UTC

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.

Asked by gvdhoorn on 2020-02-17 03:05:02 UTC