如何使用wpa_supplicant从命令行配置Linux无线
wpa_supplicant
is used to connect wireless networks. wpa_supplicant.conf
file is used to store related configuration file about the wireless network. Also wireless security policy is configured with this file.
wpa_supplicant
用于连接无线网络。 wpa_supplicant.conf
文件用于存储有关无线网络的相关配置文件。 此文件还配置了无线安全策略。
安装wpa_supplicant软件包 (Install wpa_supplicant Package)
In most of cases the wpa_supplicant
package is installed by default but we can use following commands in order to install this package.
在大多数情况下,默认情况下会安装wpa_supplicant
软件包,但我们可以使用以下命令来安装此软件包。
Fedora,RHEL,CentOS (Fedora, RHEL, CentOS)
$ sudo yum install wpa_supplicant
Ubuntu,Debian,Mint,Kali (Ubuntu, Debian, Mint, Kali)
$ sudo apt install wpa_supplicant
帮助wpa_supplicant (Help wpa_supplicant)
More detailed help information can be show with -h
option like below.
可以使用-h
选项显示更详细的帮助信息,如下所示。
$ wpa_supplicant -h
指定接口和配置文件 (Specify Interface and Configuration File)
The most basic and used way to run wpa_supplicant
is providing the interface name and the configuration file. We can use -i
to specify interface and -c
for configuration file like below.
运行wpa_supplicant
最基本,最常用的方法是提供接口名称和配置文件。 我们可以使用-i
来指定接口,使用-c
来配置文件,如下所示。
$ wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
在后台运行守护程序 (Run Daemon In Background)
The deafult behaivour of wpa_supplicant
is running on foregound which will take terminal busy. This will also create the stability problems where closing terminal will kill network connection too. We can use -B
option for background connection.
wpa_supplicant
的默认行为正在前途运行,这将使终端繁忙。 这还将产生稳定性问题,其中关闭的终端也将终止网络连接。 我们可以使用-B
选项进行后台连接。
$ wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
无线配置样本 (Sample Wireless Configuration)
Here is a sample configuration which has SSID name poftut
and key management is specified as WPA_PSK
.
这是一个具有SSID名称poftut
的示例配置,并且**管理指定为WPA_PSK
。
network={
ssid="poftut"
scan_ssid=1
key_mgmt=WPA-PSK
psk="very se+ret passphrase"
}
翻译自: https://www.poftut.com/how-to-configure-linux-wireless-from-command-line-with-wpa_supplicant/
上一篇: 对于考研的一点看法
下一篇: open flash chart