Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can't figure out how to properly bring up the wi-fi card on my laptop. When I turn it on and issue

$ sudo iwconfig wlan0 txpower auto
$ sudo iwlist wlan0 scan
wlan0     Interface doesn't support scanning : Network is down

it reports that the network is down. Trying to bring it up fails too:

$ sudo ifup wlan0
wlan0     no private ioctls.

Failed to bring up wlan0.

Apparently I'm missing some basic low-level iw... command.

When I issue dhclient on the interface:

$ sudo dhclient -v wlan0
Internet Systems Consortium DHCP Client 4.2.2
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/


and interrupt it, it brings the device up somehow and then scanning etc. works. I'd like to avoid this obviously superfluous step.

share|improve this question
There are multiple wifi interface from kernel to user-space. The iwconfig is deprecated and may not be configured into a modern kernel. The iw method is more modern/preferred (nl80211‌​). Older iwconfig may give wierd errors when wext support is not compiled/configured. What tools/scripts distros make available is another issue. I guess if you use a distro, they should take care to give the right packages/configurations. If you build your own, then you may have the issue above. – artless noise Feb 26 '15 at 18:26
up vote 16 down vote accepted

Indeed, try sudo ifconfig wlan0 up. To elaborate on the answer by Martin:

ifup and ifdown commands are part of ifupdown package, which now is considered a legacy frontend for network configuration, compared to newer ones, such as network manager.

Upon ifup ifupdown reads configuration settings from /etc/network/interfaces; it runs pre-up, post-up and post-down scripts from /etc/network, which include starting /etc/wpasupplicant/ifupdown.sh that processes additional wpa-* configuration options for wpa wifi, in /etc/network/interfaces (see zcat /usr/share/doc/wpasupplicant/README.Debian.gz for documentation). For WEP wireless-tools package plays similar role to wpa-supplicant. iwconfig is from wireless-tools, too.

ifconfig at the same time is a lower level tool, which is used by ifupdown and allows for more flexibility. For instance, there are 6 modes of wifi adapter functioning and IIRC ifupdown covers only managed mode (+ roaming mode, which formally isn't mode?). With iwconfig and ifconfig you can enable e.g. monitor mode of your wireless card, while with ifupdown you won't be able to do that directly.

share|improve this answer

Try ifconfig wlan0 up instead of ifup.

share|improve this answer

Here's what I use to connect to a WEP access point, on a daily basis:


DEV=$(iw dev | awk '/Interface/ {interf=$2} END {print interf}')

if [[ -f $PIDFILE ]] && kill -0 $(cat /var/run/dhcpcd-$DEV.pid)
    dhcpcd -k $DEV

ifconfig $DEV down
sleep 1
iwconfig $DEV mode managed
iwconfig $DEV  key blabfoobar
ifconfig $DEV up
iwconfig $DEV essid 'Unindicted Co-conspirator'
iwconfig $DEV ap 00:0D:51:EB:E5:1E

sleep 5
dhcpcd --noipv6rs --noarp $DEV

You'll have to put in the ESSID and MAC for whatever access point you want.

It's a little harder for WPA encryption. You have to have a wpa_supplicant.conf file with an appropriate entry. Like this:

# Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers

Once you have such a conf file, then you can run this script:


DEV=$(iw dev | awk '/Interface/ {print $2}')

ifconfig $DEV down
iwconfig $DEV mode managed
ifconfig $DEV up
iwconfig $DEV essid 'FaveCoffeeHouse'
iwconfig $DEV ap 00:21:1e:3d:2a:80

echo now run: wpa_supplicant -Dnl80211 -i$DEV -c./wpa_supplicant.conf 

Update, 2014-12-03:

Arch linux being what it is, my connect-to-WEP script is a lot different. I thought I'd add it to this answer to keep it up-to-date.



if [[ -f /run/dhcpcd-$DEV.pid ]]
        kill -QUIT $(cat /run/dhcpcd-$DEV.pid)

ifconfig $DEV down
iw dev $DEV set type managed
ifconfig $DEV up
sleep 2

iw dev wlp12s0 connect -w 'Akond of Swat' 2462 00:7c:41:eb:e5:1e key 0:befedade

sleep 15

dhcpcd -4 --nohook 10-wpa_supplicant --noarp --noipv6rs $DEV

I had to switch to using iw very suddenly. Something about the Arch LTS kernel, or the WiFi drivers (my laptop has an Intel WiFi card using the "iwl4965" driver) changed not too long ago. You'll have to change the frequency ("2462") and MAC address of the access point to get this to work.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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