本文记录了自己安装Linux 802.11n CSI Tool的点(xue)点(lei)滴滴。
环境配置
首先,需要一个Intel WiFi Link 5300无线网卡,网上卖的该型号网卡主要有两种接口:pci-ex1以及mini pci。前者可以很方便的插在台式机主机的扩展口上,后者一般是台式机或笔记本原装的网卡接口。购买网卡前最好先看一下机器上的接口是哪一种接口再购买。正常情况下,该网卡在插上后可以直接被系统识别到,如果识别不到,可以参考关于联想g470更换intel5300网卡的问题进行解决。但也要考虑接口是否松动或者机器根本就不支持其他网卡等情况。我的是在一台Dell电脑上尝试很久之后依然无法识别,换了一台其它型号的电脑就OK了。
CSI tool最高只能支持Linux内核为4.2的Ubuntu系统,Installation Instructions上虽然写着支持从Ubuntu 12.04-14.04系统,但现在网上下来的Ubuntu 14.04系统却是Linux 4.4内核的版本,这点导致我重装了n边系统T-T。内核版本可以使用uname -r命令来查看。
在Ubuntu上查看网卡信息,可以使用lspci进行查看,这个命令是用来显示系统中所有PCI总线设备。我的电脑最后显示:
04:00.0 Network controller: Intel Corporation Ultimate N WiFi Link 5300
说明电脑成功识别到了该网卡。
此外,还可以使用ifconfig命令来查看,一般wlan0就是无线网卡。
安装CSI Tool
主要按照Installation Instructions上的指令一步一步执行就可以了,中间的Tips可以不管,但是执行Tips可以获取更强大的功能。下面列出一些必要的步骤:
1. Prerequisites
sudo apt-get install gcc make linux-headers-$(uname -r) git-core
2. Build and Install the Modified Wireless Driver
CSITOOL_KERNEL_TAG=csitool-$(uname -r | cut -d . -f 1-2)
git clone https://github.com/dhalperi/linux-80211n-csitool.git
cd linux-80211n-csitool
git checkout ${CSITOOL_KERNEL_TAG} #之前这一步会报错,之后查看就是系统内核版本过高引起的
make -C /lib/modules/$(uname -r)/build M=$(pwd)/drivers/net/wireless/iwlwifi modules
sudo make -C /lib/modules/$(uname -r)/build M=$(pwd)/drivers/net/wireless/iwlwifi INSTALL_MOD_DIR=updates modules_install
sudo depmod
cd ..
3. Install the Modified Firmware
git clone https://github.com/dhalperi/linux-80211n-csitool-supplementary.git
for file in /lib/firmware/iwlwifi-5000-*.ucode; do sudo mv $file $file.orig; done
sudo cp linux-80211n-csitool-supplementary/firmware/iwlwifi-5000-2.ucode.sigcomm2010 /lib/firmware/
sudo ln -s iwlwifi-5000-2.ucode.sigcomm2010 /lib/firmware/iwlwifi-5000-2.ucode
4. Build the Userspace Logging Tool
make -C linux-80211n-csitool-supplementary/netlink
使用CSI Tool
安装完成后,就可以使用CSI Tool记录CSI信号了。
首先,我们需要卸载原来的驱动,然后再以打开记录CSI的模式加载驱动:
5. Enable Logging and Test
sudo modprobe -r iwlwifi mac80211 # unload the driver
sudo modprobe iwlwifi connector_log=0x1 # reload the driver with CSI logging enabled
由于我是按照Tips一步步安装的,因此到最后点击网络图标WiFi网络会显示“设备未托管”,这时需要手动配置WiFi网络。首先,确保网卡处于开启状态:
sudo ip link set wlan0 up
然后,扫描搜索的WiFi:
sudo iw dev wlan0 scan | less
最后,连接所需要的WiFi:
sudo iw dev wlan0 connect [网络SSID]
注意,这里的WiFi网络要求是没有密码的!FAQ中给出的原因是:
The firmware for this device did not have enough code room for both the beamforming software paths (required to measure CSI) and the encryption software paths (required for WEP/WPA/WPA2/etc. networks).
连接网络后,使用如下命令将CSI数据记录到文件中:
sudo linux-80211n-csitool-supplementary/netlink/log_to_file csi.dat
下面,在同一WiFi网络中的另一终端上ping已装好CSI Tool的主机,IP地址可以使用ifconfig查到。在多次ping之后,就可以得到CSI数据了。
相关资料&后续工作
关于较低版本系统(Ubuntu 10.04)安装CSI Tool,可以参考Old Installation Instructions以及关于Linux 802.11n csi tool的安装注意事项。
CSI Tool提供了AP和Monitor两种模式,上文实现的是最简单的AP模式,关于Monitor模式的设置可以参考 CSI Tool安装使用讲解。
如何处理获得的CSI数据可以参考FAQ以及获取csi文件,并用MATLAB处理。
本文详细介绍了在特定版本的Ubuntu系统下安装Linux802.11nCSITool的过程,包括所需环境配置、安装步骤及使用方法,并分享了解决过程中遇到的一些问题。
4万+





