XO as AP

From OLPC
Revision as of 20:13, 26 June 2008 by 71.156.104.53 (talk) (Bridging support)
Jump to: navigation, search

This documents describes how to set up the XO as an access point using the built-in wireless card.

Setting up the Thinfirm driver / firmware

The access point functionality only works with the libertastf driver, which is not the one bundled in the official builds. To set up this driver follow the instructions at Libertas Thinfirmware HOWTO.

Getting and compiling Hostapd

Hostapd requires a more recent version of libnl than the one included in the OLPC builds. An up to date libnl rpm can be downloaded here. (If you compile hostapd on a different host, you may also have to upgrade libnl and libnl-dev there)

Download hostapd;

git-clone  git://w1.fi/srv/git/hostap.git

The latest tested version is c5f5c91aeb3be but more recent versions should work too.

To compile it, go to the directory hostapd, copy defconfig to .config. On .config:

  1. Uncomment CONFIG_DRIVER_NL80211=y.
  2. To make hostapd use the headers from a kernel different that the one running in you machine, at the end add the lines:
CONFIG_KERNEL_LOC = /path/to/your/kernel-tree
CFLAGS += -I$(CONFIG_KERNEL_LOC)/include

Then compile with make and copy hostapd and hostapd_cli to the target XO.

If hostapd was not compiled in a fedora system, it may complain when executing about not finding the library /lib/libssl.so.0.9.8. If that is the case, you can easily fix it doing, on the target XO:

# cd /lib
# ln -s /lib/libssl.so.0.9.8b /lib/libssl.so.0.9.8
# ln -s /lib/libcrypto.so.0.9.8b /lib/libcrypto.so.0.9.8

Start hostapd

Copy a hostapd configuration file (example) and customize it. The most relevant fields are ssid and channel. Then start the access point with:

# hostapd -d hostapd.conf

Then other machines will be able to associate to the new created access point. A same-subnet IP address must be assigned to each machine, either manually, via dhcp or link-local, to make them able to connect to each other.

Bridging support

It is easy to set up a bridge between the XO BSS and a wired network. First it is necessary to obtain the bridge utils package with:

# yum install bridge-utils

Assuming the XO is connected via eth0 (e.g. an usb ethernet dongle) the steps would be:

# # This step is necessary for the interface to acquire its real MAC address
# ifconfig wlan0 up
# ifconfig wlan0 down
# brctl addbr br0
# ifconfig eth0 0.0.0.0
# brctl addif br0 wlan0
# brctl addif br0 eth0
# # Bridged interfaces do not forward traffic during the first 30 seconds, while they learn the network structure
# sleep 30
# dhclient br0
# hostapd hostapd.conf

Now, if the wired network offers routing and dhcp capabilities, any client that connect to the XO AP will be able to acquire an IP address via dhcp and access the external network.