I have a router at home with ESSID of dlink_home and 10 digits (0123456789) 64-bit WEP encryption of Open Authentication Type.

I want to connect to it through terminal with bash commands, I tried

ifconfig wlan0 up
iwconfig wlan0 essid dlink_home key s:0123456789
dhclient wlan0

When using s: prefix it gives the following error:

Error for wireless request "Set Encode" (8B2A) : SET failed on device wlan0 ; Invalid argument.

and without it, it doesn't work, as s: prefix is for specifying string key rather than HEX key.

The OS I am running is Red Hat Enterprise Linux 6.


1 Answer 1


1. correct form of the command

Try changing your iwconfig line to this:

$ iwconfig wlan0 essid dlink_home key s:0123456789

2. wpa_supplicant

If the above command is correct and you're still receiving an error message, make sure that you have the wpa_supplicant package installed.

$ yum install wpa_supplicant

3. NetworkManager

I'd use NetworkManager over iwconfig when dealing with wireless devices. To connect via command line using NetworkManager in runlevel 3 you can use the following command:

 $ nmcli dev wifi connect <name> password <password>


  • edited the post, i do with wlan0, wrote it wrong.
    – easl
    Commented Jun 14, 2013 at 19:08
  • "wpa_supplicant.x86_64 1:0.7.3-3.el6 @anaconda-RedHatEnterpriseLinux-201206132210.x86_64/6.3" it is already installed. it works when there is no encryption, that is the connection has no password.
    – easl
    Commented Jun 14, 2013 at 19:15
  • What does dmesg and /var/log/messages say about the command when it fails?
    – slm
    Commented Jun 14, 2013 at 19:17
  • i read that iwconfig doesn't work when the password is more than 5 digits, but 10 digits length is fixed in router's settings, i can't change the amount.
    – easl
    Commented Jun 14, 2013 at 19:17
  • Can you provide a link to where you read that, I've not heard that before, and many of the examples show it with longer than 5.
    – slm
    Commented Jun 14, 2013 at 19:21

You must log in to answer this question.

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