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

Source: Internet
Author: User

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)

To scan the Wi-Fi network, run the sudo iwlist wlan0 scan command. This command lists all available Wi-Fi networks and some useful information about the network. For example:

1. ESSID: "testing": 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 more secure wireless network standard used 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)

Use the nano editor to open the wpa-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"
}

Press ctrl + x, Press y, and then press Enter.


At this time, wpa-supplicant should notice that the settings have changed in a few seconds and will try to connect to the network. If not, use sudo ifdown wlan0

And the sudo ifup wlan0 command to manually restart the interface, or directly use the sudo reboot command to restart Raspberry Pi.


You can run the ifconfig wlan0 command to check whether the network is successfully connected. If an inet addr address already exists, it indicates that Raspberry Pi is successfully connected to the network. If not, check whether your password and ESSID are correct.

Install Weston on Raspberry Pi

Linux OS for Raspberry Pi is available

Raspberry Pi (Raspberry Pi) trial note

Introduction to Raspberry Pi (Raspberry Pi) installation, IP configuration, and software source

This article permanently updates the link address:

Related Article

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.