User Tools

Site Tools


Action disabled: revisions
cs:wifi
Return to Home page

WiFi

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>

Configure a WiFi interface in monitor mode

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

Some useful options

Rate

To block the transmission rate to a given speed use the bitrates option of the iw command.

Examples:

# Block the rate to 54Mb/s in 5Ghz band
iw dev wlan0 set bitrates legacy-5 54

Configure two WiFi interfaces in Ad-hoc mode

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

Connect to a WPA/WPA2 WiFi network

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 ch1 network.

The actual connection can be performed with the following command:

wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf

where wlan0 is the name of the interface, while the option -B runs the wpa_supplicant utility in background.

An useful link: http://linuxcommando.blogspot.it/2013/10/how-to-connect-to-wpawpa2-wifi-network.html

Blocked wireless card

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:

  1. Check if the network card is soft blocked. You can see the command and the possible output:
> sudo rfkill list
0: phy0: Wireless LAN
	Soft blocked: yes
	Hard blocked: no
  1. Unblock all the network cards:
sudo rfkill unblock wifi; sudo rfkill unblock all
  1. Check again the state of the network card in order to know if it has been unblocked:
> sudo rfkill list
0: phy0: Wireless LAN
	Soft blocked: no
	Hard blocked: no

Disable Network Manager

To disable the Linux Network Manager service type the following commands:

sudo nmcli radio wifi off
sudo rfkill unblock all

Other informations on how to disable network manager can be found here: https://support.qacafe.com/knowledge-base/how-do-i-prevent-network-manager-from-controlling-an-interface/


If you found any error, or if you want to partecipate to the editing of this wiki, please contact: admin [at] skenz.it

You can reuse, distribute or modify the content of this page, but you must cite in any document (or webpage) this url: https://www.skenz.it/cs/wifi?do=revisions
/web/htdocs/www.skenz.it/home/data/pages/cs/wifi.txt · Last modified: 2024/04/08 22:35 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki
Privacy Policy