Raspberry Pi Raspberry Command line Configure a wireless network connection

Source: Internet
Author: User

Objective:

Raspberry Pi has a variety of networked ways, either via a wired network or via a wireless network. Through the wired network connection is relatively simple, in the DHCP-enabled router, directly plug in the network cable can be networked, this article introduces the way of the Raspberry Pi wireless networking. Without the network, if there is no screen and other peripherals, through the serial connection is a relatively simple and effective way.

Scan WiFi:

Use the following command to scan a nearby wireless network:

sudo iwlist wlan0 scan

The scan results are as follows:

wlan0 Scan Completed:cell on-Address:F0:B4: in: 1F: -: F1 ESSID:"00H Studio"protocol:ieee802. 11BGN mode:master Frequency:2.422GHz (Channel3) encryption Key:on Bit Rates: -MB/s Extra:rsn_ie=30140100000fac040100000fac040100000fac020000 ie:ieee802.11I/WPA2 Version1Group cipher:ccmp pairwise ciphers (1): CCMP Authentication Suites (1): PSK quality= -/ -Signal level= -/ -Cell Geneva-Address: .: About: 9C: ,: 3f:7c ESSID:"qlu-2.4g"protocol:ieee802. 11BGN mode:master Frequency:2.412GHz (Channel1) encryption Key:off Bit Rates:144MB/s Quality= -/ -Signal level= the/ -CellGeneva-Address:d6: -: 3f:0b:Bayi:D 1 ESSID:"7788"protocol:ieee802. 11BGN mode:master Frequency:2.422GHz (Channel3) encryption Key:on Bit Rates: theMB/s Extra:rsn_ie=30140100000fac040100000fac040100000fac020c00 ie:ieee802.11I/WPA2 Version1Group cipher:ccmp pairwise ciphers (1): CCMP Authentication Suites (1): PSK IE:Unknown:DD180050F204104A00011010440001021049000600372A000120 Qualit Y= -/ -Signal level= +/ -  

The "00H Studio" Here is the name of the wireless network. IEEE 802.11I/WPA2 Version 1 is encrypted in the same way. The type of encryption is of type WPA2.

Add a Wi-Fi network with a password

You can set up a wireless network to connect by configuring Wpa_supplicant.conf.

sudo vim/etc/wpa_supplicant/wpa_supplicant.conf

Add the code at the end of the file and replace the Ssid_name and password.

network={        SSID="Ssid_name"        key_mgmt=wpa-PSK        PSK="  password"}

Pass

ifconfig Wlan0

You can see if the IP address is assigned successfully

Wlan0 Link encap:ethernet HWaddr e8:4e: .: the: F8:f5 inet Addr:192.168.9.177Bcast:192.168.9.255Mask:255.255.255.0Inet6 addr:fdf5:a28:b70c:0:746: 52db:d822:14bd/ -Scope:global Inet6 addr:fdf5:a28:b70c::6c5/ -Scope:global Inet6 addr:fe80::ea4e:6ff:fe34:f8f5/ -scope:link inet6 addr:fdf5:a28:b70c:0: ea4e:6ff:fe34:f8f5/ -Scope:global up broadcast RUNNING multicast MTU: theMetric:1RX Packets:100930Errors0Dropped36149Overruns:0Frame0TX Packets:290150Errors0Dropped2Overruns:0Carrier0Collisions:0Txqueuelen: +RX Bytes:146598855(139.8MiB) TX Bytes:3218776758(2.9GiB)

Connect to Hidden Networks

If you are connecting to a hidden network, you need to add a connection to the configuration file scan_ssid . What you need to add is as follows:

network={    SSID="yourhiddenssid"    scan_ssid=1     PSK="your_wifi_password"}
Add multiple wireless network configurations
network={SSID="Schoolnetworkssid"PSK="Passwordschool"Id_str="School"}network={SSID="Homenetworkssid"PSK="Passwordhome"Id_str="Home"}

If you have a range of two networks, you can add a priority option to choose between them. The network that has the highest priority in the range will be the connected network.

network={SSID="Homeonessid"PSK="Passwordone" Priority=1Id_str="Homeone"}network={SSID="Hometwossid"PSK="Passwordtwo" Priority=2Id_str="Hometwo"}
Add a WiFi network without a password

Adding a WiFi network without a password requires attention to set KEY_MGMT to None

network={        SSID="ssid_name"        key_mgmt=none}
Settings for IP
Auto Wlan0iface wlan0 inet static    192.168. 0.1     255.255. 255.0 WPA-conf/etc/wpa_supplicant/wpa_supplicant.conf

Wrong debugging

If the connection is unsuccessful, there is a large likelihood that the configuration file is misconfigured.

sudo wpa_supplicant-c/etc/wpa_supplicant/wpa_supplicant.conf-I  wlan0

With a direct connection to the wpa_supplicant, if there is a problem with the configuration file, the error details of the configuration file are directly prompted.

If there is a result, there is no problem with the general configuration file

successfully initialized Wpa_supplicantnl80211:driver doesnot support authentication/Association or Connect commandswlan0:failed to initialize driver interface

Raspberry Pi Raspberry Command line Configure a wireless network connection

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.