We have a gateway product running Ubuntu 20.04 LTS. It has two network interfaces (WAN/LAN) configured using
systemd-networkd. We use multicast messages to communicate to thousands of IoT devices connected to the LAN. It is important these multicast messages do NOT go out on the WAN since it could inadvertently change the behavior of IoT devices that may be present on the WAN side.
To ensure multicast messages are routed only to the LAN, the LAN configuration includes the following:
[Route] Destination=188.8.131.52/4 Type=multicast
Problem is the multicast route only gets loaded if the LAN interface has a CARRIER (cable plugged in). If there is no carrier, the multicast route is never loaded so multicast messages go out on the WAN. Most of the time, the LAN interface will have a cable plugged in, but this cannot be guaranteed (esp. during bring-up).
We've experimented with setting
ConfigureWithoutCarrier=true on the LAN interface. This seems to ensure the multicast route is always loaded regardless of whether or not the cable is plugged in. But is there a better way to configure a multicast route to ensure multicast messages never go out on the WAN interface?