Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Why iwconfig wlan0 enc can't work?
Date: Fri, 21 Oct 2011 19:39:16
Message-Id: 201110212037.01686.michaelkintzios@gmail.com
In Reply to: [gentoo-user] Why iwconfig wlan0 enc can't work? by Lavender <448463782@qq.com>
1 On Friday 21 Oct 2011 15:03:31 Lavender wrote:
2 > The essid of my dormitory wireless netword is "Rebellion"
3 > and its password is "I'll leave it up to you"(It's OK to tell
4 > you this private information :-) ) .
5 > I typed command below
6 > #iwconfig wlan0 up
7 > #iwconfig wlan0 essid "Rebellion"
8 > Commands above worked normally, then
9 >
10 > #iwconfig wlan0 mode master
11 >
12 > Our AP mode which iwlist shows is master,
13 > but the command above failed. Error message was
14 > "Invalid argument".
15
16 Yes, your AP is operating in 'master' mode, while your PC's wireless NIC
17 operates in 'managed' mode since it is a wireless client.
18
19
20 > Then I typed
21 > #iwconfig wlan0 mode managed
22 > This worked ,
23
24 Good. :-)
25
26 > then
27 > #iwconfig wlan0 enc "I'll leave it up to you"
28 > This failed with error message "Invalid argument"
29
30 The "I'll leave it up to you" is not an encryption *key*, but a passphrase.
31
32 Have you looked at all at the man page for iwconfig? Read what it says under
33 key/enc[ryption]:
34
35 "... Passphrase is currently not supported."
36
37 This means that you need to use the corresponding hexadecimal or ASCII
38 encryption key. The router should show what this is when you login in its
39 administrative GUI.
40
41 Alternatively, you can try running a script like this to generate a md5 hash -
42 no guarantees that it will work with your AP (different vendors have different
43 implementations:
44 ========================
45 #!/usr/bin/perl
46 # Perl script to convert a passphrase to a WEP key.
47 # By Aki Mimoto
48
49 use strict;
50 @ARGV or die "Usage: $0 passphrase\n";
51 print generate_key( @ARGV ), "\n";
52
53 sub generate_key {
54 # --------------------------------------------------
55 require Digest::MD5;
56 return substr Digest::MD5::md5_hex( substr( shift() x 64, 0, 64 ) ),
57 0, 26;
58 }
59 ========================
60
61 Make it executable (using chmod u+x name of file) and then run it with your
62 passphrase. Note, I just found this on Google and have not tried it myself.
63 I would always use a hex or ASCII key instead.
64
65 Ideally though, I would not be using WEP encryption which all of the above
66 applies to, because it is not secure.
67
68 PS. You haven't told us if the AP is using WEP, but you have used a WEP
69 command to enter your encryption key - so I'm giving you here a WEP related
70 answer. ;-)
71
72 --
73 Regards,
74 Mick

Attachments

File name MIME type
signature.asc application/pgp-signature