如果遇到No wireless interfaces found,则编辑/etc/network/interfaces
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
#重启网络配置
$sudo /etc/init.d/networking restart
如果仍旧提示No wireless interfaces found,则执
$sudo dhcpcd
$sudo /etc/init.d/networking restart
或
$echo 'wifi_password' | sudo wpa_passphrase ssid&sudo dhcpcd wlan0
下面进入配置步骤:
1.sudo killall wpa_supplicant
2.sudo ip link set dev wlan0 up
3.sudo iwlist wlan0 scan
4.sudo vi /etc/wpa_supplicant/wpa_supplicant.conf
尾部添加
===============================================
network={
ssid="你的wifi名称"
psk="密码" #如果wifi没有密码,这一行替换为key_mgmt=NONE
}
===============================================
或者
sudo wpa_passphrase ssid
# reading passphrase from stdin
输入密码
然后会自动更新/etc/wpa_supplicant/wpa_supplicant.conf
5.刷新配置
sudo rm /var/run/wpa_supplicant/wlan0 -f
sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
或
sudo wpa_supplicant -B -c /etc/wpa_supplicant/wpa_supplicant.conf -i wlan0 -Dwext
(某些硬件上nl80211驱动不支持)
sudo wpa_cli -i wlan0 reconfigure
---------------------
无线射频被锁起来了,使用sudo rfkill list查看是否关闭射频
需要打开:sudo rfkill unblock all
启动wifi脚本:
#!/bin/bash
echo 'ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev' > /etc/wpa_supplicant/wpa_supplicant.conf
echo 'update_config=1' >> /etc/wpa_supplicant/wpa_supplicant.conf
echo 'country=CN' >> /etc/wpa_supplicant/wpa_supplicant.conf
echo 'wifi_password' | sudo wpa_passphrase 'wifi_ssid' >> /etc/wpa_supplicant/wpa_supplicant.conf
sudo pkill dhcpcd
sudo ip link set wlan0 up
sudo dhcpcd wlan0
停止wifi脚本:
#!/bin/bash
sudo ip link set wlan0 down