[systemd-devel] Activate netdev only on demand (e.g. for wireguard connection)

Amish anon.amish at gmail.com
Fri Apr 2 03:25:41 UTC 2021


On 11/03/21 7:39 pm, Alvin Šipraga wrote:
> Hi,
>
> On 3/11/21 11:01 AM, Reindl Harald wrote:
>> Am 11.03.21 um 06:36 schrieb Amish:
>>> Hello
>>>
>>> So I have a wireguard setup which I use to connect to my server.
>>>
>>> But I do not connect to it daily, just once a in a while.
>>>
>>> I have setup wg0.netdev file and wg0.network file and all is working
>>> fine.
>>>
>>> But how do I set it up such that interface wg0 does not connect
>>> automatically but comes up only when I run:
>>>
>>> #networkctl up wg0
>>>
>>> Effectively I want wireguard to connect/disconnect on demand
>> Amish, I think you described your problem perfectly fine. It sounds like
>> you want to add:
>>
>> [Network]
>> ActivationPolicy=manual
>>
>> to your wg0.network file.
>>
>> More info here:
>> https://www.freedesktop.org/software/systemd/man/systemd.network.html#ActivationPolicy=
>>
>> ...
>>
>> Kind regards,
>> Alvin

So today, I upgraded to systemd 248 and this new feature 
(ActivationPolicy=) works just as I wanted.

Now I can trigger wireguard connection on demand instead of running it 24x7.

Thank you and regards,

Amish.



More information about the systemd-devel mailing list