HOWTO: Use IWCONFIG

Posted in Technology
Fri, Oct 7 - 6:27 am EDT | 9 years ago by
Comments: 14
Share This Post:
  • Facebook
  • StumbleUpon
  • Tumblr
  • Reddit
  • Twitter

Iwconfig is another wireless tool that is hopefully present on your distro. Unlike iwlist, iwconfig can be used to actually set parameters in a wireless card rather than just look at their settings.

To use iwconfig, open a terminal window and type:

iwconfig

This shows me the following. Your system may vary:

  • lo no wireless extensions.
  • eth0 no wireless extensions.
  • wlan0 IEEE 802.11b+ ESSID:”driveon” Nickname:”acx100 v0.2.0pre8″
    Mode:Managed Frequency:2.442 GHz Access Point: 00:06:25:9A:50:C8
    Bit Rate:1 Mb/s Tx-Power:18 dBm Sensitivity=187/255
    Retry min limit:7 RTS thr:off
    Power Management:off
    Link Quality=54/100 Signal level=39/100 Noise level=1/100
    Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
    Tx excessive retries:0 Invalid misc:0 Missed beacon:0
  • sit0 no wireless extensions.

lo is my local adapter and it shows that it’s not wireless
eth0 is my wired ethernet card and it shows that it’s not wireless
wlan0 is my wireless card and it shows that it is wireless – good!
sit0 stands for ‘simple internet transition’ but that’s all I know about it. In any case – it’s not wireless.

I highly advise typing man iwconfig to get complete information on everything that can be done with the iwconfig command, but here are some of the more common commands you may want to use:

  • iwconfig wlan0 enc < key >: Sets the WEP encryption key to < key >
  • iwconfig wlan0 mode managed: Sets the mode to managed
  • iwconfig essid driveon: Sets the ESSID/SSID to ‘driveon’
  • iwconfig channel 7: Sets the card to use channel 7

    Note that you can put all these commands together, as in:

  • iwconfig wlan0 enc mode managed essid driveon channel 7

Note that iwconfig is used to set the parameters of the card, it does not bring the card ‘up’ for use. You must use the command:

ifconfig wlan0 up

for that.

Ifconfig is the subject of a future entry. Stay tuned!

Latest Posts

Share This Post:
  • Facebook
  • StumbleUpon
  • Tumblr
  • Reddit
  • Twitter
  • Pingback: New Linux User » HOWTO: Use Ifconfig.

  • Pingback: New Linux User » Geeky Fun: Logging On To Darkstar

  • http://lkbm.ecritters.biz/ Luca Masters

    A note about this line:
    “iwconfig wlan0 enc mode managed essid driveon channel 7″
    After ‘enc ‘ there’s a ‘mykey’ in angle brackets. It doesn’t display in HTML.

  • val

    Ok guys, how can configure iwconfig to handle my WPA based wireless connection? I have madwifi driver installed, have Wireless tools installed and have NetworkManager aswell, but NM works only when I log in as user, as soon as I try to switch to init 3, where no X server is up, I dont have internet, so I need to configure wireless using iwconfig or other relevant tools, so i can boot with internet and have it irrelevant if i run X server or not.

    Any idieas?

  • imneat

    @val

    iwconfig and WPA can be tricky. Gotta configure wpa_supplicant and have it running in the background like a daemon.

    Configure /etc/wpa_supplicant.conf to have the following lines:
    —–
    #
    ctrl_interface=/var/run/wpa_supplicant

    eapol_version=1

    ap_scan=1

    fast_reauth=1

    network={
    ssid=”yourSSID”
    psk=”yourWPApassword”
    priority=5
    }
    #
    —–
    Now use iwconfig, run wpa_supplicant, start your connection:
    $iwconfig ath0 essid YourSSID #set iwconfg to your ssid
    $wpa_supplicant -iath0 -c/etc/wpa_supplicant.conf -B #start the wpa “daemon”
    $dhcpcd -d ath0 #obtain IP address from DHCP server

    Using wpa_supplicant sorta replaces the manually setting a key [iwconfig ath0 key YourPW] shown above.

    Hope this helps!

  • http://rolf.haynberg.de Rolf

    Thanks for the quick reminder :) Nr. 2 on google :)

  • pete

    Thanks! This has just solved my problem configuring WUSB300N adapter in Mandriva.

  • http://blog.mehulved.com mehul

    Thanks imneat for the wpa how-to. It worked great :)

  • Tristan

    Thanks to both Jon and imneat, this worked flawlessly for configuring wireless with WPA on my Ubuntu server.

  • mango1122

    Works like a charm on BT3

  • Pingback: WEP-шифрование в Ad-hoc режиме WLAN на Acer Aspire One « Аспирин

  • http://www.jawtheshark.com Jorg Willekens

    I’m sitting here in a local pub with wireless with an Asus EEE 701 4G running Debian. It runs a very lightweight window manager and thus doesn’t have a wireless configuration applet.

    I’ve been trying to set up the wireless here for half an hour with iwconfig, before giving up and simply changing my /etc/network/interfaces file and reboot.

    To say that the only thing I missed was:

    ifconfig wlan0 up

    Thanks…. Seems that I missed that part in the man page!

  • Hao

    In fact, either iwconfig or wpa_supplicant will be sufficent to establish the wireless connection.

    http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=4&chap=4

    Difference from my point of view is:
    iwconfig: Only support WEP
    wpa_supplicant: support WPA, WPA2, WEP, etc… Also wpa_supplicant is running as a daemon which will do auto connection to configued Access Points.

  • lenzi

    when i type in sudo wpa_supplicant -i…
    i get the following error
    SIOCSIFFLAGS: No such file or directory
    could not set interface ‘wlan0′ up
    segmentation fault

    any ideas?