To scan all availlable IEEE 802.11 wireless networks:
iwlist <interface> scanning
To connect the interface with name <interface> with the wireless network with name <wlan_name>:
iwconfig <interface> essid <wlan_name>
sudo iw wlan0 interface add moni0 type monitor sudo ifconfig moni0 up
where wlan0 is the name of the interface. moni0 is the name of the interface that receives all the packets of the wireless network. The wireshark program can be used through the moni0 interface to sniff wireless packets.
Useful link regarding the
ath10k driver: https://wireless.wiki.kernel.org/en/users/drivers/ath10k/monitor
To block the transmission rate to a given speed use the bitrates option of the iw command.
# Block the rate to 54Mb/s in 5Ghz band iw dev wlan0 set bitrates legacy-5 54
Let wlan0 and wlan1 be two WiFi networks interfaces, in the same PC or in different PCs. In order to built an Ad-hoc network between these two interfaces,execute the following shell commands:
# Put down the network interface sudo ifconfig wlan0 down # Configure the interface in ad-hoc mode sudo iwconfig wlan0 mode ad-hoc # Configure the transmission and reception channel (for instance channel 1) sudo iwconfig wlan0 channel 48 # Give a name to the WiFi network (for instance xyz) sudo iwconfig wlan0 essid "xyz" # Put up the network interface sudo ifconfig wlan0 up # Eventually provide an address to the network interface (for instance 10.0.0.1 with netmask 255.255.255.0) sudo ifconfig wlan0 10.0.0.1 netmask 255.255.255.0 # Do the same with the second network interface (wlan1) sudo ifconfig wlan1 down sudo iwconfig wlan1 mode ad-hoc sudo iwconfig wlan1 channel 48 sudo iwconfig wlan1 essid "xyz" sudo ifconfig wlan1 up sudo ifconfig wlan1 10.0.0.1 netmask 255.255.255.0
Use the following command to save the passphrase:
wpa_passphrase ch1 >> /etc/wpa_supplicant.conf mypassphrase
In the command
ch1 is the SSID of the Wi-Fi network, while
mypassphrase is the relevant passphrase to connect to the
The actual connection can be performed with the following command:
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
wlan0 is the name of the interface, while the option
-B runs the
wpa_supplicant utility in background.
In the case the following error is printed into the screen:
SIOCSIFFLAGS: Operation not possible due to RF-kill
probably your wireless network card is soft blocked.
Do the following steps:
> sudo rfkill list 0: phy0: Wireless LAN Soft blocked: yes Hard blocked: no
sudo rfkill unblock wifi; sudo rfkill unblock all
> sudo rfkill list 0: phy0: Wireless LAN Soft blocked: no Hard blocked: no
To disable the Linux Network Manager service type the following commands:
sudo nmcli radio wifi off sudo rfkill unblock all