@Renzo_Ba thanks for posting the details here, that is really helpful what could happen changing network interfaces at runtime.
and this is know behavior. i think basically it depends on RMW implementation (e.g DDS) and IP routing configuration. all of the situation described here is that endpoints cannot communicate with each other because they are using different network interfaces. ROS 2 is not aware of these network configuration change during runtime, so we need to restart the ROS 2 node in these cases.
the following could be interesting for you.
ros2:rolling
← jakymiws:irobot/add-dynamic-network-notify-function
@alsora appreciate the information, thanks for sharing. apparently we almost hav… e the same use cases 😄
I have considered this kind of feature before, so posting my note here. hopefully this could bring more discussion.
### Network Detection / Awareness
#### Overview
I just want to come up with questions and possible requirements in robots, robotics and edge devices.
As described below, nodes could be connected, disconnected or transited the network status based on dynamic physical environment.

#### Possible Situations
- Participation (OFF -> ON): right after boot the system, there would be no network connection at all. but as robots move around, it eventually find the network interface.
- Transition (ON -> ON): as robots are moving in long distance, network interface could be changed. (Internally, ON -> OFF -> OF)
- Leave (ON -> OFF): as robots are moving, they eventually leave from the network range.
#### Requirements / Capabilities
- Application should be able to know the network connectivity status and configuration? (set and get network configuration.)
- Application should be notified with network status or configuration change event? so that it can issue the API to reconfigure the network once it is back online? (event notification)
#### Consideration / Note
- AFAIK, ROS 2 / DDS is NOT aware of network. it just relies on network but cannot detect those status or events to restart the application.
- most devices currently we have in home, we by here end users can physically help to fix the network problems, such as smartphone, tablets and so on to access the system. but this is not likely robots use cases, so that it should be able to self-healing?
- specific use cases like factory and logistics, we probably want to use specific network interfaces only nothing else. this means that user can configure possible network interfaces as we like.
- network infrastructure in edge IoT devices could be not stable enough, sometimes network connection is gone.
Currently i was thinking that this is doable with following and restarting ROS 2 node (DDS participants), but happy to discuss.
- use linux interfaces. (man 7 netlink NETLINK_ROUTE) create/delete/up/down events https://man7.org/linux/man-pages/man7/netlink.7.html
- NetworkManager DBus event. e.g) nmcli
- systemd device units via DBus, https://unix.stackexchange.com/questions/159641/systemd-restart-service-when-ip-address-changed
3 Likes