Talk:Configure a Wireguard interface (wg): Difference between revisions

From Alpine Linux
m (Indented replies for readability)
 
Line 11: Line 11:
[[User:Anianz|Anianz]] ([[User talk:Anianz|talk]])
[[User:Anianz|Anianz]] ([[User talk:Anianz|talk]])


I can confirm that this was not necessary on 3.18 ([[User:faust|faust]]).
:I can confirm that this was not necessary on 3.18 ([[User:faust|faust]]).


== Bringing up an interface using ifupdown-ng ==
== Bringing up an interface using ifupdown-ng ==
Line 21: Line 21:
Konki
Konki


Hi!
:Hi!
I am not sure if this is the "right" approach but I find it quite simple and clean, just add `post-up` and `post-down` commands in your `/etc/network/interfaces` file, see bellow:
:I am not sure if this is the "right" approach but I find it quite simple and clean, just add `post-up` and `post-down` commands in your :`/etc/network/interfaces` file, see bellow:


   ❯ cat /etc/network/interfaces  
   ❯ cat /etc/network/interfaces  
Line 35: Line 35:
     post-down wg-quick down /etc/wireguard/wg0.conf
     post-down wg-quick down /etc/wireguard/wg0.conf


--[[User:Faust|Faust]] ([[User talk:Faust|talk]]) 17:03, 22 August 2023 (UTC)
:--[[User:Faust|Faust]] ([[User talk:Faust|talk]]) 17:03, 22 August 2023 (UTC)

Latest revision as of 19:37, 22 August 2023

Bringing up an interface using wg-tools

Then load the module

modprobe wireguard

Add it to /etc/modules to automatically load it on boot.

This does not seem to be necessary (any more)?

Anianz (talk)

I can confirm that this was not necessary on 3.18 (faust).

Bringing up an interface using ifupdown-ng

The netifrc package is perfect for mounting the wg0 interface at boot in the specific case of using the plain wg command ( https://wiki.gentoo.org/wiki/Wireguard#netifrc ), but only available for the edge branch.

What is the right approach for loading the configuration file and mount the wg0 network interface, at startup in the stable branch?

Konki

Hi!
I am not sure if this is the "right" approach but I find it quite simple and clean, just add `post-up` and `post-down` commands in your :`/etc/network/interfaces` file, see bellow:
 ❯ cat /etc/network/interfaces 
 auto lo
 iface lo inet loopback
 auto eth0
 iface eth0 inet static
   address 192.168.10.52
   netmask 255.255.255.0
   gateway 192.168.10.254
   post-up wg-quick up /etc/wireguard/wg0.conf
   post-down wg-quick down /etc/wireguard/wg0.conf
--Faust (talk) 17:03, 22 August 2023 (UTC)