找到裝置名稱
DEV=$(iw dev | awk '/Interface/ {print $2}')
啟動裝置
ifconfig ${DEV} up
設定要連線的AP名稱
iwconfig ${DEV} essid "Guest_5G"
or
iwconfig ${DEV} essid "Guest_5G" key "xxxxx"
取得IP
dhclient -v ${DEV}
ifconfig
iwconfig ${DEV}
測試連線
ping -c 5 google.com
iw dev ${DEV} link
如果有用WPA連線可參考
#apt-get install -y wpasupplicant
DEV=$(iw dev | awk '/Interface/ {print $2}')
ifconfig ${DEV} up
#iwconfig ${DEV} essid "xxxx"
WPA_CONFIG=/etc/wpa_supplicant/wpa_supplicant2.conf
rm -rf ${WPA_CONFIG}
echo "ctrl_interface=/run/wpa_supplicant" > ${WPA_CONFIG}
echo "update_config=1 " >> ${WPA_CONFIG}
echo "network={ " >> ${WPA_CONFIG}
echo " ssid=\"xxx\" " >> ${WPA_CONFIG}
echo " psk=\"12345678\" " >> ${WPA_CONFIG}
echo "} " >> ${WPA_CONFIG}
chmod 600 ${WPA_CONFIG}
wpa_supplicant -B -i ${DEV} -D nl80211 -c ${WPA_CONFIG}
dhclient -v ${DEV}
ifconfig
iwconfig ${DEV}
ping -c 5 google.com
如
留言列表