Saturday, November 17, 2012

How to set up Arch Linux on a Raspberry Pi. Part 3: Network Configuration

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

Wireless Network

I am using the Edimax EW-7811Un nano USB adapter to connect my Raspi to my wireless network. You can get it from Amazon.
This working setup was pieced together from the Arch Linux wiki, their forum, and 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
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. Download them from the Realtek website (the ones from the Edimax website are outdated and do not work on the Raspberry Pi Arch LInux) using
  # wget ftp://WebUser:n8W9ErCy@208.70.202.220/cn/wlan/RTL8192xC_USB_linux_v3.4.4_4749.20121105.zip
[Update: The login for the FTP server does not work anymore]
which will download and save the file to the home directory of the superuser. Unpack the archive using
  # pacman -S unzip
and then
  # 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/
Just for safety (and because I did it for the non-functional drivers from the Edimax website) create a symbolic link with
  # ln -s /usr/src/linux-
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!
Now install the tools necessary for compilation with
  # pacman -S base-devel
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 startup.

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 wat that black "drop shadow" suggests. Nevermind, 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.

No comments:

Post a Comment