Sunday, February 17, 2013

How to set up Arch Linux on a Raspberry Pi. Part 3: Network Configuration (the tidier version)


NETWORK CONFIGURATION

Wired Network

I had no problems with connecting to the internet using the wired connection during and after installation, so I am not going into any detail here. The only thing I did was setting up a hostname:
  # echo hostname > /etc/hostname
Alternatively, edit the hostname file with nano:
  # nano /etc/hostname
Save the change with [ctrl]-o and exit nano with [ctrl]-x.

Wireless Network

I am using the Edimax EW-7811Un nano USB adapter to connect my Raspbi to my wireless network. You can get it from Amazon.
This working setup was pieced together from the Arch Linux wiki, their forum, here, and on this site.

Driver Installation

This will not be fun. First a few tools have to be installed in order to be able to configure the wirless network.
  # pacman -S wireless_tools wpa_supplicant wpa_actiond dialog netcfg 
  # pacman -S base-devel unzip
The parameter -S will install packages from the internet. A simple confirmation will download and unpack them. Check the name of the wireless interface with 
  # ip link
but it usually is wlan0. The command will also spit out the MAC addresses of all connected network adapters, which is useful for configuring wireless card access lists of a router.

And now comes the nastiest bit: The installation of the linux drivers. You can download them from my Dropbox with
  # wget https://dl.dropbox.com/u/4563987/RTL8192xC_USB_linux_v3.4.4_4749.20121105.zip
which will download and save the file to the current directory. This would be most likely the superuser home directory. 
Unpack the archive using
  # unzip RTL8192xC_USB_linux_v3.4.4_4749.20121105.zip
This will unzip the file into the rtl8192CU_8188CU_linux_v2.0.939.20100726 directory. 
Change into driver directory within that directory via
  # cd RTL8188C_8192C_USB_linux_v3.4.4_4749.20121105/driver/
and unpack the contained tar file with
  # tar -xvzf rtl8188C_8192C_usb_linux_v3.4.4_4749.20121105.tar.gz
The option -x tells tar to unpack the file, in this case using gzip via -z. The output is made verbose (i.e. putting out every action) with -v, and the input is the file defined by -f. Change into the new directory using
  # cd rtl8188C_8192C_usb_linux_v3.4.4_4749.20121105/

Now the driver module has to be compiled and installed. To do this we need a symbolic link to the kernel source:
  # ln -s /usr/src/linux-3.6.11-6-ARCH+/
i.e. create a link to the arm directory in the kernel source directory. Keep in mind that the kernel version can change depending on updates! 
Unfortunately, the Makefile lets make search for the system architecture, which will provide it with '
armv6l', but which does not exist in the source directory. For the compilation to work a change of the Makefile is necessary. Open the makefile with
  # nano Makefile
and search with [ctrl]-w for '($(CONFIG_PLATFORM_I386_PC)' and change in the block following this line 'ARCH ?= $(SUBARCH)' to 'ARCH ?= arm'. No need to worry about the generally wrong system architecture, i.e. i386 PC, it will work
Compile the driver (this will take a while) with
  # make
and install it with
  # make install
This will create a kernel module with the driver, which has to be loaded via
  # modprobe 8192cu 
Now it is time for a reboot with  # reboot
Hopefully the driver will load properly during start-up.

And now for the actual configuration of the wireless interface ...

The wireless interface can be fired up using
  # ip link set wlan0 up
and configured with
  # wifi-menu
The console will change to a menu view with that ugly blue background and a blue menu "in front" of it. At least that is what that black "drop shadow" suggests. The menu will show all detected wireless networks and their signal quality and encryption strength. Select your network using the arrow keys and
confirm with [enter].

wifi-menu: Selection of available networks.
The next menu screen will request the Wifi password. Enter it and hit [OK].

wifi-menu: Enter password.

The menu will then drop back into console mode. Apparently the error message "Failed to initialize driver 'nl80211' can be ignored; the wlan0 interface will fire up without problem. This can be tested with a ping:
  # ping -c 3 www.google.co.uk
The '-c 3' parameter will send out 3 pings. Google is a good choice because a) they answer to pings and b) they are always online. The configuration can be examined using
  # iwconfig
or
  # ifconfig
The former will give details about network mode, ESSID etc, while the latter reveals the ip addresses (which might be usefull if you want to SSH into the Arch system).

Hmm, this is way more chaotic than I intended. This article will need some clearing up some day. Maybe.