OpenVPN Button Script

I’m trying to write a script for my GL-AR300M button that starts and stops the OpenVPN client. This is my BTN_1 script so far.




#This is the switch of AR300M, left pressed, release right


if [ “$ACTION” = “released” ]; then

uci set glconfig.openvpn.enable=1

uci commit glconfig

/etc/init.d/startvpn start


uci set glconfig.openvpn.enable=0

uci commit glconfig

/etc/init.d/startvpn stop



This works so far and will start and stop the OpenVPN client, however it does not create the VPN_Client interface (tun 0). How do I create and remove the VPN_Client interface with the script?


I am not using the GLi tools as I run TAP to my home server, but not clear on why you feel the need to remove the interface when you stop it.

I do however stop and disable vpn when I want it off.


you need to add the interface manually if you want to do this. Add the following comments to your scripts.

uci set network.VPN_client=interface

uci set network.VPN_client.proto=‘none’

uci set networ.VPN_client.ifname=‘tun0’

uci commit network