defaultrouted

Project page

Description

Defaultrouted is a tool to automate chosing of network configuration. The goal is to have internet automatically everywhere where it is possible to have internet. If the gateway does not work anymore, defaultrouted tries to find another usable network. As long as the gateway still works, nothing is done. To do that, defaultrouted has a configfile which lists conditions and actions to be done if these conditions become true. Conditions can be ip addresses of networking interfaces, whether an ethernet interface has a link, whether a wlan interface is associated, the ssid and ap of the accesspoint, and logical combinations of them. The actions can be things like setting gateway, configuring wireless parameters, configuring ip static addresses (without external programs) and calling external programs. It especially useful for computers which have limited input methods (no keyboard, etc.) like PDAs and wearable computers.

You have to write a configuration file which consist of things defaultrouted should check and actions to do when these checks are successful.

Format of the configuration file

onlinecheck <expression>

then one or more lines of the following form:
<expression> : <action>

These lines are evaluated one by one when the onlinecheck fails. If the expression becomes
true the action is executed.

where action can be:
setessid <iface> <ssid>            to set the ssid of iface
setip <iface> <ip>/<prefix>      to set the ip and netmask of the iface
setwlan <iface> <mode> <ssid> <key>|off   configure wlan, mode can be ad-hoc, ma
naged, master

gateway <ip>                       to set a defaultroute via the ip and
                                   stop traversing the lines in the configfile
exec <cmd>                         execute a shell command
rexec <cmd>                        execute a shell command and stop traversing 
                                   the lines in the configfile.

expression can be:
<expression> and <expression>
<expression> or <expression>
not <expression>
(<expression>)

apmac <iface> <mac>                checks the mac of an access point
ssid <iface> <ssid>                checks the ssid            	   
arpable <iface> <ip>               checks whether the ip can be resolved 
                                   using arp
pingable <ip>                      checks whether the ip answers pings
link <iface>                       checks whether the interface has a link
assoc <iface>                      checks whether the interface is associated


After the lines are evaluated the onlinecheck is evaluated again periodically.

Andreas Kemnade
You might also like these small tools