Wireguard persistent multicast option

Hi! I am configuring multicast routing between two subnets over wireguard tunnel and I need to enable multicast support at wg interface. It is easy to do by a command like (assuming wg0 interface standing for Wireguard):

ip link set wg0 multicast on

How could I configure it to launch at boot? There is an option at Wireguard config (PostUp) but I didn't find such option not at GUI nor at CLI. Appreciate for your advice.

I don't know but google for multicast option to setup in the WG section /etc/config/network on openwrt while you wait for someone more knowledgeable to answer?

Well, I haven't found any list of all possible options that may be used there despite ones described at WireGuard article. No success at googling as well, that is why I am asking community. What is your problem?

Offering friendly advice, you misinterpreted my response as aggressive. I also did not find a solution on the wiki nor googling.

You could probably make a hacky fix in /etc/rc.local including a check for an active interface but that wouldn't work if you cycled the interface. There has to be some config option I would think. Not sure where that stuff is documented though.

1 Like

This hotplug script should do the job, but there may be a more elegant solution that I'm not aware of ...

cat << "EOF" > /etc/hotplug.d/iface/10-wg_multicast
[ "$ACTION" == "ifup" -a "$INTERFACE" == "wg0" ] || exit 0

ip link set wg0 multicast on

exit 0
EOF
3 Likes

I did find the solution, it was so on the surface.

Network - Interfaces - Device Tab - Choose Wireguard Device - Configure - Advanced Device Options - set Enable Multicast Support.

Thanks everyone for help! :cowboy_hat_face:

@wvlad could you do me a favour and check and post how this setting is called within the /etc/config/network? I did not found any hints on the wiki about that option.

Quite tricky option!

When that option is set, device config looks like:

config device
        option name 'wg2'

But if one unset it, we will see it as multicast

config device
        option name 'wg2'
        option multicast '0'

I guess that option multicast '1' is set by default in case of WireGuard

Thanks for the reply. I found myself in a similar situation that I needed to set the multicast flag on the wireguard interface and have done it with the various post up options on different OSs because wireguard interfaces have it often not enabled but they pass multicast traffic just fine. I use it for ospf via wireguard.
Wireguard interfaces do also not get a v6 link local address by default because they are point to point. By if you set multicast and assign a link local address manually you can run the wireguard interface in an IP unnumbered way which drastically simplifies routing setups

I will checkout and try the simply called multicast option. Thanks again. Strange that this is not covered in the wiki.

I got it. At least I think so. It is because you have

config device                  
    option  name            'wg0'

I only had an config interface section (where option multicast has of course no effect), now with the additional config device section I get the multicast flag, too!

1 Like

It's worth to mention, that as of now GUI interface of a wireguard device won't work, so it is necessary to perform manual setup at the configuration file (located at /etc/config/network) of a wireguard device or via luci with a command:

uci set network.@device[N]='1' where N the sequential number of a desired wireguard device (perform uci show network to get to know it)

GUI checkbox which is set by default has no effect, i think this is a bug and we need to report about it, hope you guys @_bernd, @darksky, @darksky could advice were I should refer, thanks!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.