[WireGuard] What is a good way to ingrate (as of now) wireguard into openrc in Gentoo?

Joakim Sindholt opensource at zhasha.com
Mon Nov 21 15:06:53 CET 2016

On Mon, Nov 21, 2016 at 6:15 AM, Kalin KOZHUHAROV <me.kalin at gmail.com> 
> config_wg0=""
> wireguard_wg0="/etc/wireguard/wg0.conf"
> Finally, symlink to net.lo:
>   ln -nfs net.lo /etc/init.d/net.wg0
> Then `/etc/init.d/net.wg0 start` and `/etc/init.d/net.wg0 stop` work
> as expected.

Yep, that's how it's supposed to be used

> EDIT: Add this to /etc/rc.conf to make things run smoothly:
> rc_hotplug="!net.wg?"

I have not experienced any issues like this.

> However `/etc/init.d/net.wg0 restart` sometimes fails silently...
> I am trying to reproduce it, but cannot get the pattern of failures.
> It outputs all fine to the console, but there is no actual interface 
> created...
> [...]
> I tried to debug a few things and my observation is that "sometimes",
> interface is reappearing after `ip link delete dev wg0`...
> Any ideas? I thought am not running any automagic daemons (systemd,
> networkmanager, etc.).
> But... there is some systemd code lurking may be.
> Anyway, I added it to be NOT hotplugged:
> $ grep wg /etc/rc.conf
> rc_hotplug="pcscd !net.wg?"
> And it seems to work! Otherwise the interface gets marked as
> hotpluggable and is being recreated/killed (see the first number  on
> `ip link show dev wg0` constantly growing)

Interesting. I've had problems with other programs interfering in the 
most notably dhcpcd which would nuke my routing rules, but never this.
The script is basically just a whittled down version of the pppd.sh 
and should work in much the same way. I just hacked it up rather quickly
so it's very possible that I missed something really important.
I'm running an otherwise bog-standard clean gentoo install with pretty 
nothing installed and this issue hasn't presented itself so far.
It's being updated today so I'll get on it if I can reproduce it.
Pretty weird though...

More information about the WireGuard mailing list