Specifically, I could use a relay on teh edge of my LAN which would shorten the relay → A path (D → relay will always be more or less random, I would still probably gain by forcing that part too as I will use the relay at full power).
I also have concerns about C because it lives on a network different from the LAN, the announcements will not go through and I will end up going in a similar way as D.
My questions:
are my concerns viable?
if so, what should I do to enforcethe usage of my relay across the devices?
The default settings should be fine and your devices should connect to each other if your network is not broken. Verify by inspecting each device and verify that they are connected to each other using expected IP addresses.
You’d be better of creating port forwards or similar in your gateways/firewalls to allow direct TCP connections. Private relays should be a last resort, they’ll always give worse performance and are annoying to set up properly.
Thank you. I will set this up for the “server” that has a fixed IP. And manually set the destination on all devices (which is a bit annoying when having quite a few peers)
In that case, can I set my own relay and somehow point the peer devices to use it instead of the public ones?
No need manual destination configuration, discovery will take care of finding the correct address.
Yes you can. However it seems like you don’t need it as you can get direct tcp connections. Which are both more performant and less cumbersome (as explained by Jakob).
Most routers allow configuring fixed IPs for mobile devices, then you could also setup port forwards for those and have a direct connection. So the only remaining problem would be connections between multiple devices on the internet (multiple Ds). In which case a private relay in your LAN doesn’t do much good, connection is still over the internet (you’d get guaranteed bandwidth, which is an advantage of course).
All this happens in my home network so I have control of the settings (having replaced the ISP router with my own which is more configurable). I also work in IT (though not in networking specifically) so all of this is a very interesting challenge. Thanks for the help!
PS. I set up UPnP - having static DHCP addresses is a major pain, especially with phones that advertise a randomized MAC.