Skip to content

Instantly share code, notes, and snippets.

@NeKJ
Created January 11, 2020 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NeKJ/204f2c4edb8a66705cdbeda599458bd7 to your computer and use it in GitHub Desktop.
Save NeKJ/204f2c4edb8a66705cdbeda599458bd7 to your computer and use it in GitHub Desktop.
Speedport W 724V static arp update script
#!/usr/bin/expect -f
set timeout 5
proc timedout { } {
puts "\n**** timed out\n"
abort
}
proc abort { } {
puts failed\n
exit 1
}
proc success { } {
puts success\n
}
spawn telnet 192.168.1.1 23
expect {
"Speedport Login:" {}
failed abort
"invalid password" abort
timeout timedout
}
send "admin\r"
expect {
"Password:" {}
failed abort
timeout timedout
}
send "PASSWORD_GOES_HERE\r"
# Wait for a prompt. Adjust as needed to match the expected prompt.
expect {
"Speedport>" {}
"login incorrect" abort
failed abort
timeout timedout
}
send "arp\r"
expect {
"Speedport>" {}
failed abort
"invalid password" abort
timeout timedout
}
send "arp -s 192.168.1.2 ΧΧ:ΧΧ:ΧΧ:ΧΧ:ΧΧ:ΧΧ\r"
expect {
"Speedport>" {}
failed abort
"invalid password" abort
timeout timedout
}
send "arp\r"
expect {
"Speedport>" {}
failed abort
"invalid password" abort
timeout timedout
}
send "exit\r"
# Wait 5 seconds before exiting script and closing all processes.
sleep 1
@NeKJ
Copy link
Author

NeKJ commented Jan 11, 2020

This script updates the static ARP table of Speedport W 724V by adding a static record with the IP and MAC address of a computer. This way the correlation is maintained even after the the ARP tables gets cleared. This is helpful for using Wake On Lan (WOL), which this router does not currently support.

This script requires expect and telnet to be installed

To use just replace:

  • the PASSWORD_GOES_HERE with your router password in line 36
  • the XX:XX:XX:XX:XX:XX on line 55 with your pc's IP and MAC address

@fetuncer
Copy link

fetuncer commented Jan 6, 2024

How did you activate telnet on Speedport W724V? I am looking to do exactly, what your script does.

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