wpa_action also receives an environment variable from wpa_cli, WPA_ID_STR, containing an alphanumeric identification string for the CURRENT network block. WPA_ID_STR is provided by the 'id_str' network block option of wpa_supplicant.conf, and provides a means to map the ACTION to a LOGICAL interface configured in the interfaces file.
If either the ifupdown interfaces or ifstate file cannot be found, wpa_action will exit silently (status 0). wpa_action will search the following locations for their existence:
/etc/network/run/ifstate /run/network/ifstate /etc/network/interfaces
A unique network identifier, WPA_ID, is exported to wpa_action. It is the number assigned to the CURRENT wpa_supplicant network block (network_id).
Otherwise, wpa_action is given as an argument to a wpa_cli daemon.
This can be done by using the wpa-roam option in the interfaces file. wpa-roam takes one argument, a user provided wpa_supplicant.conf file.
The inet METHOD must be 'manual' for this interface, as it will be configured according to wpa_cli action events. Also supply a 'default' interfaces stanza using the dhcp inet METHOD so that networks without an 'id_str' option can fallback to attempting to receive an ip via dhcp. If one or more networks requires additional network configuration, provide an unique 'id_str' for each network, and an interfaces stanza using the 'id_str' value as a LOGICAL interface. The following interfaces file is configured to use dhcp for any network without an 'id_str', a static ip for the network with an 'id_str' of 'home_static' and dhcp plus an additional post-up command for the network with an 'id_str' of 'uni'.
An example wpa_supplicant.conf configured to roam between 3 different networks:
network={ ssid="foo" id_str="uni" key_mgmt=NONE } network={ ssid="bar" id_str="home_static" psk=123456789... } network={ ssid="" key_mgmt=NONE }
The corresponding interfaces file would contain LOGICAL interfaces, that correlate to each unique 'id_str' provided by the configuration file:
iface eth1 inet manual wpa-driver wext wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf iface default inet dhcp iface uni inet dhcp iface home_static inet static address 192.168.0.20 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.1