The "domain participant ID" is just a number that allows you to configure a sort of "virtual network" or "virtual overlay" which makes DDS participants that do not use the same number ignore each other, it does not influence the networking component of DDS. See Part 2: Core Concepts > Working with DDS Domains > DomainParticipants > Choosing a Domain ID and Creating Multiple DDS Domains for the RTI explanation of this.
What you are referring to ("only in the same network") is actually due to the fact that in the default configuration many (all?) DDS implementations use (UDP) broadcast traffic for peer discovery.
By default, many routers and gateways are configured to not pass on broadcast traffic from their own network to other networks they are connected to and additionally, the DDS implementation may only broadcast to the local subnet (ie: all IPs in the same range).
But that is not an inherent issue with DDS, nor with ROS2. It's a configuration issue (and many DDS implementations support either discovery with a pre-defined list of participants or a unicast discovery, or even both), and even if the specific middleware doesn't support changing it, there are various networking techniques that can be used to bridge two (or more) network segments in such a way that broadcast traffic is allowed to flow between them.
Originally posted by gvdhoorn with karma: 86574 on 2018-09-21
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by aks on 2018-09-21:
Does that mean, if I use only Unicasting for peer discovery, I cann connect to a compatible DDS participant in any network ?
And that the settings for multicasting can also be configured for the same behaviour?
Comment by gvdhoorn on 2018-09-21:
In theory: yes, that should work.
In practice: internetworking is never easy and can give you interesting problems..
But lots of other techniques can be used as well. There is no need to resort to unicast exclusively.
Comment by aks on 2018-09-21:
Yes, but multicasting is not allowed by most of the Work networks + there is additional overhead of firewalls which could get very tricky.
Comment by gvdhoorn on 2018-09-21:
Note: I wrote broadcast, not multicast. Those are two different things.
If broadcasting is prohibited in a network then a lot of things will stop working.