yum install -y iw #iw-4.3-2.el7.x86_64
#查看网卡
iw dev
phy#0
Unnamed/non-netdev interface
wdev 0x5
addr f8:34:41:xxx
type P2P-device
Interface wlp2s0
ifindex 3
wdev 0x1
addr f8:34:41:79:8xxx
type managed
channel 40 (5200 MHz), width: 80 MHz, center1: 5210 MHz
#启用网卡
ip link set wlp2s0 up
#查看网卡连接状态
iw wlp2s0 link #没有显示
##扫描可用的无线网络
iw wlp2s0 scan | grep SSID
SSID: 123
SSID: Tenda_0A6410
##连接无线
wpa_supplicant -B -i wlp2s0 -c <(wpa_passphrase "[SSID]" "[PIN]")
Successfully initialized wpa_supplicant
#SSID 替换为准备连接的Wifi名称,PIN 替换为无线密码,注意保留引号
##获取地址
dhclient wlp2s0
##
ip addr show wlp2s0
#############问题
pa_supplicant -B -i wlp4s0 -c <(wpa_passphrase '****' '****') : 会失败
Successfully initialized wpa_supplicant
Could not read interface p2p-dev-wlp4s0 flags: No such device
nl80211: Could not set interface 'p2p-dev-wlp4s0' UP
nl80211: deinit ifname=p2p-dev-wlp4s0 disabled_11b_rates=0
p2p-dev-wlp4s0: Failed to initialize driver interface
P2P: Failed to enable P2P Device interface
#处理
killall wpa_supplicant
####步骤
sudo killall wpa_supplicant
sudo wpa_supplicant -B -i wlp4s0 -c <(wpa_passphrase "[SSID]" "[PIN]")
sudo dhclient wlp4s0
ping www.baidu.com