How To: WiFi on your Raspberry PI

Screen Shot 2012-12-23 at 13.26.05The Raspberry Pi has many great features straight out of the box,  unfortunately WiFi is not one of them, in this guide I’ll show you how I WiFi equipped my Raspberry PI for only a fiver.

We will be assuming that you have a head less setup (without a monitor) so the guide should work for everyone, either via SSH (remote) or via a local terminal session if you do have a monitor.

Also its worth noting that some WiFi adapters will require a powered USB hub between the Raspberry PI and the USB module, the one used below doesn’t due to it’s power consumption assuming you don’t have anything else drawing large currents from the USB power.

1. What you will need…
  • Raspberry Pi, with Wheezy
  • Internet Connection (via the ethernet port to begin with)
  • WiFi network to test on
  • USB WiFi Dongle, either of the below work:
2. Update the OS

There are so many times you will run into a bug when installing something new and find out that it would have worked if your system was up to date, taking no risks here so get your system updated

sudo apt-get update
sudo apt-get upgrade

Due to the RAM/CPU power on the Pi’s, this might take a while, brew anyone?
;

3. Reboot

Power down the device, install your WiFi USB module and turn it back on.

4. Setup the interface configuration
sudo nano /etc/network/interfaces

Normally your base configuration will look something like this

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
iface default inet dhcp

Assuming you have a DHCP server on your LAN (normally your DSL/Cable router) use the following configuration, your SSID and password will be put in the wpa_supplicant.conf later on in this guide.

auto lo

iface lo inet loopback
iface eth0 inet dhcp

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

If you don’t have a DHCP server, or if you want to just statically assign the IP address you can use the following, however update the IP, Netmask and Gateway to match your network.

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
5. Setup the WPA configuration

Finally you will want to edit the WPA configuration as below, don’t forget to update it for your SSID and WPA password!

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
network={
ssid="SSID-GOES-HERE"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="WIFI-PASSWORD-GOES-HERE"
}
6. Final Reboot

Ok that should be it, do a final reboot remove the wired ethernet cable and your IP should automatically come onto the network as a normal WiFi device.


Problems?

First

This device should work out of the box, if for any reason it doesn’t you will want to do the following:

sudo wget http://dl.dropbox.com/u/80256631/install-rtl8188cus-latest.sh -O /boot/install-rtl8188cus-latest.sh
sudo /boot/install-rtl8188cus-latest.sh

Now go back to step 3 and try again.

Second

Run the below command, you should see your WiFi device there? If not there could be an issue with the hardware, try it in another PC…

lsusb

You should see a line that looks like this:

Bus 001 Device 005: ID 0bda:8189 Realtek Semiconductor Corp. RTL8187B Wireless 802.11g Network adapter.
Still got issues?

Leave a comment and i’ll get back to you 🙂

Technology enthusiastic with many ongoing online projects one of which is this personal blog PingBin. While also working full time within a data center designing and maintaining the network infrastructure.

96 comments On How To: WiFi on your Raspberry PI

  • As a backup I’ve also heard good things about the Edimax card. The driver is also included in the main raspbian image (it’s another Realtek).

    Installation instructions: http://www.savagehomeautomation.com/projects/raspberry-pi-installing-the-edimax-ew-7811un-usb-wifi-adapte.html

  • I have also recently purchased and successfully installed this mini WiFi adapter:

    – Airlink Fully compatible Wireless N 150 Ultra Mini-USB Adapter (AWLL5099)

    Same installation instructions, same Realtek chipset.

  • thx for sharing
    the configuration works on my router, however it doesnt work on public routers(have no WPA), any ideas?

    • Glad to hear that you got it working, try use the configuration below for an open WiFi network.

      auto wlan0
      iface wlan0 inet dhcp
      wireless-essid [Replace With Your SSID]
      wireless-mode [MODE] # This usually works as "managed"

      Let me know if that works

      • It doesnt works…
        I got Logs like:

        DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
        DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 13
        DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 14
        DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 21
        DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6

        No DHCPOFFERS received.

        However, if I tap commands as follow, the network works fine
        iwconfig wlan0 essid APNAME
        iwconfig wlan0 mode managed
        dhclient wlan0

        wired…

        • Probably best if you post a copy of your /etc/network/interfaces file on here.

          • my configuration:

            auto lo

            iface lo inet loopback
            iface eth0 inet static
            address X.X.X.X
            netmask X.X.X.X
            gateway X.X.X.X

            allow-hotplug wlan0
            auto wlan0
            iface wlan0 inet dhcp
            wireless-ssid APNAME
            wireless-mode managed

          • you typed ssid
            should be essid
            in your command line example you typed it right

  • I’ve tried doing this manually per instructions above and using the script on the dropbox link, but when I do sudo /etc/init.d/networking restart it indicates “cannot find the device wlan0″ bind socket to interface: no such interface. Failed to bring up wlan0”. Similarly, I don’t see wlan when I do ifconfig – a; I only see etho (ethernet) and lo (the system). I’d imagine I should be seeing wlan0…. Any pointers? Not sure why people suggest this Edimax small wireless adapter if it has so many issues….

    • First I would suggest testing the WiFi adaptor in something else, just to ensure that it is functional.

      If you run the below command and then plug in the dongle you should see about 10 lines of logs generated, confirming that the device has been installed and identified as a WiFi device.

      tail -f /var/log/messages

      Finally I would suggest removing any other USB devices, one of the most common problems is people drawing too much power from the USB ports, alternatively a USB powered hub would fix that.

  • I have spent days trying to get my EDIMAX WiFi adapter to work. If you can help it would be fantastic.

    I have relaoded the driver and the using iwlist scan gives:
    wlan0 Scan completed :
    Cell 01 – Address: 00:18:4D:01:E1:1C
    ESSID:”NETGEAR”
    Protocol:IEEE 802.11bg
    Mode:Master
    Frequency:2.462 GHz (Channel 11)
    Encryption key:on
    Bit Rates:54 Mb/s
    Extra:wpa_ie=dd160050f20101000050f20201000050f20201000050f202
    IE: WPA Version 1
    Group Cipher : TKIP
    Pairwise Ciphers (1) : TKIP
    Authentication Suites (1) : PSK
    Quality=96/100 Signal level=94/100

    which I think means that the thing is working and has been recognised
    Using lsusb I get:

    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
    Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
    Bus 001 Device 004: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]

    and finally iwconfig gives:
    wlan0 unassociated Nickname:””
    Mode:Managed Frequency=2.412 GHz Access Point: Not-Associated
    Sensitivity:0/0
    Retry:off RTS thr:off Fragment thr:off
    Power Management:off
    Link Quality:0 Signal level:0 Noise level:0
    Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
    Tx excessive retries:0 Invalid misc:0 Missed beacon:0

    eth0 no wireless extensions

    I have the interfaces file and the config file exactly as you suggest. here is a print out

    File: /etc/network/interfaces
    auto lo

    iface lo inet loopback
    iface eth0 inet static
    address 192.168.0.14
    netmask 255.255.255.0
    gateway 192.168.0.1

    allow-hotplug wlan0
    iface wlan0 inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
    iface default inet dhcp

    File: /etc/wpa_supplicant/wpa_supplicant.conf

    network={
    ssid=”NETGEAR”
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP TKIP
    group=CCMP TKIP
    psk=”Johnstone Network”
    }
    The result of doing ifup or reboot is

    sudo ifup wlan0
    wpa_supplicant: wpa-roam can only be used with the “manual” inet METHOD
    run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
    Internet Systems Consortium DHCP Client 4.2.2
    Copyright 2004-2011 Internet Systems Consortium.
    All rights reserved.
    For info, please visit https://www.isc.org/software/dhcp/

    Listening on LPF/wlan0/80:1f:02:85:0c:31
    Sending on LPF/wlan0/80:1f:02:85:0c:31
    Sending on Socket/fallback
    DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
    DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
    DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 13
    DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
    DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 13
    DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 15
    No DHCPOFFERS received.
    Unable to obtain a lease on first try. Exiting.
    Failed to bring up wlan0.
    pi@raspberrypi ~ $

    I have tried many other versions of these files with mostly the same results.

    I am out of ideas!
    Can you help

    Alan

  • This is a follow up to my last post which said I could not get my EDIMAX to work. It now is! but I had to use
    wicd to get it going
    See
    http://dembtech.blogspot.ie/2012/09/how-to-install-wifi-on-raspberry-pi.html#!/2012/09/how-to-install-wifi-on-raspberry-pi.html

    I also looked at the wpa-supplicant user interface on the GUI and it is not working which makes me suspect that wpa_suplicant is the problem. How do I replace or reinstall it?

    Alan

  • I am 14 and trying to learn about these as in a couple of days I will be getting one and I was wondering if I set up this raspberry pi as a wifi devise will it support my laptop and nexus 7 where ever I am?

  • I’ve been trying to to set up the wifi on my raspberry pi as according to your tutorial, but I haven’t been able to get anything working. I have followed your instructions, but when I get to step six, I the RPi can’t connect to the internet after I unplug the ethernet cable. Can you please help?
    Thanks!

    • Sure can you paste your configuration file here

      • It’s the exact same as yours, except with my own ssid and password

      • Here’s my config file, if you want it:

        network={
        ssid=”[My Network name here]”
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP TKIP
        group=CCMP TKIP
        psk=”[My password here]”
        }

        and yes, I have double and triple checked my SSID and password.

      • Also, here’s what the install script prints when I try to use it:

        An RTL8188CUS driver module is installed and loaded.

        You have 1 wifi adapter configured.
        wlan0 is configured and installed, but has no network connection.

        grep: /etc/udev/rules.d/70-persistent-net.rules: No such file or directory
        /boot/install-rtl8188cus-latest.sh: line 253: [: !=: unary operator expected
        The Pi has an internet connection.

        Any files needed for the installation/upgrade will be downloaded from the
        Internet unless they have already been copied to the SD card /boot directory.

        Unrecognised software version: Linux raspberrypi 3.2.27+ #250 PREEMPT Thu Oct 18 19:03:02 BST 2012 armv6l GNU/Linux

        Downloading the latest script.

        The script you’re using is the latest version.

        Aborting the rtl8188cus installation script.

        • Hello

          I have the same problem, have you could fix it?

          Or somebody knows how to fix it?

          I have tried in some many ways, but nothing results.

          help

        • Hello everyone

          I fix my problem about wifi conection. After one entery day en a cuople hours today I reinstall de raspbain, an then the adapter starts to working fine. Why?, I dont know, but now I have internet connection.

  • I have a problem with the wifi connection of my rpi. I am now doing this in my school, which provide us a free wifi. However, besides the ssid, I should also provide my own account and password to get connected. In this case, how can I set this via
    sudo nano /etc/network/interfaces?

    Thanks.

    • There are lots of different types of WiFi authentication, what kind of screen do you normally have to enter the username and password in? Is it a webpage, or a pop-up from your operating system?

  • Hi, i have function wifi adapter Edimax EW-7811Un. I can connect to my AP and to the internet in “system” (after “startx”). So i can connect my notebook with SSH to raspberry, but only via (over) AP.
    I am trying connect (SSH) notebook to raspberry directly, but it is unsuccessful. I create Ad-Hoc network on notebook (which has windows 7) and i write right SSID and PASS to “wpa_supplicant.conf” but i dont know how must be set this file and file “/etc/network/interfaces” .. I have no experience with Ad-Hoc network so i dont know how does it work (provides created Ad-Hoc network DHCP and many others)..
    John.

  • Hi. Thanks for this. I couldn’t get mine to work until I changed my WiFi Router so that the SSID was not hidden (an extra security measure). Is there something you can put in the wpa_supplicant.conf file to cope with hidden SSIDs?

    Incidentally, I’m using a COMFAST WiFi nano dongle (reports itself as a Realtek RTL8188CUS) from ebay for 3.87 UK pounds. http://www.ebay.co.uk/itm/WiFi-150Mbps-WIRELESS-802-11n-Mini-USB-2-0-Dongle-Adapter-WIN-7-VISTA-XP-LINUX-/261141365498?pt=UK_Computing_USB_Wi_Fi_Adapters_Dongles&hash=item3ccd3d02fa

    You can get them even cheaper if you can wait 4 weeks for delivery from China!

  • I just blogged about my adventures connecting my Raspberry Pi to Wifi. It took me several tries, but I got it eventually. I’m 11 years old, so if I can do it, your readers can too.

    http://raspberrypikid.wordpress.com

    Krystal @kid_pi

  • Hey I was wondering if you could help me, I have been searching and cant find a tutorial on how set this up for a non encrypted network. If you could give a solution or redirect me to a different page i would be very thankful.

    • nobody should help you with an unencrypted wlan. sorry.

    • It can be done, but if you LAN isn’t secured and you haven’t changed the default pi/raspberry login and password (I guarantee that you haven’t!) then any of your neighbors can login in and do just about anything to you beloved pi and anything attached to it. That’s why no-one wants to help – they’re not being obnoxious, they just don’t want to precipitate a disaster.
      They can also login to any other computers on your network that aren’t password protected, and no-one wants that!

  • Well, I tried the above coding to connect my Lib-Link wifi adapter from Adafruit and still nothing. In addition I’ve also tried using the Adafruit tutorial with the following results and information:

    I followed the Adafruit network setup but to no avail.
    I’ve reinstalled all raspian software.
    I’ve setup the network interface as shown on page 13 of the tutorial:

    auto lo

    iface lo inet loopback
    iface eth0 inet dhcp

    auto wlan0
    allow-hotplug wlan0
    iface wlan0 inet dhcp
    wpa-ssid ‘my ssid’
    wpa-psk ‘my password’

    I’m using a powered hub and the SSID is being broadcast from the router.

    I have used a wired connection successfully and a wifi connection on a similar adapter that fell apart after a couple of uses. The current adapter is the Lib-Link replacement sent by Adafruit.

    When I ran a ‘lsusb’ the device was there.
    When I run the wifi configuration from ‘startx’ wlan0 does not show up.

    The ‘ifconfig’ shows information for lo, eth0 and wlan0 but no ip address for wlan0.

    Any suggestions would be greatly appreciated.

  • Minor point but in step 4 above there is a sentence that doesn’t make complete sense: “Assuming you have a DHCP server on your LAN (normally your DSL/Cable router) use the following configuration, where is your WiFi name (case sensitive) and is your WPA-PSK password:” … looks like you somehow left out a sample name/pswd.

  • Is the part

    Assuming you have a DHCP server on your LAN (normally your DSL/Cable router) use the following configuration, where is your WiFi name (case sensitive) and is your WPA-PSK password:

    auto lo

    iface lo inet loopback
    iface eth0 inet dhcp

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

    not missing a bit-the SSID info??

    • Sorry the guide got updated but that bit was left out, I have update it now.

      If you read further down, the SSID goes in your wpa_supplicant.conf file.

    • I dropped this line:

      wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

      from the interfaces line and i got a DHCP address on my wireless.

  • AWESOOOOMMMMMMMEEEEEEEE!!! 😀

  • I just plugged my first raspberrypi in, and I am HIGHLY dissapointed.
    “sudo apt-get update”? That’s wishfull thinking. Any update or install I try, this little piece of junk freezes and I have to unplug to reboot. Compared to any desktop linux system is really a piece of junk.

  • Hi, this worked well for me using the Edimax branded adapter except that I had to modify the last few lines of /etc/network/interfaces to read:

    iface wlan0 inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
    iface default inet dhcp

    This was after I got the error:
    wpa_supplicant: wpa-roam can only be used with the “manual” inet METHOD

  • Thank you for the advice above.

    Could you point me in the right direction to download the driver for a different WiFi adapter, namely a Ralink Technology Corp – RT5370.

    Also I noticed, while the PI was “listening” for the WiFi, the IP shown was “255.255.255.255”. I thought this was supposed to be “255.255.255.0”. Do I need to change this and if so, how?

    I would be grateful for any help to get the PI on WiFi.

    Cheers,

    Dave Rose.

    • Hi the subnet address will be configured in your network interfaces file, which is located here;
      nano /etc/network/interfaces

      Yes you will need to change it for the networking to work correctly, 255.255.255.0 is used in most cases.

  • I could not get my Edimax wifi dongle to work with dhcp.
    Dhcp, btw, works ok on the wired interface, but I ran into the same symptom that Alan (above) experienced–No DHCPOFFERS received. (My wifi AP uses WPA-PSK encryption).

    I decided to go the path of using a static IP address and it worked.
    This requires matching entries in interfaces and wpa_supplicant.conf.

    My /etc/wpa_supplicant/wpa_supplicant.conf contains:

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1

    network={
    ssid=”MYSSID”
    proto=WPA
    key_mgmt=WPA-PSK
    pairwise=TKIP
    auth_alg=OPEN
    psk=”PASSWORD”
    id_str=”MYSSID_ID_STR”
    }

    My /etc/network/interfaces file contains:

    auto wlan0
    allow-hotplug wlan0
    iface wlan0 inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

    iface MYSSID_ID_STR inet static
    address XX.XX.XX.XX
    netmask XX.XX.XX.XX
    gateway XX.XX.XX.XX

    Note that the wpa_supplicant id_str is referenced in the iface stanza in the interface file.

  • Hi,

    i tried to set this up yesterday but with no luck, i have the Dynamode WL-700N-RXS and i have done all the steps listed. and the dongle shows up when i do lsusb. i am running it on the raspbmc build but since that is based off wheezy i didnt think there would be a problem?

    one thing i have noticed though is that my router is running AES not TKIP, i tried changing TKIP to AES in wpa_supplicant.conf but that didnt work either. (i cant change it on my router)

    any ideas?

    thanks in advance.

  • Hi Tom,

    I’ve followed your instructions but can’t get wifi working.

    ifconfig shows my device, but there’s no IP address assigned and no traffic. I set it up with a static address as you described.

    Any help would be appreciated!

  • Sorry. I have tried all of your codes above still can not get online with pi wifi (cable OK).

    1 line in your advice is too wide for the screen and has been cut off.

    I have an IP address and subnet mask, but do not know what you mean by gateway address.

    I am very new to the pi and any help you can give would be great.

    Thank you.

    • Gateway is just another name for the router basically, so just use your router’s local IP address as the gateway. It’s usually something like 192.168.0.1 or 192.168.1.1

  • Hi
    I have been trying to connect a Raspberry Pi running the Raspberian Wheezy wpa_gui to a jailbroke I-phone 3Gs hotspot with the MiWi app.
    The app does not have any problem connecting the I-phone to my Windows laptop or my Apple I-pad.
    I know this is an ad hoc connection.
    I am required and running wep 40 bit security by the phone.
    The wpa_gui see’s my I-phone in the scan. The flag is {WEP}{IBSS}
    I can never get a connection.
    Any help is appreciated

    David

  • i work with my pi wireless with eminent em4576 perfect but when i change my os card into xmbc i can forget wireless so i have to reconnect wired. some has an idea to get wireless on my xmbc?

    • My guess would be that XMBC doesn’t come with all of the WiFi drivers that the normal OS does, have you tried updating it via CLI?

  • Mine will not work, using an adaptor purchased from ModMyPi. It has no name, but uses an RTL8188 chip. I have done the updates you specify, but there is no network connection. LSUSB does detect the chip. I tried the update you suggested and it went wrong – I have copied the response from the install script.
    Any help/advice would be much appreciated.
    pi@raspberrypi ~ $ sudo /boot/install-rtl8188cus-latest.sh

    IMPORTANT UPDATE: The RTL8188CUS driver is now included in the latest updates
    for the RPi. The script has been updated to hopefully make the transition as easy as possible. To update to the new driver run the script and it will end by running rpi-update which should load the latest kernel version with the new driver included. The script will then reconfigure the image to use the new driver.

    This script will install the driver for Realtek RTL8188CUS based wifi adapters.

    To see a list of wifi adapters using this driver take a look at the document at http://dl.dropbox.com/u/80256631/install-rtl8188cus.txt

    1. It can install a new driver if you do not already have the rtl8188cus driver installed and have no other wifi adapter installed.
    2. It can install a wifi adapter using the rtl8188cus driver if you have a wifi adapter using a different driver already installed.
    3. If the driver is already installed it will update the driver and software, or allow you to add an different wifi adapter using the rtl8188cus driver so you can switch between them if you want to, e.g. unplug one and plug in another, or even connect two wifi adapters at the same time.
    4. It can repair a broken driver. e.g. if you have updated the software and the wifi has stopped working it will update the driver to a working version if one is available.

    The script will also give you the option to update the software and firmware to the latest versions using apt-get update, apt-get upgrade and rpi-update.

    Press any key to continue…

    An RTL8188CUS driver module is installed and loaded.

    You have 1 wifi adapter configured.
    wlan0 is configured and installed, but has no network connection.

    grep: /etc/udev/rules.d/70-persistent-net.rules: No such file or directory /boot/install-rtl8188cus-latest.sh: line 253: [: !=: unary operator expected The Pi has an internet connection.

    Any files needed for the installation/upgrade will be downloaded from the Internet unless they have already been copied to the SD card /boot directory.

    — What is this please?—
    Unrecognised software version: Linux raspberrypi 3.6.11+ #371 PREEMPT Thu Feb 7 16:31:35 GMT 2013 armv6l GNU/Linux

    Downloading the latest script.

    The script you’re using is the latest version.

    Aborting the rtl8188cus installation script.

    pi@raspberrypi ~ $ ^C
    pi@raspberrypi ~ $

  • Hi,
    I am able to connect to wifi network at work but unable to access the internet. From iphone wifi network settings there are DNS, search domains and HTTP proxy server. Do I have to and how to set this in RPi.

    Any help is much appreciated.
    Thank you

  • Hi Tom,

    With a fresh Raspbian install (2013-02-09-wheezy-raspbian) and a Netgear WNA1000M I went through the exact steps listed above, but it’s not working. wlan0 gets no IP address. When I tried the troubleshooting step of running the

    My wireless router is using WPA2 Personal security mode, would that change anything?

    My interfaces file looks just like yours recommended for DHCP:
    auto lo

    iface lo inet loopback
    iface eth0 inet dhcp

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

    And my wpa_supplicant file is:

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1

    network={
    ssid=””
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP TKIP
    group=CCMP TKIP
    psk=””

    I’m watching hours of my life slip away… a life line would be greatly appreciated!!

    Ken

  • Amazing info thankyou, works like a charm with the generic large wifi dongle I plugged into the usb hub I got for the raspberry pi. No more wires! 🙂

  • What about WPA2-PSK? Does that work just by adding “2” in that code? Haven’t tried yet but if someone knows if the WPA2 even works 😀 Thanks!

  • Hi,
    I hava a WiPi (realtek wifi stick RT5370) and can’t get DHCP address.
    I followed the article instructions and can’t get addresss….
    My wifi is in open mode (no WEP or WPA!) It connects to the Access point, but the ip addesss (in WPA_gui) is blank

    Can someone help me?

  • For those struggling with this setup and getting messages like:

    “wpa_supplicant: wpa-roam can only be used with the “manual” inet METHOD”

    at boot. As far as I understand it if you use wpa-roam you should configure your /etc/network/interfaces with MANUAL and not DHCP.

    I.e.

    /etc/network/interfaces:

    # more things here
    allow-hotplug wlan0
    auto wlan0
    iface wlan0 inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
    # more things here

    and /etc/wpa_supplicant/wpa_supplicant.conf:

    # more things here
    network={
    ssid=”YOURSSID”
    key_mgmt=WPA-PSK
    psk=”YOURPASS”
    }
    # more things here

  • The above description does not work for me as in the latest 2013-05-25-wheezy-raspbian.
    The issue is as earlier in the comments:
    “wpa_supplicant: wpa-roam can only be used with the “manual” inet METHOD”

    at boot. As far as I understand it if you use wpa-roam you should configure your /etc/network/interfaces with MANUAL and not DHCP.

    The way it works for me is with the following in /etc/network/interfaces

    auto lo
    iface lo inet loopback
    iface eth0 inet dhcp
    allow-hotplug wlan0
    iface wlan0 inet dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
    iface default inet dhcp

    This way at boot up it connects to the defined network(s) in /etc/wpa_supplicant/wpa_supplicant.conf AND get a ip address with DHCP

  • I may be missing something, but in step 2, to update and upgrade through apt-get, you MUST BE CONNECTED TO THE INTERNET! Therefore, aren’t all the rest of the steps to connect to the internet superfluous??!?

  • Hmm ……….. im struggeling with this wlan too!
    My network at home is running WEP and shared key, how do i setup this?
    wkr/Roger

    • I am also looking for proper configuration information for connecting to a network using WEP. I haven’t been able to find this anywhere.

  • Hi, I managed to get connected with the pi and the usb dongle doing what the post said, but it now it keeps telling this:

    ssh: connect to host 192.168.1.103 port 22: No route to host

    Any ideas? Thank you!

  • thanks a lot , helpfull for me of beginner.

  • Howdy;
    thanks for the straight forward look at how to get the WIFI going.
    I’m a real newbie to RPi… and was amazed that the wifi started
    right out of the box with no problem…however …….
    The IsP I have assigns the RPi with my pubic IP address
    and this of course offers up all sorts of problems
    Any idea why.. or what i could do to remedy…
    I’d like to web-cam and do SSH into the pi for settings…,
    Lots of head scratching.
    thanks

  • Thank you very much for this tutorial, i need it for using motion streaming.
    Maybe i also can help others, so here it is: using the tutorial settings for configuring /etc/network/interfaces and wpa_supplicant.conf i always got the error message:
    Listening on LPF/wlan0/7c:dd:90:0c:38:80
    Sending on LPF/wlan0/7c:dd:90:0c:38:80
    Sending on Socket/fallback
    DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
    DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
    DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
    DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 12
    DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 14
    DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9
    DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 11
    No DHCPOFFERS received.
    Unable to obtain a lease on first try. Exiting.
    Failed to bring up wlan0.

    I tried also to use only the interfaces without wpa_supplicant, the same result.In the end i enabled the x server and i used the wpa_gui after i saved back the inital conf files (/network/interfaces and wpa_supplicant).This time , it worked, this is how the supplicant conf files looks like now:

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1

    network={
    ssid=”xxx”
    psk=”xxx”
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP
    auth_alg=OPEN
    }

    The wi-fi is an wpa2 , aes encryption.The first 2 lines are used by wpa_gui.

  • I have 2 Rpi’s with Edimax (Realtek) USB wifi dongles: I’m trying to get the one that boots first to create an ad-hoc wifi network and the second one (and every one afterwards) to connect to that network. I’d like to extend the scheme to N RPi’s all talking together over this ad-hoc network.

    Any ideas on how to go about this?

  • If you have a static client use something similar to this:
    iface wlan0 inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

    iface default inet static
    address 192.168.100.211
    netmask 255.255.255.0
    gateway 192.168.100.1

    Greetings

  • I am having trouble getting my Wi-Fi dongle to work with my Raspberry Pi, it is a Netgear-N300 (WNA3100) but the commands don’t seem to work and when I use WiFi Config I get the error “Could not get status from wpa_supplicant”. I really want to finish a project that involves using a wireless network but this is stopping me, if you could help me please thanks!

  • Hey
    I have tried this and have been successful up until trying to save my first file again after editing. I have worked out how to save but each time I try my raspberry pi keeps telling me: permission denied. If anyone could work out why and how to fix it that would be great.
    Thank You
    Jo

    • Use “ls -lart” to check the file permissions that you edited.

      You can then use a combination of “chmod” and “chown” to change the file permissions or owners to what you think they should be.

      For example “chmod 777 test.script” would give all users full read/write/execute permissions to the test.script, even if they don’t own it.

      Obviously playing around with file permissions can cause issues with the OS if you do it wrong, or make your system more vulnerable to hackers etc, so be careful 🙂

  • Hi there, great tutorial but unfortunately it doesn’t work for me 🙁

    ‘An RTL8188CUS driver module is installed but is not loaded.

    You have 1 wifi adapter configured.
    wlan0 is configured but is not installed.

    The Pi has an internet connection.

    Any files needed for the installation/upgrade will be downloaded from the
    Internet unless they have already been copied to the SD card /boot directory.

    Unrecognised software version: Linux raspberrypi 3.10.24+ #614 PREEMPT Thu Dec 19 20:38:42 GMT 2013 armv6l GNU/Linux’

    I’m new to this stuff so don’t have a clue what to do!

    Thanks in advanced
    Hugh

  • Hi sir !
    I tried setup my wireless adapter TP-Link TL-WN727N
    but it don’t working !
    I read your post at
    http://pingbin.com/2012/12/setup-wifi-raspberry-pi/
    and this is my result of command ifconfig
    https://dl.dropboxusercontent.com/u/23155150/Pi.png

    lsusb :

    Bus 001 Device 007: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter

    Please help me !! Thans you so much !!!

  • Trying to set up RT3070 on pi changed the codes as instructed above but I can’t link to internet only by my cable is there anything else I can do

  • Going round in circles still unable to get my RALINK WIFI dongle to connect to my network box. I think I an just getting deeper into trouble. I am a novice at PI Wifi
    auto lo

    iface lo inet loopback
    iface eth0 inet dhcp

    allow-hotplug wlan0
    iface wlan0 inet manual
    address as on ifconfig
    netmask as on ifconfig
    gateway as on ifconfig
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

    Now it just says config 1 and won’t let me change it back again?
    Can anyone help

  • Having problems
    when try to put in psk and address etc it is now saying
    ctrl_interface=DIR=var/run/wpa_supplicant GROUP-netdev
    update_config=1

    I can’t seem to enter the psk or address in again after setting the gateway etc
    ifconfig says that Eth is connected now but not lo
    Can anyone help as I am a complete novice

  • Hi I’m trying to connect to a hidden wpa2 network that has been set up using an Apple AirPort Extreme, I have tried these steps and before-hand using the wpa_gui but that seemed to extend the password I entered

    After trying the steps illustrated, the GUI now says: ‘Could not get status from wpa_supplicant’

    How would I go about fixing this and how would I connect to the wpa2 hidden network?

    The wifi adapter I’m usin is a Realtech RTL8188CUS 802.11n WLAN adapter

    Please help

    Thanks

  • Brilliant first comment didn’t know how to update the Os, but after update the nano worked fine thanks

  • I have two raspberry pi and one with asus wifi and one with comfast dongle. Pi with asus is working. I am using same settings with com fast, but no it is not working. I ordered that com fast from ebay.

    sudo ifup wlan0
    wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
    run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
    Failed to connect to wpa_supplicant – wpa_ctrl_open: No such file or directory
    wpa_supplicant: /sbin/wpa_cli daemon failed to start
    run-parts: /etc/network/if-up.d/wpasupplicant exited with return code 1

    lsusb
    Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
    Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter

  • raspberry pi org has a slightly different method which might help some people, mines a realtek and this works,

    main difference is that psk is not your passwork but the psk key, run the below and use it, worked for me were the above didn’t.

    $ wpa_passphrase myssid password
    network={
    ssid=”myssid”
    #psk=”password”
    psk=2fe820b1e836cb734fb88172egfi01c5d40bb8449cc55c6e26ce300bbe8e04c7
    }

  • Finally got my RaspberryPi working on Wi-Fi. In case it helps, here are the details.

    Wi-Fi: Mapin N150 Nano Wi-Fi USB Dongle
    Router: Plusnet Technicolor Gateway TG582n

    —– /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
    iface default inet dhcp
    —– /etc/wpa_supplicant/wpa_supplicant.conf —–
    network={
    ssid=”PlusnetWireless9A9A99″
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP TKIP
    group=CCMP TKIP
    psk=”9A999999A9″
    }
    ———–
    One you have edited the files bring the wi-fi up with the command:
    sudo ifup wlan0

    Other commands I found useful (thanks to those above):
    sudo ifdown wlan0 – bring the wi-fi down.
    iwlist wlan0 scan – scan for w-fi access points and their details.
    lsusb – list usb devices (look for Wireless Adapter).

    The router UI doesn’t give away many clues about the encryption it uses. It actually seems to be WPA2-Personnal and AES. The SSID and PSK (or KEY) can be found on the bottom.

  • Hi
    I followed all the directions and my usb edimax wireless still won’t connect. It iseems to recognize that the network is there but it cannot obtain an IP address from the Verizon router. I assigned the raspi a static IP but the Verizon router only sees it as connected by Ethernet cable.

    So far it can only connect thru the Ethernet CAble. I set A static IP on both the Router and the raspi but still no luck. The router sees it as connected only thru the cable. Do I need two static IP’s, one for the Ethernet cable and one for the edimax?

    The Edimax works fine on my computer at work.

    I tried powering the router on and off also. Still no luck.

    Any ideas?
    Thanks -T. Cassidy

  • I had the same issues as the above. replaced my

    psk=XXXXXXX

    with the actual value given from http://jorisvr.nl/wpapsk.html

    It’s all up and running now.

    This is on a Pi B+ with Wi-Pi usb adapter.

  • when I run the sudo /boot/install-rtl8188cus-latest.sh script I get
    >An RTL8188CUS driver module is installed but is not loaded.
    >You have 1 wifi adapter configured.
    >wlan0 is configured but is not installed.
    >The Pi has an internet connection.
    >Any files needed for the installation/upgrade will be downloaded from the Internet unless they have already been copied to the SD card /boot directory.
    > Unrecognised software version: Linux raspberrypi 3.12.24+ #694 PREEMPT Tue Jul 15 17:34:35 BST 2014 armv6l GNU/Linux
    >Downloading the latest script.
    >The script you’re using is the latest version.
    >Aborting the rtl8188cus installation script.

    I have tried removing and reinstalling the firmware and rebooting the raspberry pi multiple times but nothing seems to change this. Do you have any suggestions as to how to get the driver module to load?

  • Hi,
    I have a raspeberry B+ with edimax USB wifi.

    I lost 1 hours to connect my pi B+ on :
    Wifi WEP > doesn’t work
    Wifi WPA2 > doesn’work (i try with passphrase http://jorisvr.nl/wpapsk.html) > Not OK

    Well, can’t connect my B+ …
    I try so many thing and he can’t connect lol…

    So sad 🙁

    Zzzzz….

  • Here`s a solution that work:

    $ sudo cat /etc/network/interfaces
    auto lo

    iface lo inet loopback
    iface eth0 inet dhcp

    auto wlan0
    allow-hotplug wlan0
    iface wlan0 inet static
    address 192.168.1.15
    netmask 255.255.255.0
    gateway 192.168..1
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

    $ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1

    network={
    ssid=”Your-ssid”
    psk=”thegreat-password”
    id_str=”home”
    }

    $ sudo cat /etc/resolv.conf
    domain youre.domain
    nameserver 8.8.8.8

  • Hello I’m using the latest version of armv71 with kernel build 4.1.7 of Raspbian Wheezy. The script pointed out by has not been extended to my version it seems . Please can you help me . I’m using Raspberry Pi B+ with a Netgear N150 USB wifi adapter.

Leave a reply:

Your email address will not be published.