OPNsense Forum

English Forums => Virtual private networks => Topic started by: Bytechanger on February 13, 2024, 10:56:43 AM

Title: Wireguard /usr/local/bin/wg-quick where is it? Restart wireguard tunnel
Post by: Bytechanger on February 13, 2024, 10:56:43 AM
Hi,

I´ve a static wireguard connection to a server with an variable IP-address.
So I set an monit service with testing ping over the tunnel.

I want to restart tunnel with /usr/local/bin/wg-quick up wg2.
This works fine. but after last update /usr/local/bin/wg-quick doesn´t  exists anymore.


Where is wg-quick now?
So how I restart a wireguard server?

os-wireguard-go (missing)


Greets

Byte
Title: Re: Wireguard /usr/local/bin/wg-quick where is it? Restart wireguard tunnel
Post by: franco on February 13, 2024, 12:20:02 PM
wg-quick is a horrible bash script that was removed when we were working on core integration during the 24.1 development phase.

The script you can use is https://github.com/opnsense/core/blob/master/src/opnsense/scripts/Wireguard/wg-service-control.php


Cheers,
Franco
Title: Re: Wireguard /usr/local/bin/wg-quick where is it? Restart wireguard tunnel
Post by: Bytechanger on February 13, 2024, 01:29:58 PM
'Thanks, I´ve seen this, but which parameters should I use?


/usr/local/opnsense/scripts/Wireguard/wg-service-control.php restart wg2  ?


What is   uuid or vhid is this the interface name??


Greets

byte
Title: Re: Wireguard /usr/local/bin/wg-quick where is it? Restart wireguard tunnel
Post by: franco on February 13, 2024, 01:48:28 PM
You can enable the "ID" column from the instances GUI or use the command line for all enabled wireguard instances:

# pluginctl -S wireguard


Cheers,
Franco
Title: Re: Wireguard /usr/local/bin/wg-quick where is it? Restart wireguard tunnel
Post by: Bytechanger on February 13, 2024, 02:20:55 PM
Thanks, I will try it.

Greets

Byte
Title: Re: Wireguard /usr/local/bin/wg-quick where is it? Restart wireguard tunnel
Post by: crpb on August 13, 2024, 08:58:23 PM
For any lost soul...

If your Wireguard "Instance" Name is e.g. "CB"




/usr/local/opnsense/scripts/Wireguard/wg-service-control.php restart $(pluginctl -S wireguard |jq -r '.[]|select(.description|endswith("CB"))|.id')

Title: Re: Wireguard /usr/local/bin/wg-quick where is it? Restart wireguard tunnel
Post by: Fionn on November 14, 2024, 09:28:44 PM
Quote from: crpb on August 13, 2024, 08:58:23 PM
For any lost soul...

If your Wireguard "Instance" Name is e.g. "CB"




/usr/local/opnsense/scripts/Wireguard/wg-service-control.php restart $(pluginctl -S wireguard |jq -r '.[]|select(.description|endswith("CB"))|.id')


Does not seem to work as of OPNsense 24.7.8-amd64

sudo pkg install jq

Fatal error: Uncaught TypeError: flock(): Argument #1 ($stream) must be of type resource, bool given in /usr/local/opnsense/scripts/Wireguard/wg-service-control.php:243
Stack trace:
#0 /usr/local/opnsense/scripts/Wireguard/wg-service-control.php(243): flock(false, 2)
#1 {main}
  thrown in /usr/local/opnsense/scripts/Wireguard/wg-service-control.php on line 243

:-\ :( :'(