The officially official Devuan Forum!

You are not logged in.

#1 2024-01-20 19:49:43

DavidRLTG
Member
Registered: 2024-01-20
Posts: 20  
Website

How the heck do I get wireguard to be always on?

I know, I know, I'm sorry, I am unsure if this the right place to ask this question on but
Really! I couldn't find much help anywhere. I'm on Devuan OpenRC, using the wgcf (wireguard cloudflare) config.
Is there some way to get the config to load every time I boot up (something similar to the command below):

wg-quick up wgcf-profile

It would really help a lot. Thanks lads, I appreciate any help given.

Last edited by DavidRLTG (2024-01-20 19:50:22)


Both depressed, And obsessed with tech!
That's me smile
-DavidRLTG

Offline

#2 2024-01-22 12:48:28

nixer
Member
From: North Carolina, USA
Registered: 2016-11-30
Posts: 211  

Re: How the heck do I get wireguard to be always on?

Does openrc use sysvinit scripts?  I am not too familiar with openrc/runit/s6, yet, so if I am totally incorrect, please forgive me.

I used this info to create a sysvinit start script using my own wireguard profile config.  I hope it helps.

https://www.procustodibus.com/blog/2021 … it-script/

Offline

#3 2024-01-22 12:49:22

DavidRLTG
Member
Registered: 2024-01-20
Posts: 20  
Website

Re: How the heck do I get wireguard to be always on?

Thank you friend, I'll try it out later!


Both depressed, And obsessed with tech!
That's me smile
-DavidRLTG

Offline

#4 2024-01-22 17:23:48

DavidRLTG
Member
Registered: 2024-01-20
Posts: 20  
Website

Re: How the heck do I get wireguard to be always on?

Hey! I don't think the script works on OpenRC sad
Besides, sorry for being a newbie, But I'm unsure where to put it or how to
add my own config onto it. Any tips?


Both depressed, And obsessed with tech!
That's me smile
-DavidRLTG

Offline

#5 2024-01-22 22:07:25

GlennW
Member
From: Brisbane, Australia
Registered: 2019-07-18
Posts: 644  

Re: How the heck do I get wireguard to be always on?

please see this post... for a conversion script.

https://dev1galaxy.org/viewtopic.php?id=4865

beware of the start and stop levels after converting to suit your situation.

I haven't tested on wireguard... but I have had success with others.

all the best.


pic from 1993, new guitar day.

Offline

#6 2024-01-22 22:09:48

DavidRLTG
Member
Registered: 2024-01-20
Posts: 20  
Website

Re: How the heck do I get wireguard to be always on?

Crap. How do I use it?
Sorry, I'm easily confused, Not really the most experienced linux user here.
Either way, thanks a bunch!


Both depressed, And obsessed with tech!
That's me smile
-DavidRLTG

Offline

#7 2024-01-22 22:13:18

rolfie
Member
Registered: 2017-11-25
Posts: 1,173  

Re: How the heck do I get wireguard to be always on?

openrc is nothing but some sort of overhead on sysvinit. Give those scripts a try, I guess they will work alright.

Offline

#8 2024-01-22 22:19:30

DavidRLTG
Member
Registered: 2024-01-20
Posts: 20  
Website

Re: How the heck do I get wireguard to be always on?

No idea how to add my config to the script. I know, I'm dumb, i just don't see where.
Would you guys be willing to help a complete newbie? 😂
I gotta somehow add wg-quick up wgcf-profile to it. Which lines should I edlt? And where?
No idea how to get stuff like this working, I used to use warp-cli.

Last edited by DavidRLTG (2024-01-22 22:19:44)


Both depressed, And obsessed with tech!
That's me smile
-DavidRLTG

Offline

#9 2024-01-22 22:58:06

nixer
Member
From: North Carolina, USA
Registered: 2016-11-30
Posts: 211  

Re: How the heck do I get wireguard to be always on?

From the link above,

Save the above sysvinit script as /etc/init.d/wg0

or "<your-name>" for the script.  Make it executable.

Change this line in the script, or keep it as is:

interface=wg0

- or -

interface=<your-name>

Follow the instructions on adding the symlinks.  Then try to use the usual service commands to start/stop/status:
service <your-name> start/stop/status

Put your wireguard profile file in /etc/wireguard .  Give it your preferred name, maybe "wg0" or <your-name>.  The name you give it should be the same through the sysvinit script, and the profile name, I think.

Offline

#10 2024-01-22 22:59:38

DavidRLTG
Member
Registered: 2024-01-20
Posts: 20  
Website

Re: How the heck do I get wireguard to be always on?

That helps a lot.
Thank you, friend.
I'll try it tomorrow and leave an update here
smile


Both depressed, And obsessed with tech!
That's me smile
-DavidRLTG

Offline

#11 2024-06-14 16:59:29

bai4Iej2need
Member
From: Ortenau
Registered: 2021-04-25
Posts: 117  

Re: How the heck do I get wireguard to be always on?

my /etc/init.d/wg0

cat wg0              
#!/bin/sh -eu
# checkconfig: 2345 30 70
# description: set up a WireGuard interface simply
### BEGIN INIT INFO
# Provides: wg-quick
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start:	2 3 4 5
# Default-Stop:		0 1 6
# Short-Description: set up a WireGuard interface simply
### END INIT INFO

command=/usr/bin/wg-quick
interface=wg0
description="wg-quick on $interface"
logfile=/var/log/$interface.log

status() {
    /usr/bin/wg show $interface
}

start() {
    touch $logfile && date >>$logfile
    echo "starting $description ..." | tee -a $logfile
    $command up $interface >>$logfile 2>&1
    echo "... started $description" | tee -a $logfile
}

stop() {
    touch $logfile && date >>$logfile
    echo "stopping $description ..." | tee -a $logfile
    $command down $interface >>$logfile 2>&1
    echo "... stopped $description" | tee -a $logfile
}

case "${1-}" in
    status) status ;;
    start) start ;;
    restart) stop || true; start ;;
    stop) stop ;;
    *) echo "usage: $0 {status|start|restart|stop}" ;;
esac

copied with small changes from
https://www.procustodibus.com/blog/2021 … it-script/

Once done run

update-rc.d /etc/init.d/wg0 defaults

server listens at ipv4 and ipv6 :51820
At the moment pinging is possible.
Once this solution has survived some testing, I will add a logrotate file.

If someone has the friendliness to file a bug against the package with this solution, or to complete the missing init-script package ?
(I have problems with reportbug.)

Last edited by bai4Iej2need (2024-06-14 17:01:57)


The devil, you know, is better than the angel, you don't know. by a British Citizen, I don't know too good.
One generation abandons the enterprises of another like stranded vessels. By Henry David Thoreau, WALDEN, Economy. Line 236 (Gutenberg text Version)
broken by design :
https://bugs.debian.org/cgi-bin/bugrepo … bug=958390

Offline

Board footer