Skip to content

Instantly share code, notes, and snippets.

@jesserockz
Last active December 4, 2025 20:32
Show Gist options
  • Select an option

  • Save jesserockz/f6e7dc277c8f850dd3d353d41138bb4b to your computer and use it in GitHub Desktop.

Select an option

Save jesserockz/f6e7dc277c8f850dd3d353d41138bb4b to your computer and use it in GitHub Desktop.
Tailscale script for GL-iNet Beryl AX side switch

Tailscale script for GL-iNet Beryl AX side switch

This script allows you to toggle tailscale settings using the physical side switch on the GL-iNet Beryl AX.

To install:

  1. Copy the below file to /etc/gl-switch.d/tailscale.sh and replace the exit_node_ip value with your exit node ip address.

  2. Make sure to set the execute bit on the new file: chmod +x /etc/gl-switch.d/tailscale.sh

  3. Depending on version:

    4.8.0 and above:
    Copy/write the switch-button file below to /etc/config/switch-button

    4.7.4 and below:
    Go to System -> Toggle Button Settings and choose Tailscale (On/Off) in the dropdown and Apply

# /etc/config/switch-button
config main
option func 'tailscale'
#!/bin/sh
# /etc/gl-switch.d/tailscale.sh
action=$1
if [ "$action" = "on" ];then
enabled=true
lan_enabled=false
wan_enabled=true
exit_node_ip="{{ REPLACE WITH YOUR EXIT NODE IP }}"
elif [ "$action" = "off" ];then
enabled=true
lan_enabled=false
wan_enabled=true
exit_node_ip=""
else
echo "Usage: $0 [on|off]"
exit 1
fi
curl -H 'glinet: 1' -s -k http://127.0.0.1/rpc -d "{\"jsonrpc\":\"2.0\",\"method\":\"call\",\"params\":[\"\",\"tailscale\",\"set_config\",{\"enabled\":$enabled,\"lan_enabled\":$lan_enabled,\"wan_enabled\":$wan_enabled,\"exit_node_ip\":\"$exit_node_ip\"}],\"id\":1}"
sleep 5
@DougS026
Copy link

Has anyone tried using the side switch to toggle between 2 different exit nodes? I gave it a quick go with the older firmware version but didn't get it fully working before having to turn attention to a different project.

@ghzgod do you think it would be possible to modify your kill switch to instead automatically redirect to a backup exit node if the primary drops?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment