Wireguard vpnon / vpnoff script

I’m moving away from OpenVPN to Wireguard but one function I use on the RUTX50, is the ability to send the device an SMS to turn the OpenVPN on and off.

I need similar functionality for the wg VPN and I’m assuming 2 custom scripts will need to be created.

Can anyone let me know what the customs scripts will look like.

Many thanks in advance.


Something like:

ubus call network.interface.wgname down
ubus call network.interface.wgname up

with wgname being the name of the wg interface.


1 Like

Thanks … I’ll give it a go, and let you know … Mike

Hi, I was getting an error returned, so never having done so, and with no previous knowledge, I used the CLI to look at the various config files along with the helpful intro page at RUTX50 Mobile Utilities - Teltonika Networks Wiki

What I found that worked, were a couple of custom SMS rules in the SMS Utilities, that I created and contain …

To turn ON

uci set network.[insert wg tunnel name].disabled=‘0’
uci commit network

To turn OFF

uci set network.[insert wg tunnel name].disabled=‘1’
uci commit network

I’m not sure if I need to do a commit or not … any idea if I need to use a commit or even if I have to ‘restart’ anything … I assume by adding a last line of …

/etc/init.d/network restart

Hopefully it won’t need a restart.

My thanks for your reply; it set me off on this journey of discovery. If anyone can CONFIRM my conclusions above, I’d be really grateful.



If you choose the uci method you will need the commit and the full network restart. Else the ubus call just does what it is asked to do.

Thanks, I’ll have another peer at it tomorrow, and feedback … thx, Mike

Thanks … got there in the end!

I kept getting command failures but when I ran ‘ubus list network.interface.*’, I realised the wg interface was missing. I enabled the wg interface in Services > VPN > Wireguard > [insert Tunnel name] set to ‘on’ … and Voila!, the commands are executing.

Thanks for your help, it is really appreciated … Mike

This topic was automatically closed after 15 days. New replies are no longer allowed.