Homepage Wiki Forum Buy

WLAN

From GNUBLIN

severity (level) requirement Gnublin family
Gnublin logo advanced.png Kernel compile, Toolchain Alle


Contents


If you want to run a webserver on the Gnublin board and connect to it with a smartphone or a browser or if you want to send some data to a server you need a connection to the internet. If you won't use a cable to connect to the internet, WLAN is an optimal solution to connect to the internet. If you are a Linux beginner it's recommended to use a WLAN-Adapter which is described below or a WLAN-Adapter which is available at the Gnublin Store.

Gnublin-wlan.JPG


The article refers to the use of Gnublin distribution (for beginners). The advanced students can also work with the outdated ELDK rootfs and should also come to the same conclusion.

For beginners with the Gnublin distribution

For easy access to your local hotspot we wrote a small program which is called gnublin-wlan. You can run the program with the following command:

gnublin-wlan -s <SSID> -k <KEY> -t <dhcp/static>

<SSID> should be the name of your access point and <KEY> should be your WLAN key (wep/wpa/wpa2). With the parameter -t you can decide if you either want a static ip (static) or to get an ip address automaticly (dhcp).

If you want to configure your ip address as a static ip, you can set the ip address you want with the parameter -i <XXX.XXX.X.X> and your gateway ip with -g <XXX.XXX.X.X> where X stands for your wanted IP or gateway IP.

Identify the hardware

Lets begin with setting up the connection.

Before you can connect the USB-adapter you must set the Jumper (above the USB-OTG interface) to Host (H) and bridge the Jumper Host between the two USB-Connectors. For more information about the Jumpers have a look at http://elk.informatik.fh-augsburg.de/pub/eplpc3131/gnublin-1.3.refcard.jpg.

The configuration is separated into three main parts:

  • Identify Hardware and activate the driver modules in linux
  • Connect to the wireless access-point (depends on the encryption like WEP, WPA/WPA2)
  • Setup the connection to the internet

Note: You can start directly with the adapter from the Gnublin-shop described in the following short video [1] . You only have to edit your config-wpa or config-wpa2 to match with your access-point. Detailed instructions how to edit the config-wpa/wpa2 can be found below.


Identify the USB-Sticks

It's recommended that you identify the device and the driver used by that device by plugging the device into a PC or Laptop running Linux. Here you can see and example of the output:

usb 1-1: new high speed USB device using lpc-ehci and address 3 usb 1-1: New USB device found, idVendor=0b05, idProduct=1791 usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 1-1: Product: ASUS WL-167G V3 usb 1-1: Manufacturer: Manufacturer Realtek usb 1-1: SerialNumber: 00e04c000001

You can display the devices plugged in over USB by typing the following command in a shell.

lsusb

The output should look like:

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0b05:1791 ASUSTek Computer, Inc.

or similar!

To go on you should be sure which chipset is used in your Hardware. Unfortunately the manufacturers sometimes change the internal chipsets. You can have a look at the Hardware_Database to check if your stick was previously tested by somebody. On this site you can also see which module is used by the device.


ASUS WL-167g

Bus 001 Device 008: ID 0b05:1706 ASUSTek Computer, Inc. WL-167G 802.11g Adapter [ralink]


Module: rt2500usb

Command: modprobe rt2500usb


ASUS WL-167g v3

Bus 001 Device 003: ID 0b05:1791 ASUSTek Computer, Inc.

Modul: r8712u

The WLAN stick needs both the driver as well as a firmware file that will be loaded dynamically if you load the module.The best way to get this stick running is to use the precompiled kernel with integrated drivers and firmware from the following site (Gnublin Version 1.1 to 1.3 with 8 MB RAM): [2].


Connect to the Wireless Access-point

Activating the interface:

ifup wlan0
ifconfig wlan0 up


Searching for available connections:

iwlist wlan0 scan

The next steps depend on the local configuration of your access-point. After the encryption-mode dependent configuration we're going on with the procedure to connect to the internet which is the same for all encryption types.


WLAN with no encryption

iwconfig wlan0 mode managed essid "access-point-name" (without "")

After that you can go on to the topic "Connection to the Internet".

WEP

iwconfig wlan0 mode managed essid "access-point-name" key 058F116EBB986F1EB01DF02829 (without "")

After that you can go on to the topic "Connection to the Internet".


WPA and WPA2

If your access point uses wpa or wpa2 encryption you must first setup a configuration file, e.g. config-wpa or config-wpa2. You can do this with an editor like vi or nano. This configuration file will be used afterwards to connect to the access-point.

WPA (conf-wpa)

network={
    ssid="your SSID"
    key_mgmt=WPA-PSK
    proto=WPA
    pairwise=CCMP TKIP
    group=CCMP TKIP
    psk="your key"
}

or WPA2 (conf-wpa2)

network={
    ssid="your SSID"
    key_mgmt=WPA-PSK
    proto=WPA2
    pairwise=TKIP CCMP
    group=TKIP CCMP
    psk="your key"
}


NOTE: You must put in the SSID and the PSK of your access-point! " (e.g if your access-point is named Test the line ssid should look like this : ssid="Test" )

After this you can start the wpa daemon which is connecting to the access-point.

WPA

wpa_supplicant -Dwext -i wlan0 -c conf-wpa -dd -B

or WPA2

wpa_supplicant -Dwext -i wlan0 -c conf-wpa2 -dd -B

After that you can go on to the topic "Connection to the Internet".

Connection to the Internet

Configuring the IP-Address manually:

ifconfig wlan0 192.168.1.7

If you want to configure the IP-Address automatically you need to start dhclient

dhclient wlan0

Setting up the Default Gateway:

route add default gw 192.168.1.1

Configuring a nameserver:

cat /etc/resolv.conf
echo "nameserver 192.168.0.1" >> /etc/resolv.conf

You can also use a public nameserver like the one from Google:

echo "nameserver 8.8.8.8" >> /etc/resolv.conf

If everything is configured right you should be able to ping a Website

root@gnublin:/etc# ping www.google.de PING www.google.de (173.194.69.94): 56 data bytes 64 bytes from 173.194.69.94: seq=0 ttl=50 time=39.975 ms 64 bytes from 173.194.69.94: seq=1 ttl=50 time=38.633 ms

You can abort the ping command by pressing CTRL+C.

In other languages