Hi
I got my AR150 router some days ago and I really love this little thing. Up until now I have used the MR3020 for most of the time which have served me well.
All of my MR3020 are upgraded with 64MB ram and 16MB flash and a external antenna mod.
Now to find the AR150 that comes pre installed with all the MR3020 upgrades I have done just roxx
I am using the AR150 router now and it’s working great. Atm I have a LTE modem connected to it and it is set up to use l2tp VPN to hide my ip (not for security)
To enable/disable the VPN connection I am using the web gui (LuCI) which of course works ok but when I see this little unused switch on the router I immediately wanted to set it up as a VPN on/off switch.
I found some information on this forum regarding the rc.button/BTN_8 script and I did some modification to use it for VPN.
It works great when switching and the router is on. VPN comes on when I switch it to position “1” and drops when I move it back to position “0”.
My problem is that if I enable VPN by moving the switch to “1” and then reboot the router VPN wont come up and the switch is the out of sync.
To enable VPN again I have to switch it first to “0” and then back to “1” again.
To solve this I was thinking of having BTN_8 script to change the network config script and set the VPN interface to “Bring up on boot” but then what if the switch is set to “1” and I shutdown the router for then to set the switch to “0”. This will bring up VPN at next boot and the switch is out of sync again.
So if someone can hale me out here with my issue I would really appreciate it allot.
Here is my BTN_8 script:
#!/bin/sh
echo "$BUTTON ${ACTION}" > /dev/console
if [ .${ACTION}. = .pressed. ]; then
#Button in position "0"
ifdown vpn # take down VPN interface
sleep 1
/etc/init.d/network restart #get default route back. probably not the best way but it works
else
#Button in position "1"
ifup vpn
sleep 1
/etc/init.d/led restart #looks like I need this for the led to work after VPN comes back up
fi
Middle led is also set to blink when VPN come on. Here is the system led script:
config led
option default '0'
option name 'VPN'
option sysfs 'gl_ar150:lan'
option trigger 'netdev'
option dev 'l2tp-vpn'
option mode 'link tx rx'
Is there a way to read the switch status when booting or is the BTN_8 script the only way to get info form the switch?