Multicast routing using netplan

multicastnetplanrouting

Trying to setup multicast route to interface in Ubuntu 18.04.2 Netplan's syntax does not allow something like:

routes:
 - to: 224.0.0.0/4
   dev: eno1

this config does not work:

addresses:
 - 192.160.0.1/24
routes:
 - to: 224.0.0.0/4
   via: 192.168.0.1

how to set-up multicast route correctly?

Best Answer

On Ubuntu 20.04, If you only setup to: you would receive a warning saying:

Error in network definition: unicast route must include both a 'to' and 'via' IP

It seems to assume that the route is a unicast route. However via is not necessary when adding a multicast route.

The correct configuration is:

    ens224:
      addresses:
      - 192.160.0.1/24
      routes:
      - to: 224.0.0.0/4
        scope: link

This will result in the following route to be added:

224.0.0.0/4 dev ens224 proto static scope link

scope: is described at: http://manpages.ubuntu.com/manpages/focal/man5/netplan.5.html and more precisely at: http://manpages.ubuntu.com/manpages/focal/man8/ip-route.8.html

              scope SCOPE_VAL
                     the scope of the destinations covered by the route prefix.  SCOPE_VAL may be
                     a number or a string from the file /etc/iproute2/rt_scopes.  If this
                     parameter is omitted, ip assumes scope global for all gatewayed unicast
                     routes, scope link for direct unicast and broadcast routes and scope host
                     for local routes.
Related Question