Once ROS topic connections between nodes are established, they will persist until the underlying network connection is broken.
The network connection can be broken if:
- The TCP connection times out, due to too many dropped packets or an unplugged cable.
- The IP address used on either end of the connection is removed. (This can happen if the IP was on a network interface, and that interface goes down).
Note that there is no dependence on the ROS master once the topic connection between two nodes established. (but the master is required to establish new connections)
For maximum robustness, you should leave ROS_IP and ROS_HOSTNAME unset, and set up host name resolution for all of the machines you're using (either by having a local DNS server, or by manually adding entries to /etc/hosts ). In this configuration, the local hostname will resolve to 127.0.0.1, so local connections can never be disrupted, but remote connections will still use the IP address from the network.