Is there a way to identify which network card the ros2 program data goes through (network port or WIFI)?

Is there a way to identify which network card the ros2 program data goes through (network port or WIFI)?

I have two machines, each machine is configured with eth0 and wlan0, and the eth0 and wlan0 of the two machines can ping each other, so I want to know where my ros2 data goes

You could run “tcpdump -i eth0” and “tcpdump -i wlan0” and see where your robot’s traffic is.

I’ve just opened a similar issue on stack exchange: ros2 - Why does DDS in ROS 2 use all participant locators for sending data instead of just one? - Robotics Stack Exchange . The takeway seems to be that at least with FastDDS, the data goes via all interfaces by default! :confused:

Thank you for your reply, but what I want is how to know where my ros2 program went. Is there any simpler way or tool?

i have set my dds profile like this
i want to my ros2 data went to 192.168.41.2 only, but some case maybe cause it went to wlan0

I’m using a similar profile and it seems to me there’s a bug in FastDDS. If PC1 has an IP from a subnet PC2 doesn’t have, then data sent from PC2 to PC1 go (also) to this address regardless of the DDS profile. And because PC2 doesn’t have address from this subnet, the data end up being sent via the default route.

TLDR: if you don’t configure anything, the data rnd up being sent over all network interfaces (i.e. on copy of the data on each interface).

NB: I may be (and really would like to be) wrong, but this is the understanding I got after reading docs and observing the live system). Maybe @Jaime_Martin_Losa could shed some light on this so that we don’t spread misinformation here :slight_smile: