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.

Hardware Preparation

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)

Config WiFi

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/network/interface

In the nano text editor, you’ll see something like this:

  1. # interfaces(5) file used by ifup(8) and ifdown(8)
  2. # Please note that this file is written to be used with dhcpcd
  3. # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
  4. # Include files from /etc/network/interfaces.d:
  5. source-directory /etc/network/interfaces.d
  6. auto lo
  7. iface lo inet loopback
  8. iface eth0 inet manual
  9. allow-hotplug wlan0
  10. iface wlan0 inet manual
  11.     wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
  12. allow-hotplug wlan1
  13. iface wlan1 inet manual
  14.     wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

That’s the very basic configuration that governs your Pi’s Ethernet connect (indicated by the eth0 portion). We need to add on a very minor bit to enable the Wi-Fi dongle. Use the arrow keys to move down below the existing entry and add the following lines:

  1. auto lo
  2. iface lo inet loopback
  3. iface eth0 inet dhcp
  4. allow-hotplug wlan0
  5. auto wlan0
  6. iface wlan0 inet dhcp
  7.         wpa-ssid "wifi-ssid"
  8.         wpa-psk "wifi-password"

wifi-ssid:wifi’s name

wifi-password:wifi’s password

Once you’ve annotated the file, press CTRL+X to save the file and exit the nano editor. At the prompt again, enter the following command:

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 (

Leave a Reply

WordPress spam blocked by CleanTalk.
Bombax Theme designed by itx