Switch a GL.iNet router between Router mode and WDS mode using the physical side toggle.
This project targets GL.iNet / OpenWrt firmware with the programmable toggle switch support used on newer 4.x firmware, including the /etc/gl-switch.d/ hook and /etc/config/switch-button.
The installer is interactive and designed to be launched with a single one-line command over SSH.
- Interactive installer
- Single-line install command
- Uses the hardware toggle switch
- Saves separate
RouterandWDSprofiles - Restores the selected profile automatically when the switch changes
- Persists files across firmware upgrades if you choose that option
- Root access on the router:
ssh root@<router-ip> - GL.iNet firmware with toggle-switch scripting support
- Internet access on the router for the one-line installer
SSH into the router as root, then run:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/zippyy/GL.iNET-Toggle-Switch/main/install.sh)"Or with wget:
sh -c "$(wget -O - https://raw.githubusercontent.com/zippyy/GL.iNET-Toggle-Switch/main/install.sh)"The installer will:
- Install the toggle-switch handler
- Configure
/etc/config/switch-button - Ask whether to keep the files across firmware upgrades
- Let you save the current setup as
Router,WDS, or walk through both
If you do not want to use the one-liner, copy install.sh to the router and run:
sh /path/to/install.shThe installer writes this switch script:
#!/bin/sh
[ "$1" = "on" ] && f=/root/wds-router-toggle/wds.tar.gz || f=/root/wds-router-toggle/router.tar.gz; [ -f "$f" ] || { logger -t wds-router-toggle "missing profile $f"; exit 1; }; logger -t wds-router-toggle "restoring $f"; sysupgrade -r "$f"; rebootMeaning:
- switch
offrestoresrouter.tar.gz - switch
onrestoreswds.tar.gz
This project uses a profile-based approach instead of trying to modify live network settings in place.
That matters because switching between Router and WDS typically changes multiple OpenWrt subsystems at once:
- network
- wireless
- firewall
- DNS / upstream routing
So instead of partially reconfiguring the device, the switch restores a complete saved profile and reboots cleanly.
From SSH:
/etc/gl-switch.d/wds-router-toggle.sh offAfter reboot, test WDS:
/etc/gl-switch.d/wds-router-toggle.sh on/etc/gl-switch.d/wds-router-toggle.sh/etc/config/switch-button/root/wds-router-toggle/router.tar.gz/root/wds-router-toggle/wds.tar.gz
If you choose persistence during install, these paths are also added to:
/etc/sysupgrade.conf- Both saved profiles must come from the same router.
- Restoring either profile reboots the device.
- Save the
WDSprofile only after WDS is fully working. - This is intended for GL.iNet firmware that supports custom toggle-switch scripts.