autonet - automatic network configuration for multiple networks


autonet [-hvV] [-s device] [-u seconds] [start | stop | restart]


autonet is intended to handle automatic network configuration on a machine which connects to a variety of different networks, such as a laptop.

This manpage is very much a work in progress

When started autonet will check for the first interface matching the following criteria:


The following configuration options can be set in rc.conf:

WEP nwkey for a given ssid

Parameters to pass to ifconfig instead of running dhclient. can be an interface or an ssid

Default route to set. can be an interface or an ssid

Order of media types to try. Default: "Ethernet IEEE802.11".

Pathname of a local script to be called at various phases. This can be used to perform any additional configuration after a network interface is configured or before it is shutdown, such as starting or stopping daemons. Default: /etc/autonet.local

If an Ethernet interface needs to be brought up before it will register as active, can specify '-u ' in autonet_flags to cause interfaces to be be brought up followed by a sleep of before testing (Not required on a wm0 or ath0) The audio cues can also be disabled by specifying -s ""

dhclient should be set to NO in rc.conf. If you want autonet to stop and start other daemons such as named, ntp, they should also be set to NO, and /etc/autonet.local should call onestart and onestop

If /usr is separate to / then critical_filesystems_local should include /usr


An example for a static configuration on a WEP encrypted access point with an ssid of 'groundhog'.



Sample autonet_localscript. Should be copied to /etc/autonet.local and modified for use

Sample powerd lid switch script. Can be copied to /etc/powerd/scripts/lid_switch for use

rc.d script for automatic use on autonet on machine startup. Copy to /etc/rc.d/autonet for use


There is no general purpose way to describe a set of rc.d scripts to be run on autonet start and autonet stop. eg 'autonet_xxxx=YES in rc.conf'

On successful configuration does not take down unused interfaces. This may turn out to be a useful feature if ifwatchd is used in conjunction with autonet to detect when ethernet cables are inserted and removed.

Cannot handle two disparate access points with the same SSID but requiring different configurations, unless one uses WEP and the other does not.

May have issues with SSIDs containing strange characters.

Has not been tested on anything other than NetBSD.

Only prelimiminary testing with ifwatchd - when called with 'ifwatchd -c /usr/pkg/bin/autonet -n /usr/pkg/bin/autonet wm0' ifwatchd appears to call autonet twice on an interface transition from no carrier to carrer.

Calls "wiconfig -D twice" on each interface, once to extract access points with WEP set, and a second time for those without WEP. Should only call once.