Wifi: Difference between revisions
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== References == |
== References == |
||
* https://www.cyberciti.biz/tips/linux-find-out-wireless-network-speed-signal-strength.html |
* https://www.cyberciti.biz/tips/linux-find-out-wireless-network-speed-signal-strength.html |
||
* https://wireless.wiki.kernel.org/en/users/documentation/hostapd (hostapd) |
|||
== |
== Wifi tools == |
||
=== iw === |
|||
* <tt>[[Linux Commands#iwconfig|iwconfig]]</tt>, get information or configure a wireless network interface |
|||
To be completed. |
|||
<source lang="bash"> |
<source lang="bash"> |
||
iw list # View wlan device capabilities |
|||
</source> |
|||
sudo iwconfig wlan0 # Configure |
|||
=== iwconfig === |
|||
<code>[[Linux Commands#iwconfig|iwconfig]]</code>, get information or configure a wireless network interface |
|||
<source lang="bash"> |
|||
# iwconfig is in /sbin. Either give full path or use sudo |
|||
/sbin/iwconfig # Get information |
|||
sudo iwconfig # Get information |
|||
</source> |
|||
Example of information returned by <code>iwconfig</code>: |
|||
<source lang="bash"> |
|||
iwconfig |
iwconfig |
||
# enp0s31f6 no wireless extensions. |
|||
# # iwconfig |
|||
# lo no wireless extensions. |
|||
# |
# |
||
# wlp1s0 IEEE 802.11 ESSID:"ManticoreNet" |
|||
# eth0 no wireless extensions. |
|||
# Mode:Managed Frequency:5.18 GHz Access Point: 38:2C:4A:A3:62:37 |
|||
# |
|||
# Bit Rate=240 Mb/s Tx-Power=22 dBm |
|||
# wlan0 IEEE 802.11abg ESSID:off/any |
|||
# |
# Retry short limit:7 RTS thr:off Fragment thr:off |
||
# Retry long limit:7 RTS thr:off Fragment thr:off |
|||
# Encryption key:off |
# Encryption key:off |
||
# Power Management: |
# Power Management:on |
||
# Link Quality=49/70 Signal level=-61 dBm |
|||
# Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 |
|||
# Tx excessive retries:0 Invalid misc:56 Missed beacon:0 |
|||
# |
|||
# lo no wireless extensions. |
|||
</source> |
|||
Note that the Link quality and signal level is also available in {{file|/proc/net/wireless}}: |
|||
iwconfig wlan0 # Limit to wlan0 |
|||
<source lang="bash"> |
|||
cat /proc/net/wireless |
|||
# Inter-| sta-| Quality | Discarded packets | Missed | WE |
|||
# face | tus | link level noise | nwid crypt frag retry misc | beacon | 22 |
|||
# wlp1s0: 0000 49. -61. -256 0 0 0 0 58 0 |
|||
</source> |
</source> |
||
=== iwlist === |
|||
* <tt>[[Linux Commands#iwlist|iwlist]]</tt>, get more detailed wireless information from a wireless interface |
|||
<code>[[Linux Commands#iwlist|iwlist]]</code>, get more detailed wireless information from a wireless interface |
|||
<source lang="bash"> |
<source lang="bash"> |
||
sudo iwlist scan |
sudo iwlist scan |
||
sudo iw dev wlan0 scan # wlan0 or wlp1s0 or ... |
sudo iw dev wlan0 scan # wlan0 or wlp1s0 or ... |
||
</source> |
</source> |
||
* <tt>[[Linux Commands#rfkill|rfkill]]</tt>, show state of RF SW/HW kill switch (WiFi / BT / ...) |
|||
=== nmcli === |
|||
<code>[[Linux Commands#nmcli|nmcli]]</code> can set and query wifi devices and wifi connections. |
|||
<source lang="bash"> |
|||
nmcli d wifi |
|||
# IN-USE SSID MODE CHAN RATE SIGNAL BARS SECURITY |
|||
# ManticoreNet Infra 1 270 Mbit/s 72 ▂▄▆_ WPA2 |
|||
# * ManticoreNet Infra 36 405 Mbit/s 62 ▂▄▆_ WPA2 |
|||
# WiFi-5.0-C1C3 Infra 108 540 Mbit/s 60 ▂▄▆_ WPA2 |
|||
# WiFi-2.4-C1C3 Infra 6 54 Mbit/s 57 ▂▄▆_ -- |
|||
</source> |
|||
=== rfkill === |
|||
* <code>[[Linux Commands#rfkill|rfkill]]</code>, show state of RF SW/HW kill switch (WiFi / BT / ...) |
|||
<source lang="bash">rfkill list all</source> |
<source lang="bash">rfkill list all</source> |
||
Line 38: | Line 73: | ||
nmcli connection show "testing" |
nmcli connection show "testing" |
||
nmcli -f GENERAL,WIFI-PROPERTIES dev show wlp1s0 |
nmcli -f GENERAL,WIFI-PROPERTIES dev show wlp1s0 |
||
</source> |
|||
=== /proc/net/wireless === |
|||
This file contains some information regarding the status of the wifi connections: |
|||
<source lang="bash"> |
|||
cat /proc/net/wireless |
|||
# Inter-| sta-| Quality | Discarded packets | Missed | WE |
|||
# face | tus | link level noise | nwid crypt frag retry misc | beacon | 22 |
|||
# wlp1s0: 0000 52. -58. -256 0 0 0 0 58 0 |
|||
</source> |
</source> |
||
Line 48: | Line 92: | ||
* [https://admin.kuleuven.be/icts/services/wifi/configuratiewifi/config-linux Wifi PEAP at KULeuven] |
* [https://admin.kuleuven.be/icts/services/wifi/configuratiewifi/config-linux Wifi PEAP at KULeuven] |
||
== Linux Access Point == |
== Setup a Linux Access Point / Wifi Hotspot == |
||
=== In Gnome Debian Buster === |
|||
Use '''Gnome Settings -> WiFi -> ... -> Turn on Wi-Fi hotspot''' [https://vitux.com/make-debian-a-wireless-access-point/] |
|||
=== Using Network Manager === |
|||
From [https://wiki.debian.org/WiFi/HowToUse debian.org]: |
|||
<source lang=bash> |
|||
nmcli dev wifi hotspot ifname wlp4s0 ssid test password "test1234" |
|||
</source> |
|||
=== old stuff === |
|||
You can turn your laptop into a WiFi access point, provided of course that your WiFi card supports that feature: |
You can turn your laptop into a WiFi access point, provided of course that your WiFi card supports that feature: |
||
<source lang="bash"> |
<source lang="bash"> |
||
Line 68: | Line 122: | ||
* [https://help.ubuntu.com/community/WifiDocs/WirelessAccessPoint WirelessAccessPoint on Ubuntu Wiki] |
* [https://help.ubuntu.com/community/WifiDocs/WirelessAccessPoint WirelessAccessPoint on Ubuntu Wiki] |
||
* [http://www.devshed.com/c/a/BrainDump/Building-a-Linux-Wireless-Access-Point/ Building a Linux Wireless Access Point] |
* [http://www.devshed.com/c/a/BrainDump/Building-a-Linux-Wireless-Access-Point/ Building a Linux Wireless Access Point] |
||
== Tips == |
|||
=== Get Wifi device === |
|||
Using <code>nmcli</code>: |
|||
<source lang="bash"> |
|||
nmcli dev|awk '$2 == "wifi" {print $1}' |
|||
# wlp1s0 |
|||
</source> |
|||
=== Scan free channels / frequency === |
|||
We can use these tools to list the currently used channels [https://askubuntu.com/questions/309458/is-there-a-program-to-see-channels-used-by-wi-fi-networks-similar-to-vistumbler]: |
|||
* One liner |
|||
<source lang="bash"> |
|||
# Interface doesn't support scanning: Change itf name as necessary |
|||
sudo iwlist wlp0s20f3 scan | grep Frequency | sort | uniq -c | sort -n |
|||
</source> |
|||
* GUI app '''linssid''' |
|||
<source lang="bash"> |
|||
sudo apt install linssid |
|||
</source> |
|||
== Troubleshoot wifi == |
== Troubleshoot wifi == |
||
=== Connection issues === |
|||
<source lang=bash> |
<source lang=bash> |
||
# Check device |
# Check device |
||
Line 81: | Line 156: | ||
# Check status interfaces |
# Check status interfaces |
||
ifconfig |
ifconfig |
||
# Check signal quality |
|||
sudo iwconfig wlp1s0|grep -i quality |
|||
# Link Quality=52/70 Signal level=-58 dBm |
|||
nmcli dev wifi |
|||
# IN-USE SSID MODE CHAN RATE SIGNAL BARS SECURITY |
|||
# testing Infra 13 270 Mbit/s 70 ▂▄▆_ WPA2 |
|||
watch -n 1 cat /proc/net/wireless |
|||
# Inter-| sta-| Quality | Discarded packets | Missed | WE |
|||
# face | tus | link level noise | nwid crypt frag retry misc | beacon | 22 |
|||
# wlp1s0: 0000 52. -58. -256 0 0 0 0 182 0 |
|||
# Get available WiFi connections |
# Get available WiFi connections |
||
Line 103: | Line 167: | ||
</source> |
</source> |
||
=== Signal quality === |
|||
Wifi is either controlled by '''NetworkManager''' or via the command line. |
|||
<code>iwconfig</code> returns information on the link quality and signal level: |
|||
<source lang="bash"> |
|||
# Check signal quality |
|||
sudo iwconfig wlp1s0|grep -i quality |
|||
# Link Quality=52/70 Signal level=-58 dBm |
|||
</source> |
|||
The same information is available from {{file|/proc/net/wireless}}: |
|||
<source lang="bash"> |
|||
cat /proc/net/wireless |
|||
# Inter-| sta-| Quality | Discarded packets | Missed | WE |
|||
# face | tus | link level noise | nwid crypt frag retry misc | beacon | 22 |
|||
# wlp1s0: 0000 52. -58. -256 0 0 0 0 58 0 |
|||
</source> |
|||
<code>nmcli</code> also returns signal information, but more human-friendly: |
|||
<source lang="bash"> |
|||
nmcli dev wifi |
|||
# IN-USE SSID MODE CHAN RATE SIGNAL BARS SECURITY |
|||
# testing Infra 13 270 Mbit/s 70 ▂▄▆_ WPA2 |
|||
</source> |
|||
=== NetworkManager === |
|||
Wifi is either controlled by '''NetworkManager''' or via the command line (<code>nmcli</code>). |
|||
;NetworkManager |
|||
;Command file |
;Command file |
||
Line 111: | Line 199: | ||
* For WPA, see file {{file|/etc/wpa_supplicant/wpa_supplicant.conf}}. |
* For WPA, see file {{file|/etc/wpa_supplicant/wpa_supplicant.conf}}. |
||
=== Miscellaneous === |
|||
{| class=wikitable width=100% |
{| class=wikitable width=100% |
Latest revision as of 11:28, 29 April 2022
References
- https://www.cyberciti.biz/tips/linux-find-out-wireless-network-speed-signal-strength.html
- https://wireless.wiki.kernel.org/en/users/documentation/hostapd (hostapd)
Wifi tools
iw
To be completed.
iw list # View wlan device capabilities
iwconfig
iwconfig
, get information or configure a wireless network interface
# iwconfig is in /sbin. Either give full path or use sudo
/sbin/iwconfig # Get information
sudo iwconfig # Get information
Example of information returned by iwconfig
:
iwconfig
# enp0s31f6 no wireless extensions.
#
# wlp1s0 IEEE 802.11 ESSID:"ManticoreNet"
# Mode:Managed Frequency:5.18 GHz Access Point: 38:2C:4A:A3:62:37
# Bit Rate=240 Mb/s Tx-Power=22 dBm
# Retry short limit:7 RTS thr:off Fragment thr:off
# Encryption key:off
# Power Management:on
# Link Quality=49/70 Signal level=-61 dBm
# Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
# Tx excessive retries:0 Invalid misc:56 Missed beacon:0
#
# lo no wireless extensions.
Note that the Link quality and signal level is also available in /proc/net/wireless:
cat /proc/net/wireless
# Inter-| sta-| Quality | Discarded packets | Missed | WE
# face | tus | link level noise | nwid crypt frag retry misc | beacon | 22
# wlp1s0: 0000 49. -61. -256 0 0 0 0 58 0
iwlist
iwlist
, get more detailed wireless information from a wireless interface
sudo iwlist scan
sudo iw dev wlan0 scan # wlan0 or wlp1s0 or ...
nmcli
nmcli
can set and query wifi devices and wifi connections.
nmcli d wifi
# IN-USE SSID MODE CHAN RATE SIGNAL BARS SECURITY
# ManticoreNet Infra 1 270 Mbit/s 72 ▂▄▆_ WPA2
# * ManticoreNet Infra 36 405 Mbit/s 62 ▂▄▆_ WPA2
# WiFi-5.0-C1C3 Infra 108 540 Mbit/s 60 ▂▄▆_ WPA2
# WiFi-2.4-C1C3 Infra 6 54 Mbit/s 57 ▂▄▆_ --
rfkill
rfkill
, show state of RF SW/HW kill switch (WiFi / BT / ...)
rfkill list all
If using Network Manager:
nmcli connection show
# NAME UUID TYPE DEVICE
# testing 1eba2547-2cc2-4785-9288-f205aa6f533d wifi wlp1s0
nmcli connection show "testing"
nmcli -f GENERAL,WIFI-PROPERTIES dev show wlp1s0
/proc/net/wireless
This file contains some information regarding the status of the wifi connections:
cat /proc/net/wireless
# Inter-| sta-| Quality | Discarded packets | Missed | WE
# face | tus | link level noise | nwid crypt frag retry misc | beacon | 22
# wlp1s0: 0000 52. -58. -256 0 0 0 0 58 0
Utilities
Wavemon
See Linux commands.
Wifi PEAP
Setup a Linux Access Point / Wifi Hotspot
In Gnome Debian Buster
Use Gnome Settings -> WiFi -> ... -> Turn on Wi-Fi hotspot [1]
Using Network Manager
From debian.org:
nmcli dev wifi hotspot ifname wlp4s0 ssid test password "test1234"
old stuff
You can turn your laptop into a WiFi access point, provided of course that your WiFi card supports that feature:
sudo service network-manager stop
sudo iwconfig wlan0 mode master
If you get the following error then most probably it is not supported:
Error for wireless request "Set Mode" (8B06) :
SET failed on device wlan0 ; Invalid argument.
Turn NetworkManager back on:
sudo service network-manager start
Some links:
Tips
Get Wifi device
Using nmcli
:
nmcli dev|awk '$2 == "wifi" {print $1}'
# wlp1s0
Scan free channels / frequency
We can use these tools to list the currently used channels [2]:
- One liner
# Interface doesn't support scanning: Change itf name as necessary
sudo iwlist wlp0s20f3 scan | grep Frequency | sort | uniq -c | sort -n
- GUI app linssid
sudo apt install linssid
Troubleshoot wifi
Connection issues
# Check device
lsusb # if wifi usb device
lspci # if wifi pci device
lspci | egrep -i 'wifi|wlan|wireless'
# Check if device has an interface
iwconfig
# Check status interfaces
ifconfig
# Get available WiFi connections
nmcli c[onnection]
# Get Wifi Status
nmcli r[adio]
# If Wifi is down, turn it on:
nmcli r wifi on
Signal quality
iwconfig
returns information on the link quality and signal level:
# Check signal quality
sudo iwconfig wlp1s0|grep -i quality
# Link Quality=52/70 Signal level=-58 dBm
The same information is available from /proc/net/wireless:
cat /proc/net/wireless
# Inter-| sta-| Quality | Discarded packets | Missed | WE
# face | tus | link level noise | nwid crypt frag retry misc | beacon | 22
# wlp1s0: 0000 52. -58. -256 0 0 0 0 58 0
nmcli
also returns signal information, but more human-friendly:
nmcli dev wifi
# IN-USE SSID MODE CHAN RATE SIGNAL BARS SECURITY
# testing Infra 13 270 Mbit/s 70 ▂▄▆_ WPA2
NetworkManager
Wifi is either controlled by NetworkManager or via the command line (nmcli
).
- Command file
- See file /etc/network/interfaces. See man page
man interfaces
- For WPA, see file /etc/wpa_supplicant/wpa_supplicant.conf.
Miscellaneous
|
|
- See Common Issues