WLAN
There used to be a wifi bug that affected older debian kernels. Upstream bug report is http://docs.openmoko.org/trac/ticket/2277. In the future please also always report such bugs to bugs.debian.org so that wiki can link to the actual debian bug.
Graphical User Interface
If you don't want to mess about with configuration files and are looking for an easy gui for wireless configuration, then wifi-radar or wicd is what you are looking for.
apt-get install wifi-radar wifi-radar
or
apt-get install wicd wicd-client -n
If you are looking for more, read on...
Using /etc/network/interfaces (simple mode)
Make sure the following packages are installed:
- apt-get install wireless-tools wpasupplicant dhcp3-client
Assuming your wireless router uses WPA security and DHCP, edit /etc/network/interfaces to include a section like this:
auto eth0 iface eth0 inet dhcp wpa-driver wext wpa-ssid "MyWirelessName" wpa-psk "MyWirelessPassword"
Where, of course, you're using the name of your wireless network and its password instead of ?MyWirelessName and ?MyWirelessPassword.
You can test by running
- ifup eth0
You can determine your IP address by running
- ifconfig eth0
Issues:
only works if in presence of wireless network on boot, or when manually running <code>ifup eth0</code>
- booting away from wireless network is slower because waits for DHCP to time out
- does not reestablish connection when leaving wireless area and then returning
- does not support multiple wireless networks or open hot spots that you may travel between
Once wpa_supplicant has begun managing your WiFi interface, you should type "wpa_action eth0 stop" instead of "ifdown eth0".
Using wpa-supplicant (roaming mode)
To configure WPA to roam between wireless networks, you will need to create a new configuration file:
- /etc/wpa_supplicant/wpa_supplicant.conf
a template for this file (and more documentation) is available in:
- /usr/share/doc/wpasupplicant/examples/wpa-roam.conf
You'll need to add networks to this file. Examples:
- WEP:
network={ ssid="MySSID" key_mgmt=NONE wep_key0="abcdefghijklm" # wep_key0=6162636465 # <- no quotes, so hex number wep_tx_keyidx=0 id_str="MySSID" }
- No key:
network={ ssid="SomeNetwork" key_mgmt=NONE }
- WPA:
network={ ssid="Example WPA Network" psk="mysecretpassphrase" id_str="home" }
Next, you'll need to edit /etc/network/interfaces. This lets you configure your wireless networks to use dhcp, or other appropriate TCP/IP settings:
auto eth0 iface eth0 inet manual wpa-driver wext wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf # MySSID comes from an id_str above. iface MySSID inet dhcp # default is what's used if there is no id_str setting. # so the 'SomeNetwork' network will use DHCP. iface default inet dhcp iface home inet static # static interface settings, or whatever...
Finally, if you want attempts to access the internet to default to eth0 (and not usb0), then comment out this line under usb0 adapter configuration:
gateway 192.168.0.200
Roaming from network to network is not automatic. Instead, you need to manually run "wpa_action eth0 stop; ifup eth0" to switch networks
For some reason, I had to reboot for the id_str settings to take effect. However, you should now be able to use "ifup eth0" to associate with the access point and "wpa_action eth0 stop" to down the wifi adapter.
TODO: Which of the issues that single network configurations suffer from are addressed by WPA roaming mode? Would ifplugd / guessnet help, or just make things more complicated?
Manual Setup
NOTE: the following does not apply to Debian at all. Wmiconfig is not part of debian. It is part of the Atheros SDK and it is unclear if anybody wants to go through all the copyright statements and package the whole SDK.
When using wifi-radar (GUI) and not getting any or any decent connection, try the following:
Disclaimer: the code lines below are just suggestions; read them carefully and adjust them to your needs!
First of all, at least when using Distribution Neovento, wifi-radar gets started upon system startup as a daemon; this is no good for manual setup, remove "/etc/rc2.d/S20wifi-radar" (or the like) and reboot (or run "/etc/init.d/wifi-radar stop".
Secondly, get yourself the atheros utility wmiconfig, e.g.:
apt-get install wmiconfig
Then use a script along the lines of:
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" DEV=${DEV:-"eth1"} echo "Wireless device: ${DEV}" DHCP=${DHCP:-"TRUE"} IP=${IP:-"192.168.155.159"} echo "IPv4 address to set: ${IP}" NM=${NM:-"255.255.255.0"} echo "IPv4 netmask to set: ${NM}" GW=${GW:-"192.168.155.155"} echo "IPv4 gateway to set: ${GW}" ESSID=${ESSID:-"dax.tor.at"} echo "WLAN ESSID to set: ${ESSID}" # UP_CNT=1 UP_MAX=2 while [[ $UP_CNT -le 2 ]]; do echo "upping, ${UP_CNT}/${UP_MAX}" if ! mdbus -s org.freesmartphone.ousaged /org/freesmartphone/Usage org.freesmartphone.Usage.ReleaseResource WiFi; then echo 1>&2 "could not mdbus-release WiFi" fi if ! mdbus -s org.freesmartphone.odeviced /org/freesmartphone/Device/PowerControl/WiFi org.freesmartphone.Resource.Disable; then echo 1>&2 "could not mdbus-disable WiFi" fi if ! ifconfig "${DEV}" down; then echo 1>&2 "could not down ${DEV}" fi if ! wmiconfig -i "${DEV}" --wlan disable; then echo 1>&2 "could not disable ${DEV}" fi if ! mdbus -s org.freesmartphone.odeviced /org/freesmartphone/Device/PowerControl/WiFi org.freesmartphone.Resource.Enable; then echo 1>&2 "could not mdbus-enable WiFi" fi if ! mdbus -s org.freesmartphone.ousaged /org/freesmartphone/Usage org.freesmartphone.Usage.RequestResource WiFi; then echo 1>&2 "could not mdbus-request WiFi" fi if ! wmiconfig -i "${DEV}" --wlan enable; then echo 1>&2 "could not enable ${DEV}" fi if ! ifconfig "${DEV}" up; then echo 1>&2 "could not up ${DEV}" fi if ! iwconfig "${DEV}" power off; then echo 1>&2 "could not disable power management of ${DEV}" fi if ! iwconfig "${DEV}" txpower off channel 0; then echo 1>&2 "could not reset ${DEV}" fi if ! wmiconfig -i "${DEV}" --setreassocmode 0; then echo 1>&2 "could not set params on ${DEV}" fi if ! wmiconfig -i "${DEV}" --power maxperf; then echo 1>&2 "could not set power max on ${DEV}" fi if ! iwconfig "${DEV}" essid "${ESSID}"; then echo 1>&2 "could not set (e)ssid ${ESSID}" fi UP_CNT=$((UP_CNT +1)) sleep 2 done if [[ "X${DHCP}" == X"TRUE" ]]; then sleep 5 if ! dhclient3 "${DEV}"; then echo 1>&2 "could not dhclient3 ${DEV}" fi else if ! ifconfig "${DEV}" "${IP}" netmask "${NM}"; then echo 1>&2 "could not set ${IP}, ${NM}" fi if ! route add default gw "${GW}"; then echo 1>&2 "could not set default gw ${GW}" fi fi echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" if ! ifconfig "${DEV}"; then echo 1>&2 "could not ifconfig ${DEV}" fi echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" if ! iwconfig "${DEV}"; then echo 1>&2 "could not iwconfig ${DEV}" fi echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" if ! netstat -anr; then echo 1>&2 "could not netstat -anr" fi echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "you got 15 seconds to check the above output..." sleep 15
Put these line in a batch file (e.g. /root/bin/wifi-your_essid.sh) and create a .desktop file in /usr/share/applications, e.g. "/usr/share/applications/wifi-your_essid.desktop", if you will:
Encoding=UTF-8 Name=wifi-your_essid Exec=xterm -ls -e "/root/bin/wifi-your_essid.sh" Icon=lxterminal Type=Application Categories=Network;
That should give you a symbol in the start menu.
To tear wifi back down, use the something like the following:
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" DEV=${DEV:-"eth1"} echo "Wireless device: ${DEV}" GW=${GW:-"192.168.155.155"} echo "IPv4 gateway to unset: ${GW}" # if ! ifconfig "${DEV}" down; then echo 1>&2 "could not down ${DEV}" fi if ! wmiconfig -i "${DEV}" --wlan disable; then echo 1>&2 "could not wmiconfig-disable ${DEV}" fi if ! mdbus -s org.freesmartphone.ousaged /org/freesmartphone/Usage org.freesmartphone.Usage.ReleaseResource WiFi; then echo 1>&2 "could not mdbus-release WiFi" fi if ! mdbus -s org.freesmartphone.odeviced /org/freesmartphone/Device/PowerControl/WiFi org.freesmartphone.Resource.Disable; then echo 1>&2 "could not mdbus-disable ${DEV}" fi if ! route del default gw "${GW}"; then echo 1>&2 "could not remove default route to ${GW}" fi echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" if ! ifconfig "${DEV}"; then echo 1>&2 "could not ifconfig ${DEV}" fi echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" if ! iwconfig "${DEV}"; then echo 1>&2 "could not iwconfig ${DEV}" fi echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" if ! netstat -anr; then echo 1>&2 "could not netstat -anr" fi echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "you got 15 seconds to check the above output..." sleep 15
Again, make batch file and .desktop file, done.
Further reading
To use all the possibilities of <code>wpasupplicant</code> like roaming and automatic connection to different networks, you should read <code>/usr/share/doc/wpasupplicant/README.Debian.gz</code>