Linux 802.11n CSI Tool

GitHub | Main Page | FAQ | Get Help

Old Installation Instructions

This describes the steps used to configure the original testbed at the University of Washington. They are meant to be followed on Ubuntu 10.04.4 LTS i386 (32-bit) which has reached end-of-life and no longer receives security updates, so please follow the current installation instructions.

1. (Optional) Configure Ubuntu for Kernel Development

If you are scripting commands you can either setuid them or you can just disable password checks for sudo. I prefer the latter, it comes in handy more and requires less manual effort. But, install your security patches.

sudo visudo
# change
# %admin ALL=(ALL) ALL
# to
# %admin ALL=NOPASSWD: ALL

If you are planning on modifying the driver and other parts of the wireless network stack, you'll want to make sure the modules aren't autoloaded. This way, when you crash the machine, it'll stay up when it reboots!

sudo vim /etc/modprobe.d/blacklist.conf
# Add this:
	# blacklist modules under active development
	blacklist iwldvm
	blacklist iwlwifi
	blacklist mac80211
	blacklist cfg80211

2. Install necessary packages on Ubuntu

These are for ensuring you can compile and install our modified Linux kernel.

sudo apt-get -y install git-core kernel-package fakeroot build-essential ncurses-dev

These are for compiling our userspace tools.

sudo apt-get -y install libnl-dev libssl-dev	# Install some necessary libraries

iw is the new iwconfig. You need it to do things like enable monitor mode and 40 MHz channels from the command line.

sudo apt-get -y install iw

3. Download, configure, compile, and install our custom Linux kernel

First, we fetch the code for the stable release of our custom kernel. We also fetch supplemental files such as custom firmware, userspace tools, and MATLAB scripts.

git clone -b csitool-stable git://github.com/dhalperi/linux-80211n-csitool.git
git clone git://github.com/dhalperi/linux-80211n-csitool-supplementary.git

Next, we configure the kernel. We offer two options for how this can be done. V1: This version uses our optimized kernel config. It compiles very fast and has a lot of Linux cruft removed, but it may take a few tries to get it working for all the hardware on your system.

cd linux-80211n-csitool			# Go into the kernel src directory
make oldconfig				# Use our optimized kernel config
make menuconfig				# Enable your system-specific hardware

V2. This method uses the Ubuntu default config, which is designed to work on any system but generates a very large kernel image and takes much longer to compile.

cp /boot/config-`uname -r` .config
make oldconfig

Now it's time to compile, and finally install the kernel.

make -j3 bzImage modules		# -j3 here is 3-way parallelism, try #cores+1
sudo make install modules_install	# INSTALL
sudo mkinitramfs -o /boot/initrd.img-`cat include/config/kernel.release` \
	`cat include/config/kernel.release`	# create ramdisk used to boot
sudo update-grub			# Only needed the first time for a new version

Next we install the Linux kernel-headers. The userspace utilities that log the CSI reported by the NIC need this to function.

make headers_install	# creates a copy of the linux-headers in ./usr/include/
sudo mkdir /usr/src/linux-headers-`cat include/config/kernel.release`
sudo cp -rf usr/include /usr/src/linux-headers-`cat include/config/kernel.release`/include

Finally, reboot into your new kernel. If you have issues booting, boot back into the previous kernel and then look into your kernel config.

4. Install our custom firmware.

The firmware is located in the supplementary material git at linux-80211n-csitool-supplementary/firmware/.

# backup original firmware, good for reference
sudo cp /lib/firmware/iwlwifi-5000-2.ucode /lib/firmware/iwlwifi-5000-2.ucode.orig
sudo mv /lib/firmware/iwlwifi-5000-5.ucode /lib/firmware/iwlwifi-5000-5.ucode.orig
# copy ours in separately, keeping name for reference
sudo cp iwlwifi-5000-2.ucode.sigcomm2010 /lib/firmware/
# install ours
sudo cp iwlwifi-5000-2.ucode.sigcomm2010 /lib/firmware/iwlwifi-5000-2.ucode

5. Download and compile hostap.

At the time of writing, hostap 0.7 is the stable version.

cd						# Back out of the kernel tree
git clone git://w1.fi/srv/git/hostap-07.git	# Get the code
cd hostap-07/hostapd
cp <hostap-dotconfig> .config			# Our hostap config from linux-80211n-csitool-supplementary/hostap-config-files/
make
cp <hostapd.conf-test> hostapd.conf		# Install the vanilla hostap conf we provide

6. Install the userspace logging utility.

The userspace netlink tool that logs CSI is located in the supplementary material git at linux-80211n-csitool-supplementary/netlink/.

cd ~/linux-80211n-csitool-supplementary/netlink		# We assume you install into your home directory
make							# hopefully the make succeeds!
# If not, figure out why it didn't compile. Did you install the Linux headers above?

7. Let's try it out!

First we'll test that hostap is working.

sudo modprobe iwlwifi   # did it work?  Do you see logs about iwlwifi in the dmesg?
sudo iwlist scanning    # did it work?  Did you get access points?
sudo ~/hostap-07/hostapd/hostapd ~/hostap-07/hostapd/hostapd.conf
# did it work? if you're in a busy network you should see probe requests going by
# also, go to a machine you control and scan
# go to a machine you control and associate sudo iwconfig wlan0 essid csitool-test
# ... etc

Make sure to kill hostapd when you're done. Then put 802.11n-enabled hostapd config file in place:

cp <hostapd.conf-real> hostapd.conf		# Install the real hostap conf we provide

Now let's try logging some beamforming information, i.e., CSI!

sudo rmmod iwlwifi mac80211 cfg80211			# remove the modules
sudo modprobe iwlwifi connector_log=0x1			# load the modules and set userspace beamforming logging
<first, associate and set up IP to an AP that will send you HT packets>
cd ~/linux-80211n-csitool-supplementary/netlink
sudo ./log_to_file tmp.dat

In a different terminal, start pinging the access point

ping <AP IP address>

By pinging the AP (make sure the pings are answered!), you are starting traffic flow between your client and AP. Intel has programmed its drivers to start in Legacy (802.11a/g) mode, thus the first pings will be sent at the 1Mbps or 6Mbps rate. For legacy rates, CSI will not be measured.

After a few dozen pings, the rate selection should automatically switch to HT (802.11n) bitrates. At this point, log_to_file will start recording packets and the iwlwifi driver will print messages in the kernel syslog.

Back to the main page