切换到根用户
$ su root
输入:
#iw dev
显示格式:
phy#0
Interface wlp2s0 //wlp2s0是无线网卡的名字
ifindex 3
wdev 0x1
addr a4:db:30:84:4b:1c
type managed
channel 11 (2462 MHz), width: 40 MHz, center1: 2452 MHz //广播信道,成功连接
启用无线网卡
# ip link set wlp2s0 up
查看无线网卡连接情况
$ iw wlp2s0 link
结果:(注意,我的无线网卡是wlp3s0)
Last login: Fri Mar 18 15:44:34 2016 from 192.168.0.66
[root@localhost ~]# iw wlp3s0 link
Connected to 80:89:17:90:d9:36 (on wlp3s0)
SSID: LX
freq: 2462
RX: 7281995 bytes (67484 packets)
TX: 98873 bytes (1429 packets)
signal: -31 dBm
tx bitrate: 150.0 MBit/s MCS 7 40MHz short GI
bss flags: short-preamble short-slot-time
dtim period: 1
beacon int: 100
查看所有可用的无线网络信号
iw wlp3s0 scan | grep SSID
wpa_supplicant -B -i wlp2s0 -c <(wpa_passphrase "liylr" "useradmin")
注意:其中liylr为要连接到的wifi信号,useradmin为无线网络的密码
dhclient控制网卡进行网络操作获取IP
# dhclient wlp3s0