Ubuntu命令行链接WIFI

查看是否已经正确安装无线网卡

ip a

.启动无线网卡, 如果网卡是wlan0

ip link set wlan0 up

.扫描可用的WiFi(没什么用处)

# 不加less可能会产生太多输出
iw dev wlan0 scan |less

# 或者
iwlist wlan0 scanning

.创建口令文件, 并连接

# 建立配置文件
wpa_passphrase ESSID PWD > connect.conf

# 使用配置文件连接
wpa_supplicant -B -i wlan0 -Dwext -c ./connect.conf

出现以下错误提示
Successfully initialized wpa_supplicant
nl80211: Could not configure driver mode
nl80211: deinit ifname=wlan1 disabled_11b_rates=0
wlan1: Failed to initialize driver interface

再来一遍 
sudo wpa_supplicant -B -i wlan0 -c connect.conf -Dwext

Successfully initialized wpa_supplicant
ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
不用管这些错误信息

# 设置为dhcp client, 获取IP
dhclient wlan0

# 查看连接结果 
ip a

发表评论