In last lesson, we introduced how to remote console Pi with console cable. In this lesson, we’ll go on to learn how to config wifi via command when remote console Pi with console cable.
Raspberry Pi Zero/W (with GPIO header) or Pi2/Pi3 x1
WiFi receiver adapter x1(for Pi zero or Pi 2)
Console Cable x1
USB to Micro USB power cable x 1
5V/2A or 5V/2.5A USB power adapter x1 (optional)
Please review lesson 3 to login pi with Console Cable
To scan for WiFi networks, use the command:
sudo iwlist wlan0 scan
This will list all available WiFi networks, along with other useful information
At the prompt, enter the following command:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Add you ssid and password at the button of the file(as the following lines)
network={ ssid="yourNetwork" psk="yourPassword" }
保存,退出
sudo reboot
When the device finishes rebooting, it should automatically connect to the Wi-Fi node.
At the command prompt, enter the following command to check if the wifi is connected:
ifconfig wlan0
You can see that the Pi has connected with wifi and its IP address is (192.168.1.120)
DownLoad Url osoyoo.com