9

I use wpa-conf in /etc/network/interfaces to make the WLAN interface automatically connect to the AP:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback


auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Actually, I just found that on a wiki somewhere. It seems that this isn't documented in interfaces(5) or in any other man page.

So what is the wpa-conf keyword? A kind of extension? Or is it built into ifup? And where do I get a list of all the commands I can use in /etc/network/interfaces?

  • Is it a function in one of the /etc/network/interfaces.d/* files? – Jeff Schaller Feb 13 '16 at 21:03
  • @JeffSchaller: wpa-conf is not in my /etc/network/interfaces.d/. – wolf-revo-cats Feb 13 '16 at 21:13
  • 1
    It's documented (on Debian) in /usr/share/doc/wpasupplicant/README.modes.gz – Simon Adda-Reyss Sep 9 '18 at 23:06
9

As for /etc/network/interfaces, when you install wpa-supplicant, a script hook is installed in:

  • /etc/network/if-down.d
  • /etc/network/if-post-down.d
  • /etc/network/if-pre-up.d
  • /etc/network/if-up.d,

The hook is called wpasupplicant and is a symlink to /etc/wpa-supplicant/ifupdown.sh, that invokes in turn /etc/wpa-supplicant/functions.sh.

This hook will be invoked by runparts in ifup / ifdown, and the script the symlink points too tests whether the interface is wireless or not. If that is the case, the command will be passed on to wpa-supplicant.

For acting on the commands, passing them to /sbin/wpa-supplicant, it seems the script /sbin/wpa_action and the binary /sbin/wpa_cli are used.

I found an old page talking about this here:

http://manual.siduction.org/inet-wpa

As mentioned earlier, each wpa_supplicant specific element is prefixed with 'wpa-'. Each element correlates to a property of wpa_supplicant described in the wpa_supplicant.conf(5), wpa_supplicant(8) and wpa_cli(8) manpages.

The supplicant is launched without any pre-configuration whatsoever, and wpa_cli forms a network configuration from the input provided by the 'wpa-*' lines. Initially, wpa_supplicant/wpa_cli does not directly set the properties of the device (like setting an essid with iwconfig, for example), rather it informs the device of what access point is suitable to associate with. Once the device has scanned the area, and found that the suitable access point is available for use, these properties are set.

The script that does all the work is located at:

/etc/wpa_supplicant/ifupdown.sh /etc/wpa_supplicant/functions.sh ifupdown.sh is executed by run-parts, which in turn is invoked by ifupdown during the 'pre-up', 'pre-down' and 'post-down' phases.

In the 'pre-up' phase, a wpa_supplicant daemon is launched followed by a series of wpa_cli commands that set up a network configuration according to what 'wpa-' options were used in /etc/network/interfaces for the physical device.

If wpa-roam is used, a wpa_cli daemon is lauched in the 'post-up' phase.

In the 'pre-down' phase, the wpa_cli daemon is killed if it exists.

In the 'post-down' phase, the wpa_supplicant daemon is killed.

  • Why isn't it indented like other options associated with an interface? If there are multiple such lines will they interfere? – detly Apr 29 '18 at 11:55
  • 1
    @detly If you have questions about the subject, please open a new question. – Rui F Ribeiro Jul 1 '18 at 19:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.