Use the command line to set Raspberry Pi's Wi-Fi network
If you have not logged on to the Common graphic user interface, This method is suitable for setting Raspberry Pi's wifi. Especially when you do not have a screen or wired network, you only use the serial control line. In addition, this method does not require additional software, and everything is included in Raspberry Pi.
Getting wifi network details (get wifi network details)
You can useSudo iwlist wlan0 scanCommand. This command lists all available Wi-Fi networks and some useful information about the network. For example:
1,ESSID: "testing": This is the name of the Wi-Fi network.
2,IE: IEEE 802.11i/WPA2 Version1: This part indicates the network authentication method. Here it is WPA2, which is a safer wireless network standard to replace wpa1. This Guide applies to WEP, WPA, or WPA2, but may not to WPA2 Enterprise Edition.
You also need a wi-fi password. Most home routers (default passwords) are labeled on the labels on the back of the vro. In this example, the ESSID (ssid) of the searched Wi-Fi network is testing, and the password (psk) is testingPassword.
Adding the network details to the rassberry pi (add the network to Raspberry PI)
Open with nano EditorWpa-supplicanT configuration file:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Add the following content at the bottom of the file:
network={ ssid="The_ESSID_from_earlier" psk="Your_wifi_password"}
In this example, we should add:
network={ ssid="testing" psk="testingPassword"}
Now pressCtrl + xKey and then pressYKey, and then pressEnter key.
At this time,Wpa-supplicantIn a few seconds, you should notice that the settings have changed and will try to connect to the network. If not, useSudo ifdown wlan0
AndSudo ifup wlan0Command to manually restart the interface, or directly useSudo rebootCommand to restart Raspberry Pi.
You can useIfconfig wlan0Command to check whether the network is successfully connected. IfInet addrIt indicates that Raspberry Pi is successfully connected to the network. If not, check whether your password and ESSID are correct.
Address: http://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md