Skip to content

Instantly share code, notes, and snippets.

@hiqua
Created March 19, 2025 18:22
Show Gist options
  • Save hiqua/6a53130645c91f3847993ba51a22882a to your computer and use it in GitHub Desktop.
Save hiqua/6a53130645c91f3847993ba51a22882a to your computer and use it in GitHub Desktop.
Remove all static DHCP leases on a Zyxel router
#!/usr/bin/expect
# Remove all static DHCP leases on a Zyxel router.
set timeout 10
set password "MY_PASSWORD"
spawn ssh -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa [email protected]
expect "password:"
send "$password\r"
expect "ZySH>"
for {set i 1} {$i <= 254} {incr i} {
send "cfg static_dhcp delete --Index $i\r"
expect "ZySH>"
}
send "exit\r"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment