XO as AP: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
 
(13 intermediate revisions by 7 users not shown)
Line 7: Line 7:
== Getting and compiling Hostapd ==
== Getting and compiling Hostapd ==


Hostapd requires a more recent version of <strong>libnl</strong> than the one included in the OLPC builds. An up to date libnl rpm can be downloaded [ftp://fr.rpmfind.net/linux/fedora/updates/7/i386/libnl-1.1-1.fc7.i386.rpm here].
Hostapd requires a more recent version of <strong>libnl</strong> than the one included in the OLPC builds. An up to date libnl rpm can be downloaded [ftp://fr.rpmfind.net/linux/fedora/updates/7/i386/libnl-1.1-1.fc7.i386.rpm here]. <small>(If you compile hostapd on a different host, you may also have to upgrade libnl and libnl-dev there)</small>


Download hostapd;
Download hostapd;
<pre>
<pre>
git-clone git://w1.fi/srv/git/hostap.git
git-clone git://w1.fi/srv/git/hostap.git
cd hostap
git checkout 886a807fb5
</pre>
</pre>


The latest tested version is b717ee2ab25c but more recent versions should work too.
The latest tested version on an XO-1 is '''886a807fb5'''. Some more recent versions do not work - in particular, 0b86f67..., current as of 2010-05-19, does not work with the setup described herein.


To compile it, go to the directory <tt>hostapd</tt>, copy <tt>defconfig</tt> to <tt>.config</tt>. On <tt>.config</tt>:
To compile it, go to the directory <tt>hostapd</tt>, copy <tt>defconfig</tt> to <tt>.config</tt>. On <tt>.config</tt>:
Line 24: Line 26:
</pre>
</pre>


Then compile with <tt>make</tt< and copy <tt>hostapd</tt> and <tt>hostapd_cli</tt> to the target XO.
Then compile with <tt>make</tt> and copy <tt>hostapd</tt> and <tt>hostapd_cli</tt> to the target XO.


If you get compilation errors involving missing "netlink/" and/or "openssl/" files, install the libnl and openssl development packages. In Fedora, the incantation is:
If hostapd was not compiledy in a fedora system, it may complain when executing about not finding the library /lib/libssl.so.0.9.8. If

<pre>
# sudo yum install libnl-devel
# sudo yum install openssl-devel
</pre>

The corresponding Debian package names are (I think) libnl-dev and libssl-dev.

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:
that is the case, you can easily fix it doing, on the target XO:
<pre>
<pre>
Line 33: Line 44:
# ln -s /lib/libcrypto.so.0.9.8b /lib/libcrypto.so.0.9.8
# ln -s /lib/libcrypto.so.0.9.8b /lib/libcrypto.so.0.9.8
</pre>
</pre>

''I [wmb] compiled hostapd on Fedora 12, and when I ran it on the XO, it complained about libssl.so.10 and libcrypto.so.10. I solved that problem by copying those files from /usr/lib/lib{ssl,crypto}.so.10 on the host system into /lib on the XO.''


== Start hostapd ==
== Start hostapd ==
Line 41: Line 54:


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.
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:
<pre>
# yum install bridge-utils
</pre>

Assuming the XO is connected via <tt>eth0</tt> (e.g. a usb ethernet dongle) the steps would be:
<pre>
# # 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
</pre>
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.

== WPA support ==
To activate WPA, edit <tt>hostapd.conf</tt> to set the appropriate values to <tt>wpa</tt> and either <tt>wpa_psk</tt> or <tt>wpa_passphrase</tt>. Then restart hostapd. A recent version of hostapd is needed for WPA support. Version 886a807fb5 from hostapd git is known to work.

Latest revision as of 17:30, 20 April 2010

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
cd hostap
git checkout 886a807fb5

The latest tested version on an XO-1 is 886a807fb5. Some more recent versions do not work - in particular, 0b86f67..., current as of 2010-05-19, does not work with the setup described herein.

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 you get compilation errors involving missing "netlink/" and/or "openssl/" files, install the libnl and openssl development packages. In Fedora, the incantation is:

# sudo yum install libnl-devel
# sudo yum install openssl-devel

The corresponding Debian package names are (I think) libnl-dev and libssl-dev.

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

I [wmb] compiled hostapd on Fedora 12, and when I ran it on the XO, it complained about libssl.so.10 and libcrypto.so.10. I solved that problem by copying those files from /usr/lib/lib{ssl,crypto}.so.10 on the host system into /lib on the XO.

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. a 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.

WPA support

To activate WPA, edit hostapd.conf to set the appropriate values to wpa and either wpa_psk or wpa_passphrase. Then restart hostapd. A recent version of hostapd is needed for WPA support. Version 886a807fb5 from hostapd git is known to work.