Introduction
This little program allows for activation or deactivation of a Fritz!Box WLAN. It works reliable and has been tested on Debian-Linux with the following Fritz!Boxes:
•    Fritz!Box 7390
•    Fritz!Box 7170
•    fritzed Speedport W 900V
•    other types might work as well but have not been tested

How it works
In order to control a Fritz!Box WLAN this little Perl program named “fritzwlan.pl” has been written. It can be executed directly from the command line and uses the telnet protocol to retrieve the current status or turn the WLAN on or off. Of course, the telnet-daemon on your Fritz!Box has to be activated beforehand.

So what we need is the following:
•    Activation of telnetd on the Fritz!Box
•    Installation of Perl module Net::Telnet
•    Installation of fritzwlan.pl

Activation of telnetd on the Fritz!Box
Using your Fritz!Box connected handheld phone is probably the easiest way to activate the telnet daemon on your Fritz!box. Just dial
#96*7* for activation
#96*8* for deactivation

Installation of Perl module Net::Telnet
fritzwlan.pl  requires Net::Telnet to function. On Debian systems this module comes with the
libnet-telnet-perl –package and can be installed with the following command:

apt-get install libnet-telnet-perl

Installation of fritzwlan.pl
The installation of fritzwlan.pl is quite simple: Just copy it to a path of your choice (e.g. /usr/local/scripts or whatever). Assuming it resides in /usr/local/scripts you can do a quick test by executing the following command:

/usr/local/scripts/fritzwlan.pl help

=> some usage information about its correct invocation is shown.

Now it is time trying to switch on/off  the WLAN or querying the state. Assuming your Fritz!Box is password protected and has the IP 192.168.178.1 you could use the following commands for status/switching on/switching off:

/usr/local/scripts/fritzwlan.pl  192.168.178.1 password status
/usr/local/scripts/fritzwlan.pl  192.168.178.1 password on
/usr/local/scripts/fritzwlan.pl  192.168.178.1 password off

Please note, it might take a few seconds until the WLAN reaches the desired state. For further information check the output of

/usr/local/scripts/fritzwlan.pl help

 

Copyright (c) 2013, Thomas Hoerndlein, GPL.  All rights reserved, some wrongs reversed.

Attachments:
Download this file (fritzwlan.pl)fritzwlan.pl[frizwlan.pl Version 1.1]2 kB2014-10-18 00:08

You have no rights to post comments