Alessandro Dotti Contra

Linux/Unix DevOps


Wireless configuration with wpa supplicant

This is a bit of information about managing wireless configuration with wpa supplicant. It's fairly incomplete, since so far I only had to deal with open or wep encrypted wireless networks.

The basic idea is pretty simple... define a pseudo network interface for each wireless network we'd like to automatically connect to, and integrate that interface into the network management framework.

wpa_supplicant.conf

In this file we declare the wireless networks we usually connect to.

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=netdev
ap_scan=1
fast_reauth=1
eapol_version=1

network={
	ssid="wireless.network"
	key_mgmt=NONE
	wep_key0=XXXXXXXXXX
	id_str="wepnet"
}

#Safe default
network={
	key_mgmt=NONE
	id_str="default"
}

/etc/network/interfaces

This snippet shows how to handle the pseudo network interfaces bounded the wireless connections (ath0 is the physical wireless network interface).

allow-hotplug ath0
iface ath0 inet manual
	wpa-driver wext
	wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface wepnet inet dhcp
iface default inet dhcp