4

Using: Model B Version 2

Dongle: TP-Link model TL-WN823N

os: raspbian

Tutorial: http://www.circuitbasics.com/raspberry-pi-wifi-installing-wifi-dongle/

Following the tutorial above i have altered the files:

/etc/network/interfaces

/etc/wpa_supplicant/wpa_supplicant.conf

Despite hours of my best(though limited in ability) efforts, i cannot get the pi connected to the internet through the wifi.

I assume that dongle works, and is compatible with my pi as i can use the command to return a list of wireless networks:

sudo iwlist wlan0 scan

the two files have been altered to show:

#/etc/network/interfaces    
auto lo

iface lo inet loopback
iface eth0 inet dhcp

auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

and

#/etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
update_config=1

network={
    ssid="YOUR WIFI NETWORK NAME"
    psk="YOUR WIFI PASSWORD"
}

i simplified the later after seeing it was possible on websites offering similar tutorials. When i type iwconfig i get:

wlan0 unassociated nickname:"WIFI@Realtec"

Any help with this situation would be appreciated.

In my rage i have also managed to hide the network icon on the GUI, bonus points for how to turn that back on...

EDIT: I've now come code which works, but i'm unsure of why the initial bit did not, will be happy to accept an answer which can tell me this. I've also added the code i'm now using below to help anyone like myself who could end up here from google.

TPreston
  • 43
  • 1
  • 1
  • 4
  • By using dhcp you have caused the software which runs the network icon to disable itself. What you have in your "answer" may have been OK in 2012, but Rasbpian has changed since. See How do I set up networking/WiFi/Static IP – Milliways Jul 23 '16 at 22:47
  • Thanks, i will update as per your answer on the other question. Regarding this though, in the link you use here: https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md

    it says "Go to the bottom of the file and add the following:" followed by ssid and psk. Are the first 3 lines of my wpa_supplicant adequate?

    – TPreston Jul 23 '16 at 23:07
  • The answer also says If you have changed /etc/network/interfaces PUT IT BACK. Using dhcp disables dhcpcd. – Milliways Jul 23 '16 at 23:34

2 Answers2

5

This is how I solved this problem. Took a while to figure out so hopefully this post helps somebody.

  1. Connect your Raspberry Pi 3+ to your Router with an Ethernet cable. Run sudo apt-get update and then sudo apt-get upgrade. This should just work out of the box.
  2. Run sudo iwlist wlan0 scanning | grep ESSID. If your WiFi name is there then move on to next step.
  3. Run wpa_passphrase "mywireless_ssid" "yourpassphrase" | sudo tee -a /etc/wpa_supplicant/wpa_supplicant.conf. This will add create something like this in your wpa_supplicant.conf file:

    network={
        ssid="SSID"
        #psk="PASSPHRASE"
        psk=38497220976092fc2707a838e4d4385019256149f99f935be22c90159d3b8373
    }
    
  4. Delete the #psk="PASSPHRASE" line and save the file.

  5. Then make sure your /etc/network/interfaces file looks like this:

    auto lo
    
    iface lo inet loopback
    iface eth0 inet dhcp
    
    allow-hotplug wlan0
    auto wlan0
    
    
    iface wlan0 inet dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
    
  6. Then reboot the pi sudo reboot

  7. Then hopefully you can run ifconfig and your wlan0 will have ip address.

A lot of this I got from this post.

ltrainpr
  • 166
  • 1
  • 5
  • Note that the whole purpose of wpa_passphrase is to avoid storing your WiFi password in cleartext, but supplying a password on the command line will store it in bash history file. – Dmitry Grigoryev Apr 10 '17 at 11:14
  • Just to be clear, that the wpa_supplicant tool stores the settings in wp_supplicant.conf not wpa_supplicant.conf. The latter stores different information – Barry Chapman Nov 07 '18 at 15:07
0

No sooner have i posted the question than i have found the answer.

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
wpa-ssid “ENTER YOUR ROUTER'S SSID HERE”
wpa-psk “ENTER YOUR ROUTER'S PASSWORD KEY HERE”

This can be found here: https://www.raspberrypi.org/forums/viewtopic.php?f=31&t=26558

TPreston
  • 43
  • 1
  • 1
  • 4