AutoAP

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 15:27, 13 January 2007 (edit)
Marcjohnson (Talk | contribs)
m (Links)
← Previous diff
Revision as of 22:48, 15 March 2018 (edit) (undo)
Ian5142 (Talk | contribs)
(Added Categories.)
Next diff →
(48 intermediate revisions not shown.)
Line 1: Line 1:
-[[glossary#autoap| AutoAP]] is a script that continuously scans for open Wi-Fi connections, tests them for validity, and connects to the strongest signal. If the connection is lost, the script scans again and finds the strongest valid signal again, and maintains a continuous connection to the internet in a mobile or portable environment. The script paremeters are highly configurable, including ability to configure secure WEP connections.+{{languages|AutoAP}}
 +[[glossary#autoap| AutoAP]] is a script that continuously scans for open Wi-Fi connections, tests them for validity, and connects to the strongest signal. If the connection is lost, the script scans again and finds the strongest valid signal again, and maintains a continuous connection to the internet in a mobile or portable environment. The script paremeters are highly configurable, including ability to configure secure connections.
-Typically, you would use this script on your router while in [[Client_Mode_Wireless | Client Mode]], [[Wireless_Bridge | Client-Bridged Mode]], or [[UWR | Repeater Mode]].+Typically, you would use this script on your router while in [[UWR | Repeater Mode]], [[Client_Mode_Wireless | Client Mode]], or [[Wireless_Bridge | Client-Bridged Mode]].
Line 7: Line 8:
... [[Installation | flash your device]]<br> ... [[Installation | flash your device]]<br>
... use the [[Web Interface]]<br> ... use the [[Web Interface]]<br>
-... use [[Client_Mode_Wireless | Client Mode]], [[Wireless_Bridge | Client-Bridged Mode]], or [[UWR | Repeater Mode]]<br>+... setup [[UWR | Repeater Mode]], [[Client_Mode_Wireless | Client Mode]] or [[Wireless_Bridge | Client-Bridged Mode]].<br>
=Installation= =Installation=
-There are several ways to install AutoAP:+There are several ways to install AutoAP.
==Dynamically Download== ==Dynamically Download==
Line 19: Line 20:
nvram set wl_ssid="" nvram set wl_ssid=""
`cd /tmp; until [ 2 = 1 ];do /bin/sleep 30; `cd /tmp; until [ 2 = 1 ];do /bin/sleep 30;
- /usr/bin/wget <nowiki>http://d4308987.u22.infinology.com/code/autoap.sh;</nowiki>+ /usr/bin/wget -Oautoap.sh <nowiki>http://downloads.sourceforge.net/autoap/autoap_090711.sh;</nowiki>
- chmod 777 ./autoap.sh;./autoap.sh;done` & + chmod 777 ./autoap.sh;./autoap.sh;done` &
:* Click the Save Startup button :* Click the Save Startup button
:* Reboot your router :* Reboot your router
 +:* Verification: After a minute or two, go to http://RouterIP/user/autoap.htm (where RouterIP is your router's IP address) to view the html log, which is setup by default. If you see a log, this indicates Autoap was successfully downloaded and instantiated. You may also telnet into the router and perform a "ps" to verify the script is running.
==Built-in Image== ==Built-in Image==
If you would like to have autoap built into an image: If you would like to have autoap built into an image:
-:* Download firmware image with AutoAP script built in (see sourceforge link and caveats in "Links" section below)+:* Download firmware image (link? url?) with AutoAP script built in (see sourceforge link and caveats in "Links" section below)
:* [[Installation|Flash]] your router with this firmware :* [[Installation|Flash]] your router with this firmware
:* After flashing go to tab "Administration", subtab "Command" :* After flashing go to tab "Administration", subtab "Command"
Line 34: Line 36:
:* Reboot your router :* Reboot your router
-==JFFS or Samba==+==JFFS==
-You can use [[JFFS]] or [[Samba]] to directly call the AutoAP script. +You can use [[JFFS]] to directly call the AutoAP script.
 +:* Make sure [[JFFS]] is enabled (disabled by default)
 +:* Make sure [[SSH]] is enabled (disabled by default)
 +:* Download the stand-alone AutoAP script (see Links below)
 +:* If downloaded file is named something different, rename it to <code>autoap.sh</code> and put it into <code>/jffs/</code> using [[SSH]].
 +:* Chmod <code>autoap.sh</code> to 777 using [[SSH]] (or telnet).
 +:* Use the same startup script as in "Built-in Image" above but use:
 + /jffs/autoap.sh &
 +:* Instead of:
 + /bin/autoap &
 +:* Reboot router
 +:* After you have it working, [[SSH]] can be disabled.
 + 
 +==Samba==
 +You can use [[Samba]] to directly call the AutoAP script.
:* Obtain the stand-alone AutoAP script (see Links below) :* Obtain the stand-alone AutoAP script (see Links below)
-:* Put it into your router flash memory (using [[JFFS]]) or somewhere on your local network (using [[Samba]]).+:* Put it somewhere on your local network (using [[Samba]]).
-:* Use the same startup script as in "Built-in Image" above but reference your JFFS or Samba path instead of <code>/bin/autoap</code>.+:* Use the same startup script as in "Built-in Image" above but reference your Samba path instead of <code>/bin/autoap</code>.
=Usage= =Usage=
-You can change the behavior of AutoAP script by setting [[Hardware#NVRAM|NVRAM]] variables. For example, let's set AutoAP logging to html file. +You can change the behavior of AutoAP script by setting [[Hardware#NVRAM|NVRAM]] variables. For example, let's set AutoAP to prefer to connect to a certain, wep-encrypted network (SSID: my_net" wep-key: abcdef1234 ) before trying others.
:* Go to tab "Administration", subtab "Command". :* Go to tab "Administration", subtab "Command".
:* Copy and paste the following into the edit box: :* Copy and paste the following into the edit box:
- nvram set autoap_logger="html" + nvram set autoap_prefssid="my_net*key*abcdef1234"
nvram commit nvram commit
:* Click the Run Commands button :* Click the Run Commands button
:* Reboot your router :* Reboot your router
-Now the repeater status will be available at <code><nowiki>http://RouterIP/user/autoap.htm</nowiki></code> (where RouterIP is the IP address of your router).+Now it will only try other APs if the preferred one has no internet connectivity. Of course you could also give more than one preferred AP.
- +
=NVRAM Variables= =NVRAM Variables=
-What follows is a complete list of included [[Hardware#NVRAM|NVRAM]] variables and what they do (with default values): +What follows is a complete list of included [[Hardware#NVRAM|NVRAM]] variables and what they do (with default values). Be aware that these refer to the most recent versions of autoap. Older version may have different variables. To be sure just check in the history of the wiki for the date of your version.
-:'''nvram set autoap_logger="syslog"''' [Valid values: syslog, html, /path/to/logfile]+:'''nvram set autoap_logger="html"''' [Valid values: syslog, html, /path/to/logfile]
::When set to 'syslog', AutoAP will send all logdata to syslog. Depending on your log level settings, you will see more or less data. AutoAP has quite a bit of log data it sends, however if your log level is set to high, the router should only send out important autoap notices, like new connections, disconnections, or errors. If set to low, it will show you debug data. ::When set to 'syslog', AutoAP will send all logdata to syslog. Depending on your log level settings, you will see more or less data. AutoAP has quite a bit of log data it sends, however if your log level is set to high, the router should only send out important autoap notices, like new connections, disconnections, or errors. If set to low, it will show you debug data.
-::When set to 'html', the log data is written to a file available via the web interface at <code><nowiki>http://RouterIP/user/autoap.htm</nowiki></code>. This log is kept trimmed to 1000 lines.+::When set to 'html', the log data is written to a file available via the web interface at <code><nowiki>http://RouterIP/user/autoap.htm</nowiki></code>. This log is kept trimmed to ''autoap_logsize'' lines.
-::When set to a path, i.e. '/tmp/newautoap.log', the log data will be saved to that location. This will also be trimmed to 1000 lines.+::When set to a path, i.e. '/tmp/newautoap.log', the log data will be saved to that location. This will also be trimmed to ''autoap_logsize'' lines.
:'''nvram set autoap_findopen="1"''' :'''nvram set autoap_findopen="1"'''
::When set to 1, AutoAP will search for unencrypted, open access points. When set to 0, it will not connect to any open access points. ::When set to 1, AutoAP will search for unencrypted, open access points. When set to 0, it will not connect to any open access points.
Line 65: Line 80:
:'''nvram set autoap_wepkeys=""''' :'''nvram set autoap_wepkeys=""'''
::This is a space separated list of WEP keys you want AutoAP to use when trying to connect to WEP networks. For instance, if you set "AAABBBCCC1 4455993322 1111122222" it will attempt to use those three keys, in that order, to connect to any WEP (not WPA) access points. ::This is a space separated list of WEP keys you want AutoAP to use when trying to connect to WEP networks. For instance, if you set "AAABBBCCC1 4455993322 1111122222" it will attempt to use those three keys, in that order, to connect to any WEP (not WPA) access points.
 +::A space separated list of SSIDs with WEP keys you want AutoAP to use when trying to connect to WEP networks. Spaces in SSIDs have to be replaced by '*'s. Example: "My Home" -> "My*Home". The key is appended directly, preceeded by a "*key*". Example: "My Home", WEP key:1234567ab -> "My*Home*key*1234567ab SSID2*key*ab1212cd"
 +::To use these the option autoap_findwep has to be enabled as well.
:'''nvram set autoap_aplimit="10"''' :'''nvram set autoap_aplimit="10"'''
::The number of AP's that AutoAP should keep track of at one time. The default is 10, so after trying to connect to 10 access points, AutoAP will take another full scan and get a fresh list of URLs. If you live in a Wi-Fi heavy area, and your router doesn't move much, you can safely increase this to 15 or so. If you are in a sparse area, or routers around you tend to have weak signals, set it lower. ::The number of AP's that AutoAP should keep track of at one time. The default is 10, so after trying to connect to 10 access points, AutoAP will take another full scan and get a fresh list of URLs. If you live in a Wi-Fi heavy area, and your router doesn't move much, you can safely increase this to 15 or so. If you are in a sparse area, or routers around you tend to have weak signals, set it lower.
Line 78: Line 95:
::This only applies to the frequency of scans when the connection is good. When there is no connection, or no APs, it will automatically scan more frequently. ::This only applies to the frequency of scans when the connection is good. When there is no connection, or no APs, it will automatically scan more frequently.
:'''nvram set autoap_macfilter=""''' :'''nvram set autoap_macfilter=""'''
-::A space seperated list of MAC addresses in the format xx:xx:xx:xx:xx:xx that AutoAP should avoid. If you have routers that you don't want to log on to, add them here. The MAC filter is more accurate than the SSID filter, as no two routers share a MAC address. (Unless cloned I suppose).+::A space separated list of MAC addresses in the format xx:xx:xx:xx:xx:xx that AutoAP should avoid. If you have routers that you don't want to log on to, add them here. The MAC filter is more accurate than the SSID filter, as no two routers share a MAC address. (Unless cloned I suppose).
:'''nvram set autoap_ssidfilter=""''' :'''nvram set autoap_ssidfilter=""'''
-::A space seperated list of SSIDs to avoid. Normally the macfilter will be a safer bet, but occasionally there may be a WDS network, etc, that you don't want to connect to that includes many APs with the same SSID.+::A space seperated list of SSIDs to avoid. Normally the macfilter will be a safer bet, but occasionally there may be a WDS network, etc, that you don't want to connect to that includes many APs with the same SSID. Spaces in SSIDs have to be replaced by '*'s. Example: "My Home" -> "My*Home".
 +:'''nvram set autoap_logsize="1000"'''
 +::The maximum number of lines the logfiles will contain (for html and path based logging only). Once the size of the log reaches this value, it will be trimmed down to 3/4th of it, keeping the most recent entries. You may want to adapt this value depending on the memory of your router.
 +:'''nvram set autoap_prefssid=""'''
 +::A space separated list of SSIDs to try to connect to first. Spaces in SSIDs have to be replaced by '*'s. Example: "My Home" -> "My*Home".
 +::If a preferred network is WEP encrypted, append the key directly, preceeded by a "*key*". Example: "My Home", WEP key:1234567ab -> "My*Home*key*1234567ab"
 +:'''nvram set autoap_prefonly="0"'''
 +::If "1", exclusively try to connect to preferred networks.
 +:'''nvram set autoap_rescandelay="120"'''
 +::Number of 'autoap_scanfreq' after which the nvram veriables a reread, and a rescan is forced, even if currently connected. This makes sure that you are conected to your preferred networks even if at some point they were unavailable, and it also takes advantage of new APs. Setting this to a large number practically deactivates the feature (3600 is about 1 day).
 +:'''nvram set autoap_refreshnow="0"'''
 +::If "1", during the next 'autoap_scanfreq' force a reloading of nvram variables and rescan for networks. This is handy if you modify a nvram variable and you don't want to wait to the next refreshdelay to take it into account. After recanning it is obviously automatically reset to '0'
-= Links =+= Development Status and Bugs =
-:* [http://www.sourceforge.net/projects/autoap Project AutoAP] on SourceForge site where you can download firmwares with AutoAP script built in. (As of 1/8/2007, these firmwares contain a bit outdated 12/12/2006 version of AutoAP script) (updated 12/28/2006). +AutoAP has an active project page on SourceForge.net [http://sourceforge.net/projects/autoap], where bugs are collected and development updates are made. It is important that you submit bugs to the sourceforge project page should you encounter any, as that is the only way we can be sure that the problem is addressed.
 + 
 +You can also download the standalone version of AutoAP, sync to svn and access documentation as it becomes more prevelant.
 + 
 += Links =
-:* Stand-alone [http://d4308987.u22.infinology.com/code/autoap.sh autoap.sh] created by JP with with some bug fixes by Mathilda (synced with Mathilda's on 1/13/2006). +:* [http://www.sourceforge.net/projects/autoap Project AutoAP] on SourceForge site where you can download the stand-alone AutoAP script, or firmwares with AutoAP script built in.
-:* Stand-alone [http://irisa.free.fr/autoap.sh autoap.sh] with some more fixes by Mathilda (see [http://www.dd-wrt.com/phpBB2/viewtopic.php?p=52550&highlight=#52550 this post]) (updated 1/8/2007).+:* Current development version of the stand-alone [http://autoap.svn.sourceforge.net/viewvc/*checkout*/autoap/autoap_test.sh script on sourceforge] (see [http://autoap.svn.sourceforge.net/viewvc/*checkout*/autoap/Changelog Changelog]). There is no sense in continuously updating the "latest version" information here, so please check the Sourceforge website for the latest version of the script.
:* The AutoAP [http://www.dd-wrt.com/phpBB2/viewtopic.php?t=6575 discussion thread] :* The AutoAP [http://www.dd-wrt.com/phpBB2/viewtopic.php?t=6575 discussion thread]
-[[Category:English documentation]]+[[Category:Applications]]
 +[[Category:Wlan]]
 +[[Category:Advanced tutorials]]
 +[[Category:Scripts]]

Revision as of 22:48, 15 March 2018

AutoAP is a script that continuously scans for open Wi-Fi connections, tests them for validity, and connects to the strongest signal. If the connection is lost, the script scans again and finds the strongest valid signal again, and maintains a continuous connection to the internet in a mobile or portable environment. The script paremeters are highly configurable, including ability to configure secure connections.

Typically, you would use this script on your router while in Repeater Mode, Client Mode, or Client-Bridged Mode.


Before using this guide, it is recommended that you know how to:

... flash your device
... use the Web Interface
... setup Repeater Mode, Client Mode or Client-Bridged Mode.

Contents

Installation

There are several ways to install AutoAP.

Dynamically Download

If you would like to use autoap with any image/build (such as the latest v24beta), use the following script. It clears wl_ssid to dynamically connect to any open AP and then every 30 seconds tries to download stand-alone AutoAP script. Once downloaded, AutoAP starts.

  • Go to tab "Administration", subtab "Command".
  • Copy and paste the following into the edit box (make sure to get the "&" at the end):
nvram set wl_ssid=""
`cd /tmp; until [ 2 = 1 ];do /bin/sleep 30;
/usr/bin/wget -Oautoap.sh http://downloads.sourceforge.net/autoap/autoap_090711.sh;
chmod 777 ./autoap.sh;./autoap.sh;done` &
  • Click the Save Startup button
  • Reboot your router
  • Verification: After a minute or two, go to http://RouterIP/user/autoap.htm (where RouterIP is your router's IP address) to view the html log, which is setup by default. If you see a log, this indicates Autoap was successfully downloaded and instantiated. You may also telnet into the router and perform a "ps" to verify the script is running.

Built-in Image

If you would like to have autoap built into an image:

  • Download firmware image (link? url?) with AutoAP script built in (see sourceforge link and caveats in "Links" section below)
  • Flash your router with this firmware
  • After flashing go to tab "Administration", subtab "Command"
  • Copy and paste the following into the edit box:
/bin/autoap &
  • Click the Save Startup button
  • Reboot your router

JFFS

You can use JFFS to directly call the AutoAP script.

  • Make sure JFFS is enabled (disabled by default)
  • Make sure SSH is enabled (disabled by default)
  • Download the stand-alone AutoAP script (see Links below)
  • If downloaded file is named something different, rename it to autoap.sh and put it into /jffs/ using SSH.
  • Chmod autoap.sh to 777 using SSH (or telnet).
  • Use the same startup script as in "Built-in Image" above but use:
/jffs/autoap.sh &
  • Instead of:
/bin/autoap &
  • Reboot router
  • After you have it working, SSH can be disabled.

Samba

You can use Samba to directly call the AutoAP script.

  • Obtain the stand-alone AutoAP script (see Links below)
  • Put it somewhere on your local network (using Samba).
  • Use the same startup script as in "Built-in Image" above but reference your Samba path instead of /bin/autoap.

Usage

You can change the behavior of AutoAP script by setting NVRAM variables. For example, let's set AutoAP to prefer to connect to a certain, wep-encrypted network (SSID: my_net" wep-key: abcdef1234 ) before trying others.

  • Go to tab "Administration", subtab "Command".
  • Copy and paste the following into the edit box:
nvram set autoap_prefssid="my_net*key*abcdef1234" 
nvram commit
  • Click the Run Commands button
  • Reboot your router

Now it will only try other APs if the preferred one has no internet connectivity. Of course you could also give more than one preferred AP.

NVRAM Variables

What follows is a complete list of included NVRAM variables and what they do (with default values). Be aware that these refer to the most recent versions of autoap. Older version may have different variables. To be sure just check in the history of the wiki for the date of your version.

nvram set autoap_logger="html" [Valid values: syslog, html, /path/to/logfile]
When set to 'syslog', AutoAP will send all logdata to syslog. Depending on your log level settings, you will see more or less data. AutoAP has quite a bit of log data it sends, however if your log level is set to high, the router should only send out important autoap notices, like new connections, disconnections, or errors. If set to low, it will show you debug data.
When set to 'html', the log data is written to a file available via the web interface at http://RouterIP/user/autoap.htm. This log is kept trimmed to autoap_logsize lines.
When set to a path, i.e. '/tmp/newautoap.log', the log data will be saved to that location. This will also be trimmed to autoap_logsize lines.
nvram set autoap_findopen="1"
When set to 1, AutoAP will search for unencrypted, open access points. When set to 0, it will not connect to any open access points.
nvram set autoap_findwep="0"
When set to 1, AutoAP will search for WEP encrypted access points. If you set this to one, make sure to add keys in the next settings. Set to 0 keeps AutoAP from trying to connect with any WEP networks. This is far too slow to use as a brute force tool, so if you don't know the WEP keys to networks you're trying to connect with, just keep this at 0.
nvram set autoap_wepkeys=""
This is a space separated list of WEP keys you want AutoAP to use when trying to connect to WEP networks. For instance, if you set "AAABBBCCC1 4455993322 1111122222" it will attempt to use those three keys, in that order, to connect to any WEP (not WPA) access points.
A space separated list of SSIDs with WEP keys you want AutoAP to use when trying to connect to WEP networks. Spaces in SSIDs have to be replaced by '*'s. Example: "My Home" -> "My*Home". The key is appended directly, preceeded by a "*key*". Example: "My Home", WEP key:1234567ab -> "My*Home*key*1234567ab SSID2*key*ab1212cd"
To use these the option autoap_findwep has to be enabled as well.
nvram set autoap_aplimit="10"
The number of AP's that AutoAP should keep track of at one time. The default is 10, so after trying to connect to 10 access points, AutoAP will take another full scan and get a fresh list of URLs. If you live in a Wi-Fi heavy area, and your router doesn't move much, you can safely increase this to 15 or so. If you are in a sparse area, or routers around you tend to have weak signals, set it lower.
Also, if you're moving (i.e. router is in a car) you'll want this number to be somewhere between 2 and 5.
nvram set autoap_inet="1"
When set to 1, it will check to make sure internet is active on an AP before considering it valid. When set to 0, it only checks for connection to the gateway.
nvram set autoap_ineturl="www.google.com"
The URL to check.
nvram set autoap_dhcpw="15"
The amount of time to wait for a DHCP renewal to complete. If the routers you're accessing are fairly quick, you can decrease this to ~8-10 and save some time on the scans. However if the signal is low quality, or the router is slow to respond, you can increase it. The default should be a safe bet for most.
nvram set autoap_scanfreq="60"
The amount of time to wait between scans. When AutoAP finds a valid connection, it checks every so often to ensure that the connection is still active. If it isn't, it seeks out a new AP. This number controls how often it should check.
This only applies to the frequency of scans when the connection is good. When there is no connection, or no APs, it will automatically scan more frequently.
nvram set autoap_macfilter=""
A space separated list of MAC addresses in the format xx:xx:xx:xx:xx:xx that AutoAP should avoid. If you have routers that you don't want to log on to, add them here. The MAC filter is more accurate than the SSID filter, as no two routers share a MAC address. (Unless cloned I suppose).
nvram set autoap_ssidfilter=""
A space seperated list of SSIDs to avoid. Normally the macfilter will be a safer bet, but occasionally there may be a WDS network, etc, that you don't want to connect to that includes many APs with the same SSID. Spaces in SSIDs have to be replaced by '*'s. Example: "My Home" -> "My*Home".
nvram set autoap_logsize="1000"
The maximum number of lines the logfiles will contain (for html and path based logging only). Once the size of the log reaches this value, it will be trimmed down to 3/4th of it, keeping the most recent entries. You may want to adapt this value depending on the memory of your router.
nvram set autoap_prefssid=""
A space separated list of SSIDs to try to connect to first. Spaces in SSIDs have to be replaced by '*'s. Example: "My Home" -> "My*Home".
If a preferred network is WEP encrypted, append the key directly, preceeded by a "*key*". Example: "My Home", WEP key:1234567ab -> "My*Home*key*1234567ab"
nvram set autoap_prefonly="0"
If "1", exclusively try to connect to preferred networks.
nvram set autoap_rescandelay="120"
Number of 'autoap_scanfreq' after which the nvram veriables a reread, and a rescan is forced, even if currently connected. This makes sure that you are conected to your preferred networks even if at some point they were unavailable, and it also takes advantage of new APs. Setting this to a large number practically deactivates the feature (3600 is about 1 day).
nvram set autoap_refreshnow="0"
If "1", during the next 'autoap_scanfreq' force a reloading of nvram variables and rescan for networks. This is handy if you modify a nvram variable and you don't want to wait to the next refreshdelay to take it into account. After recanning it is obviously automatically reset to '0'

Development Status and Bugs

AutoAP has an active project page on SourceForge.net [1], where bugs are collected and development updates are made. It is important that you submit bugs to the sourceforge project page should you encounter any, as that is the only way we can be sure that the problem is addressed.

You can also download the standalone version of AutoAP, sync to svn and access documentation as it becomes more prevelant.

Links

  • Project AutoAP on SourceForge site where you can download the stand-alone AutoAP script, or firmwares with AutoAP script built in.
  • Current development version of the stand-alone script on sourceforge (see Changelog). There is no sense in continuously updating the "latest version" information here, so please check the Sourceforge website for the latest version of the script.