Neo FreeRunner Wifi

From Openmoko

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
To get wlan working on your Freerunner, you can follow these steps:
+
== What APs are available ==
  
1. create and edit a suitable /etc/wpa_supplicant/wpa_supplicant.conf  (use your favourite search engine to find the syntax)
+
root@om-gta02:~# iwlist eth0 scan
  
2. execute
+
== Using WPA and /etc/network/interfaces==
ifup eth0
+
  
3. execute
+
Once you have a [[GTA02_WLAN#Sample_wpa_supplicant.conf|/etc/wpa_supplicant/wpa_supplicant.conf]] file, add a line under the eth0 entry in /etc/network.interfaces:
  wpa_supplicant -ieth0 -c/etc/wpa_supplicant/wpa_supplicant.conf -B
+
  iface eth0 inet dhcp
(-B for running as daemon)
+
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
  
4. get a IP via dhcp:  
+
Save your changes and run:
udhcpc eth0
+
  # ifdown usb0 && ifup eth0
  
That's it, your wlan should now work!
+
You'll get a lot of messages, like <tt>ioctl[SIOCSIWENCODEEXT]: Operation not supported</tt> and <tt>sed: unrecognized option `--quiet'</tt>, they appear to be harmless. The "--quiet" error message can be avoided by replacing "sed --quiet" with "sed -n" in /etc/wpa_supplicant/*.sh
  
==Using /etc/network/interfaces==
+
== Using WEP and /etc/network/interfaces==
  
Another way is to use /etc/network/interfaces
+
iface eth0 inet dhcp
 
+
For instance, for WEP:
+
 
+
* Using wireless tools:
+
 
+
iface eth0 inet dhcp
+
 
     wireless-key my_wep_key
 
     wireless-key my_wep_key
 
     wireless-essid my_essid
 
     wireless-essid my_essid
 
* Using wpa_supplicant (this allows more authentication methods).
 
  
 
  iface eth0 inet dhcp
 
  iface eth0 inet dhcp
Line 34: Line 25:
 
     wpa-ssid my_essid
 
     wpa-ssid my_essid
  
Using a wpa_supplicant.conf file:
+
Save your changes and run:
iface eth0 inet dhcp
+
  # ifdown usb0 && ifup eth0
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
+
  
Then just run:
+
== Manual attempt ==
ifup eth0
+
  
You'll get a lot of messages, like <tt>ioctl[SIOCSIWENCODEEXT]: Operation not supported</tt> and <tt>sed: unrecognized option `--quiet'</tt>, they appear to be harmless. The "--quiet" error message can be avoided by replacing "sed --quiet" with "sed -n" in /etc/wpa_supplicant/*.sh
+
Create and edit a suitable [[GTA02_WLAN#Sample_wpa_supplicant.conf|/etc/wpa_supplicant/wpa_supplicant.conf]] 
 
+
== Known good wpa-supplicant version? ==
+
  
Is the 0.6.3-r1 broken? I don't get anything to work with these instructions via usage of wpa_supplicant, but WEP works via direct interfaces changes (wireless-essid/wireless-key settings).
+
root@om-gta02:~# ifup eth0
 +
root@om-gta02:~# wpa_supplicant -ieth0 -c/etc/wpa_supplicant/wpa_supplicant.conf -B
 +
root@om-gta02:~# udhcpc eth0
  
 
== Sample wpa_supplicant.conf ==
 
== Sample wpa_supplicant.conf ==
Line 151: Line 140:
 
   
 
   
 
  exit $RETVAL
 
  exit $RETVAL
 
== An alternative way to automate ==
 
Add the wpa_supplicant details to /etc/network/interfaces:
 
 
iface eth0 inet dhcp
 
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
 
 
Now `ifup eth0` will start up wpa_supplicant and udhcpc for you, and `ifdown eth0` will stop them, in theory at least. In practise udhcpc can time out before wpa_supplicant has finished connecting to the access point, and if udhcpc has failed to get an address ifdown exits without stopping wpa_supplicant and bringing down the interface.
 
 
== Comments ==
 
 
The alternative method seems to work reliably on the FR/ GTA02, I couldn't get the manual method to work when WPA/PSK is involved. Also you must do ifdown usb0 before the ifup eth0. Then you also need to setup the resolv.conf manually as it does not seem to get the dns server from the dhcp server. If the dhcp fails during ifup eth0, then you can run udhcpc eth0 manually it usually gets the dhcp address the second time around.
 
 
I use a script called u...
 
# u
 
ifdown usb0
 
ifup eth0
 
echo nameserver xx.xx.xx.xx >/etc/resolv.conf
 
 
This usually works
 
  
  

Revision as of 00:09, 25 July 2008

Contents

What APs are available

root@om-gta02:~# iwlist eth0 scan

Using WPA and /etc/network/interfaces

Once you have a /etc/wpa_supplicant/wpa_supplicant.conf file, add a line under the eth0 entry in /etc/network.interfaces:

iface eth0 inet dhcp
   wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Save your changes and run:

 # ifdown usb0 && ifup eth0

You'll get a lot of messages, like ioctl[SIOCSIWENCODEEXT]: Operation not supported and sed: unrecognized option `--quiet', they appear to be harmless. The "--quiet" error message can be avoided by replacing "sed --quiet" with "sed -n" in /etc/wpa_supplicant/*.sh

Using WEP and /etc/network/interfaces

iface eth0 inet dhcp

   wireless-key my_wep_key
   wireless-essid my_essid
iface eth0 inet dhcp
   wpa-wep-key0 my_wep_key
   wpa-key-mgmt NONE
   wpa-ssid my_essid

Save your changes and run:

 # ifdown usb0 && ifup eth0

Manual attempt

Create and edit a suitable /etc/wpa_supplicant/wpa_supplicant.conf

root@om-gta02:~# ifup eth0
root@om-gta02:~# wpa_supplicant -ieth0 -c/etc/wpa_supplicant/wpa_supplicant.conf -B
root@om-gta02:~# udhcpc eth0

Sample wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
eapol_version=1
ap_scan=1
fast_reauth=1 
# WPA2:
network={
       ssid="your ssid"
       scan_ssid=1
       proto=RSN
       key_mgmt=WPA-PSK
       pairwise=CCMP TKIP
       group=TKIP CCMP
       psk="secret key"
       priority=50
}

# WPA:
network={
      ssid="your_ssid"
      proto=WPA
      key_mgmt=WPA-PSK
      pairwise=TKIP
      group=TKIP
      scan_ssid=1
      psk="secret key"
      priority=10
}

# WEP:
network={
     ssid="your_ssid"
     scan_ssid=1
     key_mgmt=NONE
     wep_tx_keyidx=0
     wep_key0=your_hex_key
     priority=8
}

# Open:
network={
     ssid="your ssid"
     key_mgmt=NONE
     priority=5
}

A very ugly /etc/init.d/wlan startscript

#!/bin/sh
#
# wlan	This shell script starts and stops wlan.
#
# processname: wlan

# Source function library.
#. /etc/rc.d/init.d/functions
# "written" by HdR

RETVAL=0
prog="wlan"

# test -f /etc/default/$prog && . /etc/default/$prog

start() {
	echo -n "Starting $prog: "
	ifconfig eth0 up
	wpa_supplicant -ieth0 -c/etc/wpa_supplicant/wpa_supplicant.conf -B
	sleep 10
	udhcpc eth0
	RETVAL=$?
	return $RETVAL
}

stop() {
	# Stop daemons.
	echo -n "Shutting down $prog: "
        killall wpa_supplicant
	ifconfig eth0 down
#        killproc gpsd
	RETVAL=$?
	return $RETVAL
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart|reload)
	stop
	start
	RETVAL=$?
	;;
  *)
	echo "Usage: $0 {start|stop|restart}"
	exit 1
esac

exit $RETVAL


Success stories

July 23, 2008

wpa_supplicant 0.6.3-r1 works for me with WPA and WPA2 (with PSK) using the config file template on this page. Unlike the comment above, udhcpc is updating /etc/resolver.conf correctly for me (perhaps this is an old problem).

Bringing up wpa_supplicant manually or using "ifup eth0" with the wpa-conf option set in /etc/network/interfaces works for me. If usb0 was already up when running "ifup eth0" you'll end up with 2 default routes which can cause problems. To solve this either take usb0 down first or run "ip route del default dev usb0" to remove the default route to usb0.

July 19, 2008

I've had repeated success with:

# ifconfig eth0 up
# iwconfig eth0 essid any
# iwconfig eth0 key '...'
# iwconfig eth0 essid '...'
# udhcpc eth0
# ifconfig usb0 down; ifconfig usb0 up

Hope that helps someone. This is for WEP.

The following may be helpful in order to scan available networks :

# iwlist eth0 scan


[kd8ikt] script to autoconnect to open AP's http://wiki.openmoko.org/wiki/wifiweasel

Personal tools

What APs are available

root@om-gta02:~# iwlist eth0 scan

Using WPA and /etc/network/interfaces

Once you have a /etc/wpa_supplicant/wpa_supplicant.conf file, add a line under the eth0 entry in /etc/network.interfaces:

iface eth0 inet dhcp
   wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Save your changes and run:

 # ifdown usb0 && ifup eth0

You'll get a lot of messages, like ioctl[SIOCSIWENCODEEXT]: Operation not supported and sed: unrecognized option `--quiet', they appear to be harmless. The "--quiet" error message can be avoided by replacing "sed --quiet" with "sed -n" in /etc/wpa_supplicant/*.sh

Using WEP and /etc/network/interfaces

iface eth0 inet dhcp

   wireless-key my_wep_key
   wireless-essid my_essid
iface eth0 inet dhcp
   wpa-wep-key0 my_wep_key
   wpa-key-mgmt NONE
   wpa-ssid my_essid

Save your changes and run:

 # ifdown usb0 && ifup eth0

Manual attempt

Create and edit a suitable /etc/wpa_supplicant/wpa_supplicant.conf

root@om-gta02:~# ifup eth0
root@om-gta02:~# wpa_supplicant -ieth0 -c/etc/wpa_supplicant/wpa_supplicant.conf -B
root@om-gta02:~# udhcpc eth0

Sample wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
eapol_version=1
ap_scan=1
fast_reauth=1 
# WPA2:
network={
       ssid="your ssid"
       scan_ssid=1
       proto=RSN
       key_mgmt=WPA-PSK
       pairwise=CCMP TKIP
       group=TKIP CCMP
       psk="secret key"
       priority=50
}

# WPA:
network={
      ssid="your_ssid"
      proto=WPA
      key_mgmt=WPA-PSK
      pairwise=TKIP
      group=TKIP
      scan_ssid=1
      psk="secret key"
      priority=10
}

# WEP:
network={
     ssid="your_ssid"
     scan_ssid=1
     key_mgmt=NONE
     wep_tx_keyidx=0
     wep_key0=your_hex_key
     priority=8
}

# Open:
network={
     ssid="your ssid"
     key_mgmt=NONE
     priority=5
}

A very ugly /etc/init.d/wlan startscript

#!/bin/sh
#
# wlan	This shell script starts and stops wlan.
#
# processname: wlan

# Source function library.
#. /etc/rc.d/init.d/functions
# "written" by HdR

RETVAL=0
prog="wlan"

# test -f /etc/default/$prog && . /etc/default/$prog

start() {
	echo -n "Starting $prog: "
	ifconfig eth0 up
	wpa_supplicant -ieth0 -c/etc/wpa_supplicant/wpa_supplicant.conf -B
	sleep 10
	udhcpc eth0
	RETVAL=$?
	return $RETVAL
}

stop() {
	# Stop daemons.
	echo -n "Shutting down $prog: "
        killall wpa_supplicant
	ifconfig eth0 down
#        killproc gpsd
	RETVAL=$?
	return $RETVAL
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart|reload)
	stop
	start
	RETVAL=$?
	;;
  *)
	echo "Usage: $0 {start|stop|restart}"
	exit 1
esac

exit $RETVAL


Success stories

July 23, 2008

wpa_supplicant 0.6.3-r1 works for me with WPA and WPA2 (with PSK) using the config file template on this page. Unlike the comment above, udhcpc is updating /etc/resolver.conf correctly for me (perhaps this is an old problem).

Bringing up wpa_supplicant manually or using "ifup eth0" with the wpa-conf option set in /etc/network/interfaces works for me. If usb0 was already up when running "ifup eth0" you'll end up with 2 default routes which can cause problems. To solve this either take usb0 down first or run "ip route del default dev usb0" to remove the default route to usb0.

July 19, 2008

I've had repeated success with:

# ifconfig eth0 up
# iwconfig eth0 essid any
# iwconfig eth0 key '...'
# iwconfig eth0 essid '...'
# udhcpc eth0
# ifconfig usb0 down; ifconfig usb0 up

Hope that helps someone. This is for WEP.

The following may be helpful in order to scan available networks :

# iwlist eth0 scan


[kd8ikt] script to autoconnect to open AP's http://wiki.openmoko.org/wiki/wifiweasel