wg-quick (script snippets) for OpenWRT/LEDE

Yousong Zhou yszhou4tech at gmail.com
Mon Apr 9 05:05:22 CEST 2018

On 3 April 2018 at 23:19,  <vtol at gmx.net> wrote:
> Hi,
> it appears that wg-quick is not provided for OpenWRT/LEDE.
> The reason is not really clear to me. As far I understand wg-quick depends
> on BASH whilst the default shell in OpenWRT/LEDE is ASH.
> This however can be easily remidied by installing the BASH package from the
> OpenWRT/LEDE repo.
> OpenWRT/LEDE is utilising netifd for network configuration which is lacking
> th3 versatility of wg-quick with there script snippets
> PRE_UP=( )
> POST_UP=( )
> PRE_DOWN=( )

POST_UP and POST_DOWN is possible with hotplug scripts in OpenWrt, but
the PRE_xx callback is currently not possible.  As a temporary
workaround, you can try patching locally /lib/netifd/proto/wg.sh to
achieve similar effects, or wrapping wg command with a script (hacky
wacky way)

> Is there a way to get those script snippets working in OpenWRT/LEDE as such
> is required in dynamic/split/kill-switch routing scenarios.

Just try installing all those dependencies wg-quick requires, though
after you know enough details about the wg-quick script, you may well
just write your own stripped down version for your own needs.

> OpenVPN provides a similar script functionality which is however not
> stripped on the OpenWRT/LEDE repo, respectively it does not require an extra
> tool package. I find it rather curious that the aforementioned script
> snippets are not part of wg but rather implemented in wg-quick which then is
> absent from OpenWRT/LEDE.

OpenVPN and WireGuard is different in this regard.  OpenVPN has a
daemon running while WireGuard depends on the network manager to do
the maintenance things.


More information about the WireGuard mailing list