Technology weblog

IT-Essence
Sunday Feb 04, 2007

Wireless with wireless-tools and wpa_supplicant

Today I got wireless (with WEP encryption) working on my Gentoo Linux laptop (Asus S1300 with Linksys wireless card and Linksys WRT54G access point) with both wireless-tools and wpa_supplicant. The wireless card uses ndiswrapper as a driver. Of course it is needles to have wireless networking for both toolkits, but I had the former running already and the latter is useful when making the transition from WEP to WPA encryption, so why not describe both of them in this post.

First of all I sym-linked my /etc/init.d/net.eth0 to /etc/init.d/net.wlan0, although I read somewhere that it is better to sym-link to /etc/init.d/net.lo instead.

With wireless-tools my /etc/conf.d/net looks as follows:

# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d. To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).
config_eth0=( "dhcp" )
config_wlan0=( "dhcp" )

# Prefer wpa_supplicant over wireless-tools
modules=( "iwconfig" )

key_MyAccessPointESSID="[1] ABCDABCDABCDABCDABCDABCDEF key [1] enc restricted"
With wpa_supplicant my /etc/conf.d/net looks as follows:
## This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d. To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).
config_eth0=( "dhcp" )
config_wlan0=( "dhcp" )

# Prefer wpa_supplicant over wireless-tools
modules=( "wpa_supplicant" )

# It's important that we tell wpa_supplicant which driver we should
# be using as it's not very good at guessing yet
#wpa_supplicant_wlan0="-Dndiswrapper"
wpa_supplicant_wlan0="-Dwext"
iwconfig_wlan0="mode managed"
Remark that the driver I used here is the wext (generic) driver instead of the ndiswrapper driver. Using the latter, I got an exception when trying to connect (invoking the command /etc/init.d/net.wlan0 start manually) and watching the result with wpa_gui: "Associating request to the driver failed".

My entries for WEP encryption in the wpa_supplicant.conf file in /etc/wpa_supplicant/ read
ctrl_interface_group=0
eapol_version=1
ap_scan=1
fast_reauth=1

# Shared WEP key connection (no WPA, no IEEE 802.1X) using Shared Key
# IEEE 802.11 authentication
network={
ssid="MyAccessPointESSID"
key_mgmt=NONE
wep_key0=ABCDABCDABCDABCDABCDABCDE0
wep_key1=ABCDABCDABCDABCDABCDABCDE1
wep_key2=ABCDABCDABCDABCDABCDABCDE2
wep_tx_keyidx=0
priority=5
auth_alg=SHARED
}
When booting, the booting sequece now nicely shows me that:
* Starting wlan0
* Starting wpa_supplicant on wlan0 ...
* Starting wpa_cli on wlan0 ...
* Backgrounding ...

Conclusion

Since wireless with wpa_supplicant allows one to switch to WPA encryption and since it backgrounds when trying to obtain an IP address via DHCP, I recommend wpa_supplicant to establish a wireless connection under Linux.

References

Comments:

Post a Comment:
Comments are closed for this entry.

Hire us
Archives
Tags
Links
Stats
Referrers