/****************************************
* Author : Samson
* Date : 01/06/2016
* Test platform:
* gcc 4.8.4
* GNU bash, 4.3.30
* Debian GNU/Linux 8.2
* **************************************/
大家都知道在Debian中可以通过ifconfig查看网络接口的状态,那么如何查看连接的无线热点的参数呢?
* Author : Samson
* Date : 01/06/2016
* Test platform:
* gcc 4.8.4
* GNU bash, 4.3.30
* Debian GNU/Linux 8.2
* **************************************/
大家都知道在Debian中可以通过ifconfig查看网络接口的状态,那么如何查看连接的无线热点的参数呢?
主要通过以下这些命令来查看和管理无线网络的接口:
iwconfig - configure a wireless network interface
iwlist - Get more detailed wireless information from a wireless interface
iwgetid - Report ESSID, NWID or AP/Cell Address of wireless network
iwpriv - configure optionals (private) parameters of a wireless network interface
iwspy - Get wireless statistics from specific nodes
具体如何使用请使用man命令进行查看;
以下就将常用的功能进行举例:
查看当前无线连接使用的信道:
~$ iwlist wlan0 channel
wlan0 13 channels in total; available frequencies :
Channel 01 : 2.412 GHz
Channel 02 : 2.417 GHz
Channel 03 : 2.422 GHz
Channel 04 : 2.427 GHz
Channel 05 : 2.432 GHz
Channel 06 : 2.437 GHz
Channel 07 : 2.442 GHz
Channel 08 : 2.447 GHz
Channel 09 : 2.452 GHz
Channel 10 : 2.457 GHz
Channel 11 : 2.462 GHz
Channel 12 : 2.467 GHz
Channel 13 : 2.472 GHz
Current Frequency:2.457 GHz (Channel 10)
wlan0 13 channels in total; available frequencies :
Channel 01 : 2.412 GHz
Channel 02 : 2.417 GHz
Channel 03 : 2.422 GHz
Channel 04 : 2.427 GHz
Channel 05 : 2.432 GHz
Channel 06 : 2.437 GHz
Channel 07 : 2.442 GHz
Channel 08 : 2.447 GHz
Channel 09 : 2.452 GHz
Channel 10 : 2.457 GHz
Channel 11 : 2.462 GHz
Channel 12 : 2.467 GHz
Channel 13 : 2.472 GHz
Current Frequency:2.457 GHz (Channel 10)
可以看出当前使用的信道是10;
查看无线连接的总体概况:
~ $ iwconfig
eth0 no wireless extensions.
lo no wireless extensions.
wlan0 IEEE 802.11bgn ESSID:"yygy1"
Mode:Managed Frequency:2.457 GHz Access Point: C9:86:57:77:B2:18
Bit Rate=135 Mb/s Tx-Power=16 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Power Management:off
Link Quality=70/70 Signal level=-37 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:7 Invalid misc:191 Missed beacon:0
eth0 no wireless extensions.
lo no wireless extensions.
wlan0 IEEE 802.11bgn ESSID:"yygy1"
Mode:Managed Frequency:2.457 GHz Access Point: C9:86:57:77:B2:18
Bit Rate=135 Mb/s Tx-Power=16 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Power Management:off
Link Quality=70/70 Signal level=-37 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:7 Invalid misc:191 Missed beacon:0
可以查看到当前的无线连接使用的协议为802.11bgn,无线热点的名称为:yygy1 模式为managed.
查看当前的无线设备及模式:
~ $ iw dev
phy#0
Interface wlan0
ifindex 3
type managed
phy#0
Interface wlan0
ifindex 3
type managed
扫描附近的热点及热点的基本信息:
~ $ iwlist wlan0 scanning
wlan0 Scan completed :
Cell 01 - Address: C0:66:77:77:22:18
Channel:10
Frequency:2.457 GHz (Channel 10)
Quality=70/70 Signal level=-37 dBm
Encryption key:on
ESSID:"yygy1"
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 18 Mb/s
Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
Mode:Master
Extra:tsf=0000000735a54b01
Extra: Last beacon: 2256ms ago
IE: Unknown: 00034C5331
IE: Unknown: 010882848B960C121824
IE: Unknown: 03010A
IE: Unknown: 2A0100
IE: Unknown: 32043048606C
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
IE: Unknown: 2D1A6F0017FFFFFF0001000000000000000000000000001FFF071800
IE: Unknown: 3D160A070400000000000000000000000000000000000000
IE: Unknown: 4A0E14000A00B400C800140005001900
IE: Unknown: 7F080100000000000000
IE: Unknown: BF0C30799B33EAFF0000EAFF0000
IE: Unknown: C005000000C0FF
IE: Unknown: DD1E00904C336E0017FFFFFF0001000000000000000000000000001FFF071800
IE: Unknown: DD1A00904C340A070000000000000000000000000000000000000000
IE: Unknown: DD06005043030000
IE: Unknown: DD180050F2020101800003A4000027A4000042435E0062322F00
Cell 02 - Address: BC:66:99:88:88:88
Channel:1
Frequency:2.412 GHz (Channel 1)
Quality=63/70 Signal level=-47 dBm
Encryption key:on
ESSID:"DDWifi"
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 18 Mb/s
Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
Mode:Master
Extra:tsf=0000015ee80f497a
Extra: Last beacon: 2256ms ago
IE: Unknown: 000944616F6C6957696669
IE: Unknown: 010882848B960C121824
IE: Unknown: 030101
IE: Unknown: 0706434E20010D20
IE: Unknown: 2A0100
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
IE: Unknown: 32043048606C
IE: Unknown: 2D1A6E101BFFFFFF0000000000000000008000000000000000000000
IE: Unknown: 331A6E101BFFFFFF0000000000000000008000000000000000000000
IE: Unknown: 3D1601050100000000000000000000000000000000000000
IE: Unknown: 341601050100000000000000000000000000000000000000
IE: WPA Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
IE: Unknown: DD180050F2020101050003A4000027A4000042435E0062322F00
IE: Unknown: DD0900037F01010000FF7F
wlan0 Scan completed :
Cell 01 - Address: C0:66:77:77:22:18
Channel:10
Frequency:2.457 GHz (Channel 10)
Quality=70/70 Signal level=-37 dBm
Encryption key:on
ESSID:"yygy1"
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 18 Mb/s
Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
Mode:Master
Extra:tsf=0000000735a54b01
Extra: Last beacon: 2256ms ago
IE: Unknown: 00034C5331
IE: Unknown: 010882848B960C121824
IE: Unknown: 03010A
IE: Unknown: 2A0100
IE: Unknown: 32043048606C
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
IE: Unknown: 2D1A6F0017FFFFFF0001000000000000000000000000001FFF071800
IE: Unknown: 3D160A070400000000000000000000000000000000000000
IE: Unknown: 4A0E14000A00B400C800140005001900
IE: Unknown: 7F080100000000000000
IE: Unknown: BF0C30799B33EAFF0000EAFF0000
IE: Unknown: C005000000C0FF
IE: Unknown: DD1E00904C336E0017FFFFFF0001000000000000000000000000001FFF071800
IE: Unknown: DD1A00904C340A070000000000000000000000000000000000000000
IE: Unknown: DD06005043030000
IE: Unknown: DD180050F2020101800003A4000027A4000042435E0062322F00
Cell 02 - Address: BC:66:99:88:88:88
Channel:1
Frequency:2.412 GHz (Channel 1)
Quality=63/70 Signal level=-47 dBm
Encryption key:on
ESSID:"DDWifi"
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 18 Mb/s
Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
Mode:Master
Extra:tsf=0000015ee80f497a
Extra: Last beacon: 2256ms ago
IE: Unknown: 000944616F6C6957696669
IE: Unknown: 010882848B960C121824
IE: Unknown: 030101
IE: Unknown: 0706434E20010D20
IE: Unknown: 2A0100
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
IE: Unknown: 32043048606C
IE: Unknown: 2D1A6E101BFFFFFF0000000000000000008000000000000000000000
IE: Unknown: 331A6E101BFFFFFF0000000000000000008000000000000000000000
IE: Unknown: 3D1601050100000000000000000000000000000000000000
IE: Unknown: 341601050100000000000000000000000000000000000000
IE: WPA Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
IE: Unknown: DD180050F2020101050003A4000027A4000042435E0062322F00
IE: Unknown: DD0900037F01010000FF7F
547