我原先发于 CSDN
检查是哪一个接口来支持无线连接的:
iwconfig
假定是wlan0,我的是wlp5s0
启动接口服务
sudo ip link set wlan0 up
扫描附近的无线网络了:
sudo iw dev wlan0 scan | less
连接
没有加密:
sudo iw dev wlan0 connect [网络 SSID]
也可以通过wpa_supplicant
连接,见‘WPA or WPA2’。
WEP 加密的:
sudo iw dev wlan0 connect [网络 SSID] key 0:[WEP 密钥]
WPA or WPA2
/etc/wpasupplicant/wpa_supplicant.conf
文件,增加如下行:
network={ ssid=“[网络 ssid]” psk=“[密码]” priority=1}
/etc/wpasupplicant/wpa_supplicant.conf
country=CN
update_config=1
network={
ssid="SSID"
psk="Passwd"
key_mgmt=WPA-PSK
priority=9
id_str="identify which wifi is"
}
network={
ssid="SSID"
psk="Passwd"
key_mgmt=WPA-PSK
priority=8
id_str="identify which wifi is"
}
# open wifi
network={
ssid="SSID"
key_mgmt=NONE
priority=1
id_str="identify which wifi is"
}
sudo wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
通过 DHCP 获取IP
sudo dhcpcd wlan0
推荐阅读: archlinux 开机自动连接wifi