Use the command line to set Raspberry Pi's Wi-Fi network

Source: Internet
Author: User

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


Use the command line to set Raspberry Pi's Wi-Fi network

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.