User Tools

Site Tools


cs:wifi
Return to Home page

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Previous revision
cs:wifi [2019/02/26 14:33]
cs:wifi [2021/03/30 12:00] (current)
zioskenz [Disable Network Manager]
Line 1: Line 1:
 +====== WiFi ======
 +To scan all availlable IEEE 802.11 wireless networks:
 +<code bash>iwlist <interface> scanning</code>
  
 +To connect the interface with name <interface> with the wireless network with name <wlan_name>:
 +<code bash>
 +iwconfig <interface> essid <wlan_name>
 +</code>
 +
 +===== Configure a WiFi interface in monitor mode =====
 +
 +<code bash>
 +sudo iw wlan0 interface add moni0 type monitor
 +sudo ifconfig moni0 up
 +</code>
 +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:
 +<code bash>
 +# Block the rate to 54Mb/s in 5Ghz band
 +iw dev wlan0 set bitrates legacy-5 54
 +</code>
 +
 +
 +===== 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:
 +<code bash>
 +# 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
 +</code>
 +
 +===== Connect to a WPA/WPA2 WiFi network =====
 +Use the following command to save the passphrase:
 +<code bash>
 +wpa_passphrase ch1 >> /etc/wpa_supplicant.conf
 +mypassphrase
 +</code>
 +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:
 +<code bash>
 +wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
 +</code>
 +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:
 +<code bash>
 +SIOCSIFFLAGS: Operation not possible due to RF-kill
 +</code>
 +probably your wireless network card is //soft blocked//.
 +
 +Do the following steps:
 +  - Check if the network card is //soft blocked//. You can see the command and the possible output:
 +<code bash>
 +> sudo rfkill list
 +0: phy0: Wireless LAN
 + Soft blocked: yes
 + Hard blocked: no
 +</code>
 +  - Unblock all the network cards:
 +<code bash>
 +sudo rfkill unblock wifi; sudo rfkill unblock all
 +</code>
 +  - Check again the state of the network card in order to know if it has been unblocked:
 +<code bash> 
 +> sudo rfkill list
 +0: phy0: Wireless LAN
 + Soft blocked: no
 + Hard blocked: no
 +</code>
 +
 +===== Disable Network Manager =====
 +To disable the Linux //Network Manager// service type the following commands:
 +<code bash>
 +sudo nmcli radio wifi off
 +sudo rfkill unblock all
 +</code>
 +
 +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?rev=1551188038&do=diff