Raspberry PI configuring Wi-Fi command-line

This was a saga… i bought myself a second hand USB dongle, a Dynamode WL-700N-XS ultra compact (nano) 802.11b/g/n compatible Wi-Fi adapter, based in tbe Realtek 8188CU chipset. A fully updated USB Wi-Fi adapters list is mantained here.

Dynamode Wireless USB Nano 150mbps WL-700N-XSThis chipset is pretty plug an play on the PI with the latest Raspbian Wheezy, reported to work directly with a decent power source, no driver compilation or obscure installation, just supported out of the box by the Linux kernel. Just perfect.

I confidently connect the dongle in the PI, the USB device was properly recognized:

# lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter

also on dmesg

# dmesg
[    3.171681] usb 1-1.2: new high-speed USB device number 4 using dwc_otg
[    3.293726] usb 1-1.2: New USB device found, idVendor=0bda, idProduct=8176
[    3.302266] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    3.311142] usb 1-1.2: Product: 802.11n WLAN Adapter
[    3.317650] usb 1-1.2: Manufacturer: Realtek
[    3.323401] usb 1-1.2: SerialNumber: 00e04c000001
[   15.830604] usbcore: registered new interface driver rtl8192cu

and ifconfig, reports a wlan0, so by now everything looked great. I followed an tutorial about configuring wireless on PI, and no connection, then another, and no connection… shit!!! Then of course i dump the PI tutorials (you can guess the technical level as low when you find “reboot to load the new values”….). Moved to good old Linux documentation, as Raspbian is just another Debian clone.

So before messing with /etc/network/interfaces and /etc/wpa_supplicant/wpa_supplicant.conf the best debug tool is the command ‘iwlist wlan0 scan‘, that should print the available wireless networks. And with this dongle i was getting none (even at 10 centimeters of the wireless router). Long story short, after testing the dongle in other computers (and even other OS – yes, i washed my hands already) i found out the dongle is simply damaged and working rather randomly.

After replacing the dongle (thanks Delaman) by another of the exact same model, things started to work properly, iwlist wlan0 scan started to work right and i could see my wireless network, and the neighbors networks also.

From this point i could confidently resume the wireless network setup. First thing the /etc/network/interfaces:

auto lo
iface lo inet loopback

iface eth0 inet dhcp

auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

iface default inet dhcp

the important lines here are those 3 referring to the wlan interface and should be added to the configuration file.

Then the /etc/wpa_supplicant/wpa_supplicant.conf that holds the network security configuration. First i tried some of the suggested configurations in the Internets, but i was just getting the error: “failed to parse ssid ‘MY_NETWORK_NAME’” and the likes. So, go with the wpa_passphrase command to generate a network block configuration:

wpa_passphrase YOUR_NETWORK_NAME password

Now copy and replace the generated network block to /etc/wpa_supplicant/wpa_supplicant.conf, it should look something like this (a quite simple and clean configuration):

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


You can heep the first two lines, as they provide an interface to the wpa_supplicant via the wpa_cli command.

Don’t have to reboot, i tested this while ethernet connected. Restart the wlan0 interface and reload the configuration into the supplicant thing:

ifdown wlan0
ifup wlan0
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf

And there, ifconfig shows an active Wi-Fi connection on wlan0. From other computer, the wlan0 IP responds on pings and is possible to SSH. Now disable the ethernet connection:

ifdown eth0

disconnect the ethernet cable, and there your PI is free to move around without the network cable.

The not so quiet revolution

How many times did i hear… the “ahh…good old times” rant. Sure, sometimes the world as we know it now is complicated, sometimes unfair and even cruel and bad. But if you stop and zoom out a bit, like 20 years (don’t need to go all the way to the dark ages), one realizes the leap forward. And in technology the leap is nothing short of massive – thank you Mr. Moore. I’m really glad and lucky to be apart of this.

You can get a Raspberry PI a fully functional (and power efficient) computer running Linux for about 30€. You can get a TV stick running Android OS for about 50€ (there are Linux distributions for this kind of device). Linux is free, BSD OS family is free. Most of the SDKs are free. MySQL is free (as other fully capable Relational Database Systems). Many compilers are free. Open Office is free. Heck, even Adobe CS2 can be freely downloaded from Adobe…

Transit Price Drops

Also the price of bandwidth and networking has gone South over the years as the speed and quality has gone North. I remember to dial-up with a 28.8 kbps modem, downloading a single mp3 file was task for one hour, loading a simple webpage was eternity, etc… and in the end of the month the phone bill was obscene… Nowadays, i can download pristine high resolution full movie (in Itunes or other payed service of course) in less than an hour for a fraction of the cost that the mp3.

Documentation, tutorials, examples, e-books, howto’s all over the place. Information (for all levels) is freely available to anyone, you just need time and the right mindset, to read, test and educate yourself about any technology that you want to learn.

So in the web business capital is not the main factor, it’s knowledge and labor. The funny thing is that capitalism did this, an industry that moves billions of dollars and for start capital is not the most important factor (by far). Some kid can (and probably is) somewhere in some room build the next big website or mobile app costing him (or her) nothing more than time.

There is a bright future in this model. You don’t need some guys in suits that are sitting on top of the money to believe in your idea. You are the only one that needs to believe (can you picture the scared faces?) and learn, learn, learn:

Personally i wish i had much more time and piece of mind to learn and thinker with new technologies and projects because now is the time.