zur Startseite

Druckausgabe von https://privat.albicker.org
Iveco Daily 4x4, Hunde und multithematisches Blog

WLAN-Scanner für Linux

veröffentlicht am 23.09.2021 mit 2941 Worten - Lesezeit: 14 Minute(n) in * LINUX * REISEN *

Inhaltsverzeichnis

 

Der eine oder andere nutzt seinen Laptop - ich nutze meinen carPC, wenn ich auf Reisen bin. Internetverbindungen stelle ich über einen mobilen Hotspot her, der per WLAN mit dem Rechner vebunden ist.

mobiler WLAN-Hotspot

Und dann ist es ggf. interessant: Gibt es WLANs im Umkreis? Sind die ggf. nützlich? Oder störend? Dann wäre ein Kanalwechsel ggf. angezeigt, um Signalqualität und Übertragungsgeschwindigkeit der eigenen Verbindung zu optimieren …

Ausgangssituation und Randbedingungen

Im Jahr 2 des corona-bedingten Nicht-Reisens dient mir der carPC derzeit meist als Datenspiegel. So richtig gearbeitet habe ich damit schon eine Weile nicht mehr.
Daher starte ich meine Tests zu Hause mit einem USB-Netzwerkadapter:

Digitus WLAN-USB-Adapter
$ lsusb
Bus 002 Device 006: ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter

Netzwerkübersicht des Desktops

Die einfachste Übersicht, was sich da so im WLAN tut, erhält man aus der Anzeige der ‘Funknetzwerke’ in der Netzwerkanzeige des jeweiligen Desktops:

Anzeige des Network-Manager im Cinnamon-Desktop

Das ist schon ganz gut: Netzwerk-Name, Signalqualität, Verschlüsselung - für den Hausgebrauch reicht das normalerweise.

Analyse der Netzwerkumgebung

Anzeige der Netzwerkadapter

Will man genauer einsteigen, dann kann man sich als user erstmal die Netzwerkschnittstellen des Rechners ansehen:

$ ls -l /sys/class/net
insgesamt 0
lrwxrwxrwx 1 root root 0 Sep 23 08:04 enp3s0 -> ../../devices/pci0000:00/0000:00:1c.5/0000:03:00.0/net/enp3s0
lrwxrwxrwx 1 root root 0 Sep 23 08:04 lo -> ../../devices/virtual/net/lo
lrwxrwxrwx 1 root root 0 Sep 23 08:04 virbr0 -> ../../devices/virtual/net/virbr0
lrwxrwxrwx 1 root root 0 Sep 23 08:04 virbr0-nic -> ../../devices/virtual/net/virbr0-nic
lrwxrwxrwx 1 root root 0 Sep 23 08:04 virbr1 -> ../../devices/virtual/net/virbr1
lrwxrwxrwx 1 root root 0 Sep 23 08:04 virbr1-nic -> ../../devices/virtual/net/virbr1-nic
lrwxrwxrwx 1 root root 0 Sep 23 08:20 wlx00e04c0d8df5 -> ../../devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/net/wlx00e04c0d8df5

Der letzte Eintrag wlx00e04c0d8df5 stammt vom WLAN-Adapter.
Incl. z. B. der IP-Adressen bekommt man eine ausführlichere Anzeige als root:

~# ip -a address
(...)
8: wlx00e04c0d8df5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:e0:4c:0d:8d:f5 brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.31/24 brd 192.168.2.255 scope global dynamic noprefixroute wlx00e04c0d8df5
       valid_lft 1814390sec preferred_lft 1814390sec
    inet6 fe80::1245:4810:a674:5c09/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

(Hier habe ich mich auf die Ausgabe des WLAN-Adapters beschränkt, wäre sonst zu lang geworden)

Scan der WLAN-Bereiche

Um den gefundenen WLAN-Adapter zu überreden, die Bänder abzuscannen und das Ergebnis kundzutun, dafür gibt es in Linux (mindestens) zwei Möglichkeiten im Terminal (zur grafischen Lösung kommen wir später).

Das Paket ‘wireless-tools’

Hier gibt es zwei Werkzeuge, die als root aufgerufen werden:

Das Programm ‘iw’

Zunächst wollte ich mir das Gerät anzeigen lassen:

~# iw list 

zeigte aber keinerlei Ausgabe - einfach leer … 😟 - das selbe gilt auch für die Befehle iw dev und iw phy für die Ausgabe der verfügbaren Adapter.

Das kann jetzt gar nicht sein. Also hab ich doch meinen carPC aktiviert und dort das Ganze wiederholt. Und hier kamen folgende Ausgaben:

~# iw dev
phy#0
	Interface wlp2s0
		ifindex 3
		wdev 0x1
		addr 42:3d:2a:e3:ef:df
		type managed
		txpower 0.00 dBm

iw dev zeigt also zunächst die Bezeichnung des WLAN-Adapters mit ein paar grundlegenden Eigenschaften.

Warum das jetzt?
Nun, das neuere iw unterstützt nicht jede Hardware, sondern jene Gerätetreiber im Kernel, die mit dem nl80211-Subsystem arbeiten. Und mein Intel-Modul im carPC scheint so eine Hardware zu sein, der Realtek-USB-WLAN-Dongle nicht.

M.2 WLAN-Modul von Intel
~# lspci
02:00.0 Network controller: Intel Corporation Wireless 8260 (rev 3a)

Genauer wird der Adapter dann mittels iw phy beschrieben (Achtung: gaaanz lange Ausgabe)

~# iw phy
Wiphy phy0
	max # scan SSIDs: 20
	max scan IEs length: 422 bytes
	max # sched scan SSIDs: 20
	max # match sets: 11
	max # scan plans: 2
	max scan plan interval: 65535
	max scan plan iterations: 254
	Retry short limit: 7
	Retry long limit: 4
	Coverage class: 0 (up to 0m)
	Device supports RSN-IBSS.
	Device supports AP-side u-APSD.
	Device supports T-DLS.
	Supported Ciphers:
		* WEP40 (00-0f-ac:1)
		* WEP104 (00-0f-ac:5)
		* TKIP (00-0f-ac:2)
		* CCMP-128 (00-0f-ac:4)
		* CMAC (00-0f-ac:6)
	Available Antennas: TX 0 RX 0
	Supported interface modes:
		 * IBSS
		 * managed
		 * AP
		 * AP/VLAN
		 * monitor
		 * P2P-client
		 * P2P-GO
		 * P2P-device
	Band 1:
		Capabilities: 0x11ef
			RX LDPC
			HT20/HT40
			SM Power Save disabled
			RX HT20 SGI
			RX HT40 SGI
			TX STBC
			RX STBC 1-stream
			Max AMSDU length: 3839 bytes
			DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 4 usec (0x05)
		HT Max RX data rate: 300 Mbps
		HT TX/RX MCS rate indexes supported: 0-15
		Bitrates (non-HT):
			* 1.0 Mbps
			* 2.0 Mbps (short preamble supported)
			* 5.5 Mbps (short preamble supported)
			* 11.0 Mbps (short preamble supported)
			* 6.0 Mbps
			* 9.0 Mbps
			* 12.0 Mbps
			* 18.0 Mbps
			* 24.0 Mbps
			* 36.0 Mbps
			* 48.0 Mbps
			* 54.0 Mbps
		Frequencies:
			* 2412 MHz [1] (22.0 dBm)
			* 2417 MHz [2] (22.0 dBm)
			* 2422 MHz [3] (22.0 dBm)
			* 2427 MHz [4] (22.0 dBm)
			* 2432 MHz [5] (22.0 dBm)
			* 2437 MHz [6] (22.0 dBm)
			* 2442 MHz [7] (22.0 dBm)
			* 2447 MHz [8] (22.0 dBm)
			* 2452 MHz [9] (22.0 dBm)
			* 2457 MHz [10] (22.0 dBm)
			* 2462 MHz [11] (22.0 dBm)
			* 2467 MHz [12] (22.0 dBm)
			* 2472 MHz [13] (22.0 dBm)
			* 2484 MHz [14] (disabled)
	Band 2:
		Capabilities: 0x11ef
			RX LDPC
			HT20/HT40
			SM Power Save disabled
			RX HT20 SGI
			RX HT40 SGI
			TX STBC
			RX STBC 1-stream
			Max AMSDU length: 3839 bytes
			DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 4 usec (0x05)
		HT Max RX data rate: 300 Mbps
		HT TX/RX MCS rate indexes supported: 0-15
		VHT Capabilities (0x038071b0):
			Max MPDU length: 3895
			Supported Channel Width: neither 160 nor 80+80
			RX LDPC
			short GI (80 MHz)
			TX STBC
			SU Beamformee
		VHT RX MCS set:
			1 streams: MCS 0-9
			2 streams: MCS 0-9
			3 streams: not supported
			4 streams: not supported
			5 streams: not supported
			6 streams: not supported
			7 streams: not supported
			8 streams: not supported
		VHT RX highest supported: 0 Mbps
		VHT TX MCS set:
			1 streams: MCS 0-9
			2 streams: MCS 0-9
			3 streams: not supported
			4 streams: not supported
			5 streams: not supported
			6 streams: not supported
			7 streams: not supported
			8 streams: not supported
		VHT TX highest supported: 0 Mbps
		Bitrates (non-HT):
			* 6.0 Mbps
			* 9.0 Mbps
			* 12.0 Mbps
			* 18.0 Mbps
			* 24.0 Mbps
			* 36.0 Mbps
			* 48.0 Mbps
			* 54.0 Mbps
		Frequencies:
			* 5180 MHz [36] (22.0 dBm) (no IR)
			* 5200 MHz [40] (22.0 dBm) (no IR)
			* 5220 MHz [44] (22.0 dBm) (no IR)
			* 5240 MHz [48] (22.0 dBm) (no IR)
			* 5260 MHz [52] (22.0 dBm) (no IR, radar detection)
			* 5280 MHz [56] (22.0 dBm) (no IR, radar detection)
			* 5300 MHz [60] (22.0 dBm) (no IR, radar detection)
			* 5320 MHz [64] (22.0 dBm) (no IR, radar detection)
			* 5340 MHz [68] (disabled)
			* 5360 MHz [72] (disabled)
			* 5380 MHz [76] (disabled)
			* 5400 MHz [80] (disabled)
			* 5420 MHz [84] (disabled)
			* 5440 MHz [88] (disabled)
			* 5460 MHz [92] (disabled)
			* 5480 MHz [96] (disabled)
			* 5500 MHz [100] (22.0 dBm) (no IR, radar detection)
			* 5520 MHz [104] (22.0 dBm) (no IR, radar detection)
			* 5540 MHz [108] (22.0 dBm) (no IR, radar detection)
			* 5560 MHz [112] (22.0 dBm) (no IR, radar detection)
			* 5580 MHz [116] (22.0 dBm) (no IR, radar detection)
			* 5600 MHz [120] (22.0 dBm) (no IR, radar detection)
			* 5620 MHz [124] (22.0 dBm) (no IR, radar detection)
			* 5640 MHz [128] (22.0 dBm) (no IR, radar detection)
			* 5660 MHz [132] (22.0 dBm) (no IR, radar detection)
			* 5680 MHz [136] (22.0 dBm) (no IR, radar detection)
			* 5700 MHz [140] (22.0 dBm) (no IR, radar detection)
			* 5720 MHz [144] (22.0 dBm) (no IR, radar detection)
			* 5745 MHz [149] (22.0 dBm)
			* 5765 MHz [153] (22.0 dBm)
			* 5785 MHz [157] (22.0 dBm)
			* 5805 MHz [161] (22.0 dBm)
			* 5825 MHz [165] (22.0 dBm)
			* 5845 MHz [169] (disabled)
			* 5865 MHz [173] (disabled)
			* 5885 MHz [177] (disabled)
			* 5905 MHz [181] (disabled)
	Supported commands:
		 * new_interface
		 * set_interface
		 * new_key
		 * start_ap
		 * new_station
		 * new_mpath
		 * set_mesh_config
		 * set_bss
		 * authenticate
		 * associate
		 * deauthenticate
		 * disassociate
		 * join_ibss
		 * join_mesh
		 * remain_on_channel
		 * set_tx_bitrate_mask
		 * frame
		 * frame_wait_cancel
		 * set_wiphy_netns
		 * set_channel
		 * set_wds_peer
		 * tdls_mgmt
		 * tdls_oper
		 * start_sched_scan
		 * probe_client
		 * set_noack_map
		 * register_beacons
		 * start_p2p_device
		 * set_mcast_rate
		 * connect
		 * disconnect
		 * channel_switch
		 * set_qos_map
		 * add_tx_ts
		 * set_multicast_to_unicast
	Supported TX frame types:
		 * IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * mesh point: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * P2P-device: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
	Supported RX frame types:
		 * IBSS: 0x40 0xb0 0xc0 0xd0
		 * managed: 0x40 0xd0
		 * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
		 * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
		 * mesh point: 0xb0 0xc0 0xd0
		 * P2P-client: 0x40 0xd0
		 * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
		 * P2P-device: 0x40 0xd0
	WoWLAN support:
		 * wake up on disconnect
		 * wake up on magic packet
		 * wake up on pattern match, up to 20 patterns of 16-128 bytes,
		   maximum packet offset 0 bytes
		 * can do GTK rekeying
		 * wake up on GTK rekey failure
		 * wake up on EAP identity request
		 * wake up on 4-way handshake
		 * wake up on rfkill release
		 * wake up on network detection, up to 11 match sets
	software interface modes (can always be added):
		 * AP/VLAN
		 * monitor
	valid interface combinations:
		 * #{ managed } <= 1, #{ AP, P2P-client, P2P-GO } <= 1, #{ P2P-device } <= 1,
		   total <= 3, #channels <= 2
	HT Capability overrides:
		 * MCS: ff ff ff ff ff ff ff ff ff ff
		 * maximum A-MSDU length
		 * supported channel width
		 * short GI for 40 MHz
		 * max A-MPDU length exponent
		 * min MPDU start spacing
	Device supports TX status socket option.
	Device supports HT-IBSS.
	Device supports SAE with AUTHENTICATE command
	Device supports low priority scan.
	Device supports scan flush.
	Device supports per-vif TX power setting
	P2P GO supports CT window setting
	P2P GO supports opportunistic powersave setting
	Driver supports full state transitions for AP/GO clients
	Driver supports a userspace MPM
	Driver/device bandwidth changes during BSS lifetime (AP/GO mode)
	Device adds DS IE to probe requests
	Device can update TPC Report IE
	Device supports static SMPS
	Device supports dynamic SMPS
	Device supports WMM-AC admission (TSPECs)
	Device supports configuring vdev MAC-addr on create.
	Device supports TDLS channel switching
	Device supports randomizing MAC-addr in scans.
	Device supports randomizing MAC-addr in sched scans.
	Device supports randomizing MAC-addr in net-detect scans.
	Supported extended features:
		* [ RRM ]: RRM
		* [ SCAN_START_TIME ]: scan start timestamp
		* [ BSS_PARENT_TSF ]: BSS last beacon/probe TSF
		* [ SET_SCAN_DWELL ]: scan dwell setting
		* [ FILS_STA ]: STA FILS (Fast Initial Link Setup)
		* [ FILS_MAX_CHANNEL_TIME ]: FILS max channel attribute override with dwell time
		* [ ACCEPT_BCAST_PROBE_RESP ]: accepts broadcast probe response
		* [ OCE_PROBE_REQ_HIGH_TX_RATE ]: probe request TX at high rate (at least 5.5Mbps)
		* [ OCE_PROBE_REQ_DEFERRAL_SUPPRESSION ]: probe request tx deferral and suppression
		* [ CONTROL_PORT_OVER_NL80211 ]: control port over nl80211

Das ist interessant, hier werden alle verfügbaren Kanäle, die verfügbaren Bitraten für den Datendurchsatz und noch etliches mehr an Informationen ausgegeben.

Zu guter Letzt noch der Scan-Befehl … er gibt pro gefundenem WLAN-Hotspot die folgenden Informationen aus:

~# iw dev wlp2s0 scan
BSS 8c:a9:15:28:3a:0e(on wlp2s0)
	last seen: 5495.624s [boottime]
	TSF: 169529895661 usec (1d, 23:05:29)
	freq: 5260
	beacon interval: 100 TUs
	capability: ESS Privacy SpectrumMgmt RadioMeasure (0x1111)
	signal: -79.00 dBm
	last seen: 508 ms ago
	Information elements from Probe Response frame:
	SSID: TelekomRouter_TestNetz
	Supported rates: 6.0* 9.0 12.0 18.0 24.0* 36.0 48.0 54.0 
	Country: DE	Environment: bogus
		Channels [36 - 36] @ 23 dBm
		Channels [40 - 40] @ 23 dBm
		Channels [44 - 44] @ 23 dBm
		Channels [48 - 48] @ 23 dBm
		Channels [52 - 52] @ 23 dBm
		Channels [56 - 56] @ 23 dBm
		Channels [60 - 60] @ 23 dBm
		Channels [64 - 64] @ 23 dBm
		Channels [100 - 100] @ 30 dBm
		Channels [104 - 104] @ 30 dBm
		Channels [108 - 108] @ 30 dBm
		Channels [112 - 112] @ 30 dBm
		Channels [116 - 116] @ 30 dBm
		Channels [120 - 120] @ 30 dBm
		Channels [124 - 124] @ 30 dBm
		Channels [128 - 128] @ 30 dBm
		Channels [132 - 132] @ 30 dBm
		Channels [136 - 136] @ 30 dBm
		Channels [140 - 140] @ 30 dBm
	Power constraint: 0 dB
	TPC report: TX power: 23 dBm
	RSN:	 * Version: 1
		 * Group cipher: CCMP
		 * Pairwise ciphers: CCMP
		 * Authentication suites: PSK SAE
		 * Capabilities: 16-PTKSA-RC 1-GTKSA-RC MFP-capable (0x008c)
	BSS Load:
		 * station count: 0
		 * channel utilisation: 4/255
		 * available admission capacity: 0 [*32us]
	HT capabilities:
		Capabilities: 0x1ef
			RX LDPC
			HT20/HT40
			SM Power Save disabled
			RX HT20 SGI
			RX HT40 SGI
			TX STBC
			RX STBC 1-stream
			Max AMSDU length: 3839 bytes
			No DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 4 usec (0x05)
		HT RX MCS rate indexes supported: 0-31
		HT TX MCS rate indexes are undefined
	HT operation:
		 * primary channel: 52
		 * secondary channel offset: above
		 * STA channel width: any
		 * RIFS: 0
		 * HT protection: no
		 * non-GF present: 0
		 * OBSS non-GF present: 0
		 * dual beacon: 0
		 * dual CTS protection: 0
		 * STBC beacon: 0
		 * L-SIG TXOP Prot: 0
		 * PCO active: 0
		 * PCO phase: 0
	Extended capabilities:
		 * Extended Channel Switching
		 * BSS Transition
		 * Interworking
		 * QoS Map
		 * Operating Mode Notification
		 * Channel Schedule Management
		 * Channel Schedule Management
		 * 6
		 * Max Number Of MSDUs In A-MSDU is 
	VHT capabilities:
		VHT Capabilities (0x0f8b69b1):
			Max MPDU length: 7991
			Supported Channel Width: neither 160 nor 80+80
			RX LDPC
			short GI (80 MHz)
			TX STBC
			SU Beamformer
			MU Beamformer
		VHT RX MCS set:
			1 streams: MCS 0-9
			2 streams: MCS 0-9
			3 streams: MCS 0-9
			4 streams: MCS 0-9
			5 streams: not supported
			6 streams: not supported
			7 streams: not supported
			8 streams: not supported
		VHT RX highest supported: 0 Mbps
		VHT TX MCS set:
			1 streams: MCS 0-9
			2 streams: MCS 0-9
			3 streams: MCS 0-9
			4 streams: MCS 0-9
			5 streams: not supported
			6 streams: not supported
			7 streams: not supported
			8 streams: not supported
		VHT TX highest supported: 0 Mbps
	VHT operation:
		 * channel width: 1 (80 MHz)
		 * center freq segment 1: 58
		 * center freq segment 2: 0
		 * VHT basic MCS set: 0x0000
	WPS:	 * Version: 1.0
		 * Wi-Fi Protected Setup State: 2 (Configured)
		 * Response Type: 3 (AP)
		 * UUID: 9d369990-23fc-e22c-e9de-e501c2e074ac
		 * Manufacturer: Arcadyan
		 * Model: GRV9519ZAX44-A-ZZ
		 * Model Number: 0.01.01
		 * Serial Number: 267
		 * Primary Device Type: 6-0050f204-1
		 * Device name: ZZ
		 * Config methods:
		 * RF Bands: 0x3
		 * Unknown TLV (0x1049, 6 bytes): 00 37 2a 00 01 20
	WMM:	 * Parameter version 1
		 * u-APSD
		 * BE: CW 15-1023, AIFSN 3
		 * BK: CW 15-1023, AIFSN 7
		 * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
		 * VO: CW 3-7, AIFSN 2, TXOP 1504 usec
	802.11u Advertisement:
		Query Response Info: 0x7f
			Query Response Length Limit: 127
			ANQP

LinSSID - das Ganze mit grafischer Oberfläche

LinSSID ist ein grafisches Programm, das lokal empfangbare 802.11 Wireless Access Points und Ad-hoc-Netzwerke anzeigt. Das Programm ist direkt in den Debian Paketquellen enthalten

~# apt install linssid

und beruht auf der Ausgabe von iw, das in grafischer Form dann z. B. so dargestellt wird für die Kanalbelegung im 2,4GHz-Band:

Anzeige von LinSSID

Und das ist jetzt mal eine schnell verfügbare Informationsquelle, wenn’s unterwegs mit der WLAN-Verbindung nicht richtig klappen will.

Also: Wenn iw eine sinnvolle Ausgabe liefert, dann ist LinSSID das Mittel der Wahl zur Darstellung der WLAN-Belegung um den aktuellen Standort herum.

 


weitere Artikel