Setting GuruPlug to be a WiFi Client

From PlugWiki
Jump to: navigation, search

GuruPlug can act as a wireless client and can associate with an Access Point in the surrounding area.

Important: It should be noted that under network load, the GuruPlug acting as a wifi client is highly unstable. An alternate (and somewhat more involved) how-to for a new set of stable drivers and firmware is available at: Setting GuruPlug to be a stable WiFi Client

A tutorial for getting client mode working quickly (using the above stable drivers) is available here.

Contents

Switching to WLAN Client Mode

  • Upon bootup, GuruPlug will always come up in Access Point mode. So the first step is to switch the mode to WLAN client.
  • Switching the mode involves putting the client-mode specific firmware binaries at appropriate locations in file system and to modprobe the libertas driver. A script is provided as part of the standard rootfs - /root/wlan.sh (On some systems this is found at /usr/bin/wlan.sh)
  • execute the script '/root/wlan.sh' (Note: As user root.)
  • Upon switching from AP to WLAN client mode, a new interface "wlan0" will be created. All the further operations will be done on this interface.

Associating with an AP having WPA-PSK security

  • Create the configuration file, in /root, as shown below. (or use nano my.config, enter the network configuration, ^X to save, then Yes, and return)
# cat my.conf
network={
        ssid="<SSID>"
        proto=WPA
        key_mgmt=WPA-PSK
        psk="<WPA_KEY>"
}
  • Now run the wpa_supplicant.
#wpa_supplicant -i wlan0 -c my.conf -B
  • The above configuration file specifies that wpa_supplicant will negotiate the use of the WPA protocol, WPA-PSK for key-management, and TKIP or AES for encryption.

(Note: if wpa_supplicant cannot be found, under root run 'apt-get -m -f install wpasupplicant'. You should find wpa_supplicant in /sbin.)

Assuring that the GuruPlug stays a wifi client

  • The /root/init_setup.sh is called by /etc/rc.local to perform the initial setup.
  • Edit init_setup.sh to switch to wifi client. Just before the #Set leds line, insert the following:
# Now set up to run in wifi client mode
/usr/bin/wlan.sh
# /root/my.conf has the details for the wifi connection
/sbin/wpa_supplicant -i wlan0 -c /root/my.conf -B
# Bring up the interface
ifconfig wlan0 up

# for dynamic ip address, use this
# ifconfig wlan0 up
# get an ip via dhcp
# dhclient3 wlan0

# for static ip address, use something like this
ifconfig wlan0 10.0.1.100 netmask 255.255.255.0 up   
route add -net 10.0.1.0 netmask 255.255.255.0 wlan0
route add default gw 10.0.1.1 wlan0
iwconfig wlan0 essid "SSIP"

Associating with an Unsecured(Open Security) Wireless Network

Using wireless-tools

  • Once in WLAN client mode, you can associate with an AP in the surrounding area.
  • Use iwlist on the wlan0 interface to scan the area for available wireless networks.
# ifconfig wlan0 up       # First bring up the interface
# iwlist wlan0 scanning   # scan the area
  • Out of the available networks, select a network you want to associate with.
# iwconfig wlan0 essid "<the ESSID of the WiFi-network>"
  • If a dhcp server is running on the network with which you have associated, run dhclient on the wlan0 interface so that it can receive an IP address from the Access Point.
# dhclient3 wlan0

Using wpa_supplicant

  • Package wpa_supplicant is included in the root file system.
  • To associate with an Unsecured network, first create a configuration file as below.
# cat my.conf
network={
        ssid="<SSID>"
        key_mgmt=NONE
}
  • Now execute the wpa_supplicant on wlan0 interface.
# wpa_supplicant -i wlan0 -c my.conf -B
Personal tools