1. Ubuntu installation
1. Download Ubuntu
First install Ubuntu 14.04 LTS
64-bit download address (the first link on the page)
2. Make a boot disk (pay attention to backup)
You can use the official tool Rufus, download address: https://rufus.ie/
Open Rufus, first back up the files in the original U disk, SELECT the iso file you just downloaded, and click START.
3. Open the BIOS settings of the new computer
Insert the newly made boot disk into the computer, and then open and hold down the Del key to open the BIOS interface. The default is to boot from the hard disk. Here you need to set the priority, first boot from the USB. Different computers have different ways to open the BIOS, mine uses the Del key.
4. Continue to boot and install Ubuntu
After booting from the USB disk, choose the installation method according to your needs. Here, it is recommended to directly overwrite the installation to avoid confusion of different versions of files. Of course, if you have important files on your computer before installation, remember to back them up. It will be fine in about a few minutes.
When finished, first open the installation terminal (hotkey: Ctrl + Alt + T), first check whether the kernel version is between kernel 3.2-4.2.
Check the kernel version command:
cat /proc/version
Then check whether the wireless network card can be used normally, command:
ifconfig
5. Change apt source
By default, apt is a foreign source, which will be relatively slow. If it is replaced by a domestic mirror source, the speed will be faster.
5.1 Backup:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
5.2 Edit list file:
sudo gedit /etc/apt/sources.list
5.3 Replace the content in source.list
Tsinghua source ubuntu version: 14.04 LTS
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse
5.4 update apt:
sudo apt-get update
2. CSI Tool installation
Next, install the CSI Tool and execute them sequentially.
1. Install dependencies
sudo apt-get -y install git-core kernel-package fakeroot build-essential ncurses-dev
sudo apt-get -y install libnl-dev libssl-dev
sudo apt-get -y install iw
2. Download and compile the kernel
2.1 Download the compact version kernel
Lite version kernel: intel-5300-csi-github-master.tar.gz
Download address: https://download.csdn.net/download/u014645508/10579514
2.2 Decompression
Copy the compressed package downloaded in the previous step to the Home directory of the Ubuntu system using a USB flash drive, and prepare to decompress it on Ubuntu. Unzip command:
tar -xvf intel-5300-csi-github-master.tar.gz
2.3 compile
cd intel-5300-csi-github
make oldconfig
Keep pressing Enter to confirm
make menuconfig
Pop-up window, generate a .config file, first select save, then exit
make -j3
The most time-consuming step in the whole process, my machine takes about half an hour to run. 3 This parameter can be understood as the speed of compilation. If the machine performance is relatively good, you can use make -j5.
sudo make install modules_install
It takes about fifteen minutes to install the relevant modules. After this step is executed, the words "couldn't load" may pop up at the beginning. This is because the next step has not been executed, and it is normal that it cannot be loaded.
sudo make install
sudo make install modules_install
2.4 Replace the kernel and update
sudo mkinitramfs -o /boot/initrd.img-`cat include/config/kernel.release` `cat include/config/kernel.release`
make headers_install
I understand that this step is to install files related to subsequent compilation
sudo mkdir /usr/src/linux-headers-`cat include/config/kernel.release`
sudo update-grub
These two steps are the core of the operation and mobile release
Remark:
In soul's blog, the command is different, to confirm
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
There may be a problem here: the newly added startup item option is not displayed after the kernel is compiled, and it can be displayed in the following way.
cd /etc/default
sudo gedit grub
Comment out the following line
#GRUB_HIDDEN_TIMEOUT=0
Then save.
sudo update-grub
2.5 restart
sudo reboot
The kernel entering 4.2.0 after restarting can be confirmed by cat /proc/version
In the future, enter the kernel of this version every time, otherwise you will not receive the number.
3. Replace the firmware
git clone git://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
Replacement firmware job done.
4. Compile the receipt file
Switch to the netlink directory, ready to compile
cd ~/linux-80211n-csitool-supplementary/netlink
make
This step is to compile and generate log_to_file and other files. log_to_file can realize the collection function. If an error is reported in this step, it may be an error in the previous make_headers step. We can modify the log_to_file.c file by ourselves if necessary, but then we need to recompile it in this directory, that is, execute
make clean
make
5. Modify the driver
cd ~/intel-5300-csi-github/drivers/net/wireless/iwlwifi/dvm
cp main.c main.bak.c
gedit main.c
Open the main.c file and press Ctrl+F to search for "connector_log"
Comment out the " ;" and save it after priv->connector_log=iwlwifi_mod_params.connector_log
changing it to "priv->connector_log=1;
6. Recompile
cd ~/intel-5300-csi-github
sudo make
sudo make install modules_install
sudo make install
sudo update-grub
Remark:
When making, an error will be reported. You need to assign the parameter CONFIG_DEBUG_SECTION_MISMATCH=y in .config about the error, and modify it according to the prompt.
3. AP mode collection
1. Connect the computer to the router
I use the installed computer as a client to connect to a router without a password (the one with the password cannot be connected). Another solution is to use create ap to generate a soft AP.
2. Ping the router
Type in terminal:
ping 101.6.69.105 -i 0.5
101.6.69.105 is the ip address of the route, -i 0.5 means that the sending interval is 0.5s, if the interval is less than 0.5s, you need to add sudo.
3. Collection
Create a new terminal and enter in the new terminal:
cd ~/linux-supplementary/netlink
sudo ./log_to_file test.dat
4. Collect data in monitor mode
The monitor mode can set the channel and sending parameters: such as channel number, channel bandwidth, number of packets to send, length of packets to send, packet sending mode, and packet sending interval, which has many advantages compared to the AP mode. In terms of hardware, two computers with 5300 network cards are also required.
1. Install Iorcon
sudo apt-get install libpcap-dev
git clone https://github.com/dhalperi/lorcon-old.git
If you have manually downloaded lorcon-old, put it in the HOME folder and skip the previous step.
cd lorcon-old
./configure
make
sudo make install
cd ~/linux-80211n-csitool-supplementary/injection
make
2. Replace the script
The scripts in the original injection folder may have some problems, you can use the scripts here to replace the original scripts. The sending end replaces setup_inject.sh, and the receiving end replaces setup_monitor_csi.sh. If the two computers send to each other, replace the setup_inject.sh and setup_monitor_csi.sh of the two computers respectively.
2.1 Receiver setup_monitor_csi.sh
A computer is used as the receiving end, ctrl+alt+T opens the terminal window, and runs
cd ~/linux-supplementary/injection
cp setup_monitor_csi.sh setup_monitor_csi.bak.sh
gedit setup_monitor_csi.sh
Open setup_monitor_csi.sh and replace the contents with the following:
setup_monitor_csi.sh
#!/usr/bin/sudo /bin/bash
service network-manager stop
SLEEP_TIME=2
WLAN_INTERFACE=$1
if [ "$#" -ne 3 ]; then
echo "Going to use default settings!"
chn=64
bw=HT20
else
chn=$2
bw=$3
fi
echo "Bringing $WLAN_INTERFACE down....."
ifconfig $WLAN_INTERFACE down
while [ $? -ne 0 ]
do
ifconfig $WLAN_INTERFACE down
done
sleep $SLEEP_TIME
echo "Set $WLAN_INTERFACE into monitor mode....."
iwconfig $WLAN_INTERFACE mode monitor
while [ $? -ne 0 ]
do
iwconfig $WLAN_INTERFACE mode monitor
done
sleep $SLEEP_TIME
echo "Bringing $WLAN_INTERFACE up....."
ifconfig $WLAN_INTERFACE up
while [ $? -ne 0 ]
do
ifconfig $WLAN_INTERFACE up
done
sleep $SLEEP_TIME
echo "Set channel $chn $bw....."
iw $WLAN_INTERFACE set channel $chn $bw
Note that the space in each paragraph must be a tab, otherwise it needs to be modified manually. Otherwise, an error will be reported when running bash.
Execute after modification
./setup_monitor_csi.sh wlan0 13 HT20
The parameter wlan0 is the name of the network card, which can be viewed by running the iwconfig command; 13 is the channel number of the 2.4G frequency band. If only the name of the network card is filled in, the channel number and HT mode will use the default value of 64+HT20 (5G frequency band)
cd ~/linux-80211n-csitool-supplementary/netlink/
sudo ./log_to_file test.dat
2.1 Sending end: setup_inject.sh
Turn on the sending computer and perform operations:
cd ~/linux-supplementary/injection
cp setup_inject.sh setup_inject.bak.sh
gedit setup_inject.sh
Open setup_inject.sh and replace its contents with the following:
setup_inject.sh
#!/usr/bin/sudo /bin/bash
service network-manager stop
WLAN_INTERFACE=$1
SLEEP_TIME=2
modprobe iwlwifi debug=0x40000
if [ "$#" -ne 3 ]; then
echo "Going to use default settings!"
chn=64
bw=HT20
else
chn=$2
bw=$3
fi
sleep $SLEEP_TIME
ifconfig $WLAN_INTERFACE 2>/dev/null 1>/dev/null
while [ $? -ne 0 ]
do
ifconfig $WLAN_INTERFACE 2>/dev/null 1>/dev/null
done
sleep $SLEEP_TIME
echo "Add monitor mon0....."
iw dev $WLAN_INTERFACE interface add mon0 type monitor
sleep $SLEEP_TIME
echo "Bringing $WLAN_INTERFACE down....."
ifconfig $WLAN_INTERFACE down
while [ $? -ne 0 ]
do
ifconfig $WLAN_INTERFACE down
done
sleep $SLEEP_TIME
echo "Bringing mon0 up....."
ifconfig mon0 up
while [ $? -ne 0 ]
do
ifconfig mon0 up
done
sleep $SLEEP_TIME
echo "Set channel $chn $bw....."
iw mon0 set channel $chn $bw
3.
./setup_inject.sh wlan0 13 HT20
sudo echo 0x4101 | sudo tee /sys/kernel/debug/ieee80211/phy0/iwlwifi/iwldvm/debug/monitor_tx_rate
This step can be scripted
0x4101 This part of the parameter settings can be found in the figure below, which is quoted from the installation and use explanation of CSI Tool
For example, 0x1c101 indicates that it supports the selection of three antennas for transmission and the HT20 mode under OFDM, but the rate corresponding to the Rate Selection part is still unknown.
4.
sudo ./random_packets 100000 100 1
The first parameter: the number of packets The second parameter: the length of the packet The third parameter: delay between packets (microseconds).
After performing all the above operations, we can see that computer A has received the data at the receiving end, and then we can analyze it
4. Possible problems
4.1 Reasons why the number may not be received
Possible reasons :
1. Hardware reasons : Adjust the angle and direction of the antenna to ensure that the transmitter and receiver are on the same plane.
2. Software reason : ① If you use the tutorial of Soul Prelude (direction: https://blog.csdn.net/u014645508/article/details/82993718?utm_source=blogxgwz1 ), the software installation is completed and the number cannot be received, probably because The driver has not been changed, you can change the driver or directly replace the script in the tutorial of Soul Prelude with the script in this article.
②Whether the monitor_tx_rate parameter is configured correctly, carefully check the meaning of each bit in the above figure.
If you can't receive it, see wlan and use 802.11 n mode
Reference soul: https://blog.csdn.net/u014645508/article/details/81359409