What's new

Stop/Stop WireGuard wgc1 from command line?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

mattmcspirit

Occasional Visitor
Hey all -

I've successfully setup a WireGuard connection from the XT8 to a WireGuard server running in AWS, and traffic is flowing successfully

I don't need access to this particular VPN 100% of the time, so to enable/disable, rather than log into the Admin GUI -> VPN Director -> Enable/Disable (WGC1), I'd prefer to be able to quickly SSH into the router and run a command to start/stop/check status. I'm looking to ideally tie it to an IOS Shortcut, but for now, just automating it on/off would be great.

Could anyone please point me in the right direction?

Thanks!
Matt
 
Thanks for that - I hadn't used the Better Search before, I've now found what I was looking for.

For reference, I put together a simple IOS Shortcut that runs a Shell script that initially checks for the output of "wg". If that returns nothing, my single wg client is currently disconnected, so a Shell script runs:

set wgc1_enable=1;
service "start_wgc 1"

On the other hand, if running "wg" returns a result, my single wg client is already running, so a Shell script runs the reverse command:

set wgc1_enable=0;
service "stop_wgc 1"

The use of double quotes around "stop_wgc 1" and "start_wgc 1" was the only way I found to start that specific client; however, I see there are other options here: https://www.snbforums.com/threads/a...available-for-select-models.81644/post-803473 such as just flipping the enable variable, then running service start_wgc/service stop_wgc to turn on/off that "enabled" peer.

Simple enough and works for my use case.

Thanks!
 
Are there any updated instructions or tips here? On AX86U Pro here (and running 388.2_2), and when I run those commands, the VPN director interface does not reflect that it has been turned on, and the VPN Status tab shows the Wireguard connection box with no information inside of it or an empty "Client Status" box (as opposed to enabling by hand in the VPN director interface, where it then shows the connecting information under the Wireguard connection in a box titled "Client Status"). Are there some extra commands I must send in addition to the ones above?
 
Last edited:
So the actions DO seem to work and connect/disconnect to the wireguard vpn server, so I am guessing this is just a bug in the web ui that will not show properly if these commands are issued via command line?
 
So after much testing I believe this is a bug in the web UI not updating itself when the command line items are run. Is there an official place to report such a bug, or is this it? :)
 
Have you tried running the command
Code:
service restart_httpd
thanks for the suggestion I will give it a try. But what is strange is that this type of extra command is not necessary when starting an openvpn client. When I do that, the interface updates itself properly. And even with a wireguard command, PART of the interface DOES update properly, it is just missing the client connect info on the VPN status tab and the changing of the icon next to the wireguard client config in the VPN Director tab

UPDATE: I tried it, and it did not work. All it did was log me out of the UI, and when I logged back in, I saw the same missing data as before.
 
Last edited:

Similar threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top