On Debian, I am trying to set up my network to use ad-hoc mode with a static IP address. I also want wpa_supplicant to be running so that I can scan use it to scan for WiFi networks in range.

To get the ad-hoc network with static IP address working I modified the /etc/network/interfaces file so that it looks like this:

auto lo
iface lo inet loopback
iface eth0 inet dhcp

auto wlan0
iface wlan0 inet static
  wireless-channel 1
  wireless-essid MyNetworkName
  wireless-mode ad-hoc

But with this configuration, if I try to access wpa_supplicant using wpa_cli I get an error which indicates that wpa_supplicant is not running. Is there something I can add to this configuration that will allow wpa_supplicant to start up but not be used to connect up to a network?

I suppose I could just use iwlist scan to find the list of available wireless networks in range... but I already have my parsing setup for the output of wpa_cli scan_results :)


2 Answers 2


wireless-tools (i.e. iwlist, iwconfig, iwpriv ...) are prehistoric and should be replaced by invocations of iw. The wireless- things in /etc/network/interfaces are not handled by wpa_supplicant, but by those old wireless-tools, which ships scripts in /etc/network/if-*.d/wireless-tools.

Compare with the script shipped by wpa_supplicant in /etc/network/if-*.d/wpasupplicant which are just symlinks to scripts in /etc/wpa_supplicant/. They handle options of the form wpa-*

To start wpa_supplicant without an active config, just specify an empty configuration file, like ... /dev/null. Remember to use the nl80211 driver, because everything else (including wext) is just outdated, but is still the default in the old 1.1 version of wpa_supplicant that Debian ships.

auto wlan0
iface wlan0 inet static
    netmask 24
    wpa-conf /dev/null
    wpa-driver nl80211
  • I'm a little confused by your answer. First of all if I just type iw, it is not recognized as a command. Does that mean I am using an older version of Debian? Second you said that /etc/network/interfaces is used to configure the older wireless tools. Does that mean I shouldn't need to use that file at all? I tried updating my interfaces file above by adding the two lines in the bottom of your answer but I get the following error: wpa_supplicant: cannot read contents of /dev/null ... exited with error code 1 Commented Mar 31, 2014 at 23:29
  • Ok. I installed the iw tools. Unfortunately, it looks like my network adapter doesn't support the nl80211 driver. I am using an Edimax nano usb wifi adapter. Commented Apr 1, 2014 at 12:40
  • @PICyourBrain: What old version of Debian are you using ?
    – BatchyX
    Commented Apr 2, 2014 at 18:12
  • 1
    The latest Raspian image for the RaspberryPi Commented Apr 5, 2014 at 15:54

I know, this is quite an old thread, but I came across the same issue and I found a solution for Debian bullseye (on raspberry pi). The required configuration for having fixed IP addresses has to be made in /etd/dhcpcd.conf

interface wlan0
static ip_address=
static ip6_address=xxx:xxx:xxx::x/64
static routers=
static domain_name_servers=ip.add.rr abc:adbd::1

Using this configuration, the ip addresses are set as static ones...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .