• Raspberry Pi Wireless Adaptor


    I am proud to be a former Archlinux user. And Am To Be. haha

    To set up your wireless drivers or modules, this page will be helpful. https://wiki.archlinux.org/index.php/Wireless_Setup

    usually

    pi@raspberrypi ~ $ dmesg | grep rtl8187
    [14856.735462] rtl8187: Customer ID is 0xFF
    [14856.738270] Registered led device: rtl8187-phy0::radio
    [14856.740980] Registered led device: rtl8187-phy0::tx
    [14856.745166] Registered led device: rtl8187-phy0::rx
    [14856.745940] rtl8187: wireless switch is on
    [14856.746130] usbcore: registered new interface driver rtl8187
    pi@raspberrypi ~ $ sudo ip link set dev wlan0 up

    To list all available wifi-networks just run

    # iw dev wlan0 scan 
    

    or

    # iwlist wlan0 scan 

    now i will list some easy procedures to make your wireless adaptor run with your raspberry pi.

    Of course you will need to get a good power adaptor which could host for your wireless adaptor and Raspberry Pi.

    You will need a good powered USB-HUB to be drawn enough current for those addons. I bought this one. (7 ports, 5V, upto 3.5A) Very neat for RPi.

    sudo lsusb 

    You will get

    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 001 Device 039: ID 0424:9512 Standard Microsystems Corp. 
    Bus 001 Device 040: ID 0424:ec00 Standard Microsystems Corp. 
    Bus 001 Device 048: ID 1a40:0201 Terminus Technology Inc. FE 2.1 7-port Hub
    Bus 001 Device 049: ID 0ac8:3343 Z-Star Microelectronics Corp. Sirius USB 2.0 Camera
    Bus 001 Device 050: ID 0bda:8187 Realtek Semiconductor Corp. RTL8187 Wireless Adapter

    the Realtek RTL8187 devices is the one I am using.

    if you could not find out your devices, you may need to install modules for your adaptor. ( I will talk about it later )

    then you need to know two things

    1.ESSID

    Here mine is "Hotspot"

    2.the password

    You know it.

    How to get ESSID and more information?

    Do this!

    sudo iwlist wlan0 scan | less

    Usually the wireless adaptor will be recognized to be networking device wlan0, or wlan1 if you have more than one wireless adaptor.

    For this instance , I get this output.

    wlan0     Scan completed :
              Cell 01 - Address: 38:83:45:FE:3B:98
                        Channel:1
                        Frequency:2.412 GHz (Channel 1)
                        Quality=46/70  Signal level=-64 dBm  
                        Encryption key:on
                        ESSID:"Hotspot"
                        Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                                  9 Mb/s; 12 Mb/s; 18 Mb/s
                        Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                        Mode:Master
                        Extra:tsf=000000050b603180
                        Extra: Last beacon: 340ms ago
                        IE: Unknown: 0007486F7473706F74
                        IE: Unknown: 010882848B960C121824
                        IE: Unknown: 030101
                        IE: Unknown: 0706555320010D14
                        IE: Unknown: 2A0100
                        IE: IEEE 802.11i/WPA2 Version 1
                            Group Cipher : CCMP
                            Pairwise Ciphers (1) : CCMP
                            Authentication Suites (1) : PSK
                        IE: Unknown: 32043048606C
                        IE: Unknown: 2D1A2C0003FF00000000000000000000000000000000000000000000
                        IE: Unknown: 331A2C0003FF00000000000000000000000000000000000000000000
                        IE: Unknown: 3D1601051300000000000000000000000000000000000000
                        IE: Unknown: 341601051300000000000000000000000000000000000000
                        IE: WPA Version 1
                            Group Cipher : CCMP
                            Pairwise Ciphers (1) : CCMP
                            Authentication Suites (1) : PSK
                        IE: Unknown: DD180050F2020101030003A4000027A4000042435E0062322F00
                        IE: Unknown: DD0900037F01010000FF7F
                        IE: Unknown: DD7A0050F204104A0001101044000102103B0001031047001000000000000010000000388345FE3B9810210004466173741023000646573135305210240003312E3010420003312E301054000800060050F204000110110018576972656C657373204E20526F7574657220465731353052100800020086103C000101

    You could search some key words here like using vi editorhere.

    Typing /  to search something.

    /ESSID

    will leads to where the key word "ESSID" locates.

     press q to quit.

    Any way you will need those things from it

    ESSID:"Hotspot"
    Group Cipher : CCMP
    Pairwise Ciphers (1) : CCMP
    Authentication Suites (1) : PSK
     

    then generate a configuration file for wpa_supplicant

    wpa_passphrase "Hotspot" 45678910 >> /home/pi/my_wifi.conf

    there will be a new file my_wifi.conf there. Or anywhere you want to have it

    note: the 45678910 is the password for this instance. we generate it to be the psk (password secret key)

    the my_wifi.conf looks like this:

    network={
            ssid="Hotspot"
            #psk="45678910"
            psk=ca5836ab2a5e24e67e3ec7d94429b77e251437177489e70c50892f8e996cccbc
    }

    now you should add it with the info you've got from 

    sudo iwlist wlan0 scan | less

     Make it be like this

    In this case , my wireless routor's SSID is "Hotspot"

    Protocol: RSN

    Pairwise Ciphers(暗号): CCMP

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    
    network={
            ssid="Hotspot"
            psk="45678910"
            proto=RSN
            key_mgmt=WPA-PSK
            pairwise=CCMP
            auth_alg=OPEN
    }

    Explanation:

    The important points to check:

    • ESSID: the "name" of the access point.
    • Quality: in general try something above 40/70.
    • Encryption key: if it is "on", check if you can see any line regarding
      • WEP, WPA, or RSN. Note that RSN and WPA2 are different names for the protocol.
      • Group cipher: value in TKIP, CCMP, both, others.
      • Pairwise ciphers: value in TKIP, CCMP, both, others. Not necessarily the same value than Group cipher.
      • Authentication Suites: value in PSK, 802.1x, others. For home router, you'll usually find PSK (i.e. passphrase). In universities, you are more likely to find 802.1x suite which requires login and password. Then you will need to know which key management is in use (e.g. EAP), and what encapsulation it uses (e.g. PEAP). Find more details at Wikipedia:List_of_authentication_protocols and the sub-articles.

    Network block options

    All of the security parameters need to be specified here. Note that if you are unsure about which value your access point requires, you can use several of them, wpa_supplicant will automatically use the one that works. For example, you can add

    proto=WEP WPA
    

    so that if your access point uses WEP or WPA, it will work in both case. But if it uses RSN (aka WPA2) it will not find it by itself, you have to append it to the other values.

    If the SSID is hidden, add the following option to the block:

    scan_ssid=1
    

    Change the /etc/network/interfaces

    auto lo
    
    iface lo inet loopback
    iface eth0 inet dhcp
    
    allow-hotplug wlan0
    iface wlan0 inet manual
    #wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
    wpa-roam /home/pi/my_wifi.conf iface default inet dhcp

    Usually you will need to add the 4 lines at the bottom.

    the

    #wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

    is by default. You could set yours. Sometimes we need to connect pi with different wireless routers.

    then

    Connection

    Now you can try connecting manually.

    First, bring the Wi-Fi interface up. For the purposes of this example, we will use the interface wlan0.

    # ip link set wlan0 up
    

    Typically, you will be able to use the Wireless EXTensions driver for wpa_supplicant; if you cannot, then you might need to check how to do it with your specific wireless device on the Internet.

    Issue the following as root:

    # wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant.conf 
    

    The previous syntax tells wpa_supplicant to use its default hardware configuration (WEXT - Linux Wireless EXTensions) and to associate with the SSID which is specified in /etc/wpa_supplicant.conf. Also, this association should be performed through the wlan0 wireless interface, and the process should move to the background, (-B). For verbose output, add -d or -dd (for debug) to dump more information to the console. You can find additional examples here.

    In the console output, there should be a line that reads 'Associated:' followed by a MAC address. All that is required now is an IP address.

    Note: If you don't want or need to touch /etc/wpa_supplicant.conf (e.g., when installing Arch), you can pipe wpa_passphrase to wpa_supplicant:
    wpa_passphrase essid pass | wpa_supplicant -B -i wlan0 -c /dev/stdin

    As root, issue:

    # dhcpcd wlan0
    
    Note: *Do not* request an IP address immediately! You must wait to ensure that you are properly associated with the access point. If you use a script, you can use sleep 10s to wait for 10 seconds.

    Verify the interface has received an IP address using the iproute package:

    # ip addr show wlan0
    
       wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
       link/ether 00:1C:BF:66:4E:E0 brd ff:ff:ff:ff:ff:ff
       inet 192.168.0.62/24 brd 192.168.0.255 scope global eth0
       inet6 fe80::224:2bff:fed3:759e/64 scope link 
          valid_lft forever preferred_lft forever
    
    

    If the output is close to the above, you are now connected.

  • 相关阅读:
    Regex Expression的资料和笔记整理
    27个提升效率的iOS开源库推荐
    IOS-Swift、Objective-C、C++混合编程
    《极客学院 --NSAttributedString 使用详解-4-UITextKit 简介》学习笔记(待处理)
    前端开发学习网站
    为Xcode添加和备份快捷代码
    Swift语言与Objective-C语言混合编程
    《慕客网:IOS动画案例之会跳动的登入界面(下)》学习笔记 -Sketch的使用
    《慕客网:IOS动画案例之会跳动的登入界面(上)》学习笔记 -Sketch的使用
    关于移动端架构的好的学习网站
  • 原文地址:https://www.cnblogs.com/spaceship9/p/3015432.html
Copyright © 2020-2023  润新知