homercole
Posts: 6
Joined: Sun Jul 20, 2014 2:16 pm

Configure wifi

Sun Jul 20, 2014 2:28 pm

Hi.
I'm a newbie in Raspberry, so I need your help. I have read many tutorial about wifi configuration, but all that stuff has confused me. So, I'd like to know only 2 things. 1, I want configure wifi. 2, I want connect automatically raspberry to my wifi connection. Maybe you have read this question many times, but my researches on google confused me.
Thanks

fruitoftheloom
Posts: 23337
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Configure wifi

Sun Jul 20, 2014 3:06 pm

If you are using Raspbian Wheezy

On the Desktop is the Wireless Icon, that is used to configure your WiFi, once configured it will be remembered

http://thepihut.com/pages/how-to-setup- ... i-raspbian

Obviously that is assuming that your Wiresless USB Adaptor has been correctly identified
Rather than negativity think outside the box !
RPi 4B 4GB (SSD Boot)..
Asus ChromeBox 3 Celeron is my other computer...

homercole
Posts: 6
Joined: Sun Jul 20, 2014 2:16 pm

Re: Configure wifi

Sun Jul 20, 2014 3:15 pm

Thanks for your answer, but I have discovered that my usb keyboard doesen't work, so I need to configure wifi from command line, but I don't know how to do.

User avatar
kusti8
Posts: 3439
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Re: Configure wifi

Sun Jul 20, 2014 4:23 pm

What type of encryption is your network (WEP, WPA/WPA2 PSK or Enterprise)? First, check that the following lines are in /etc/network/interfaces by doing:

Code: Select all

sudo nano /etc/network/interfaces
And then checking the following exists and add it if it does not:

Code: Select all

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
Then open /etc/wpa_supplicant/wpa_supplicant.conf and add the following lines:

Code: Select all

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

network={
ssid="YOURSSID"
psk="YOURPASSWORD"

# Protocol type can be: RSN (for WP2) and WPA (for WPA1)
proto=WPA

# Key management type can be: WPA-PSK or WPA-EAP (Pre-Shared or Enterprise)
key_mgmt=WPA-PSK

# Pairwise can be CCMP or TKIP (for WPA2 or WPA1)
pairwise=TKIP

#Authorization option should be OPEN for both WPA1/WPA2 (in less commonly used are SHARED and LEAP)
auth_alg=OPEN
}

Reboot your pi

Hope this helps!
There are 10 types of people: those who understand binary and those who don't.

MrEngman
Posts: 4032
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Configure wifi

Sun Jul 20, 2014 6:29 pm

homercole wrote:Hi.
I'm a newbie in Raspberry, so I need your help. I have read many tutorial about wifi configuration, but all that stuff has confused me. So, I'd like to know only 2 things. 1, I want configure wifi. 2, I want connect automatically raspberry to my wifi connection. Maybe you have read this question many times, but my researches on google confused me.
Thanks
Some information about your wifi adaptor and the operating system you are using would be useful. Makes life a little easier for people willing to help rather than just guessing what your problem may be.

Can you post the output of command uname -a, which shows some details about the OS, command lsusb which shows info about your USB devices, which should include your wifi adaptor provided it is connected to the Pi of course, and command cat /etc/network/interfaces which shows your basic wifi set up.


MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

homercole
Posts: 6
Joined: Sun Jul 20, 2014 2:16 pm

Re: Configure wifi

Sun Jul 20, 2014 7:39 pm

So, the output:

uname -a
Linux raspberrypi 3.12.22+ #691 PREEMPT Wed Jun 18 18:29:58 BST 2014 armv6l GNU/Linux


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.

cat /etc/network/interfaces
auto lo
iface lo inet loopback

#auto eth0
iface eth0 inet dhcp

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

kusti8 wrote:What type of encryption is your network (WEP, WPA/WPA2 PSK or Enterprise)?
WPA/WPA2 PSK.
I've tried your code, but it doesen't work

Thanks for your patience

drgeoff
Posts: 10765
Joined: Wed Jan 25, 2012 6:39 pm

Re: Configure wifi

Sun Jul 20, 2014 7:45 pm

lsusb says you have no Wi-Fi adaptor plugged in. :(

You said earlier that your USB keyboard is not working. How are you typing commands into the RPi?

asandford
Posts: 1998
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Configure wifi

Sun Jul 20, 2014 8:43 pm

As an alternative to using /etc/wpa_supplicant/wpa_supplicant.conf:

[once your wifi adapter is recognised]

Edit (as root) /etc/network/interfaces to resemble this:

Code: Select all

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid <YourWlanSSID> <--change to an appropriate value, no quotes required (might do if you use spaces)
wpa-psk <YourPassword> <--change to an appropriate value, no quotes required (might do if you use spaces)

#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
Then type (they might throw errors):

Code: Select all

ifdown wlan0
ifup wlan0
Then type:

Code: Select all

ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 80:1f:02:xx:xx:xx
          inet addr:192.168.0.121  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:783 errors:0 dropped:3 overruns:0 frame:0
          TX packets:355 errors:0 dropped:1 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:128097 (125.0 KiB)  TX bytes:52903 (51.6 KiB)


User avatar
kusti8
Posts: 3439
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Re: Configure wifi

Sun Jul 20, 2014 9:27 pm

Try using a powered hub if you are not already. That sometimes solves it.
There are 10 types of people: those who understand binary and those who don't.

fruitoftheloom
Posts: 23337
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Configure wifi

Sun Jul 20, 2014 9:40 pm

homercole wrote:Thanks for your answer, but I have discovered that my usb keyboard doesen't work, so I need to configure wifi from command line, but I don't know how to do.
If the USB Keyboard does not work are you actually accessing the Pi via SSH ?
Rather than negativity think outside the box !
RPi 4B 4GB (SSD Boot)..
Asus ChromeBox 3 Celeron is my other computer...

java
Posts: 226
Joined: Mon Jul 21, 2014 9:41 am

Re: Configure wifi

Mon Jul 21, 2014 3:13 pm

The output of "lsusb" posted, does not show any USB devices connected to your RPi. So either, there are no devices connected to your USB ports on your RPi, or, the device is defective and not functioning, or, the output is not from your RPi ... , that is how I see it ...

homercole
Posts: 6
Joined: Sun Jul 20, 2014 2:16 pm

Re: Configure wifi

Tue Jul 22, 2014 5:29 pm

I changed wifi adaptor and now raspberry recognize it.
asandford wrote:As an alternative to using /etc/wpa_supplicant/wpa_supplicant.conf:

[once your wifi adapter is recognised]

Edit (as root) /etc/network/interfaces to resemble this:

Code: Select all

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid <YourWlanSSID> <--change to an appropriate value, no quotes required (might do if you use spaces)
wpa-psk <YourPassword> <--change to an appropriate value, no quotes required (might do if you use spaces)

#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
Then type (they might throw errors):

Code: Select all

ifdown wlan0
ifup wlan0
Then type:

Code: Select all

ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 80:1f:02:xx:xx:xx
          inet addr:192.168.0.121  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:783 errors:0 dropped:3 overruns:0 frame:0
          TX packets:355 errors:0 dropped:1 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:128097 (125.0 KiB)  TX bytes:52903 (51.6 KiB)

I've tried your code but it doesen't work.
This is output of command that you suggested:

Code: Select all

pi@raspberrypi ~ $ sudo ifdown wlan0
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/1c:af:f7:11:86:ba
Sending on   LPF/wlan0/1c:af:f7:11:86:ba
Sending on   Socket/fallback
DHCPRELEASE on wlan0 to 192.168.1.254 port 67
pi@raspberrypi ~ $ sudo ifup wlan0
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/1c:af:f7:11:86:ba
Sending on   LPF/wlan0/1c:af:f7:11:86:ba
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 10
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 12
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 10
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
fruitoftheloom wrote:
homercole wrote:Thanks for your answer, but I have discovered that my usb keyboard doesen't work, so I need to configure wifi from command line, but I don't know how to do.
If the USB Keyboard does not work are you actually accessing the Pi via SSH ?
Yes

java
Posts: 226
Joined: Mon Jul 21, 2014 9:41 am

Re: Configure wifi

Tue Jul 22, 2014 6:32 pm

Hmmm .... , can you say if your keyboard and USB wi-fi dongle work/function when plugged into another computer?

That is the USB ports on your RPi might not be functioning, is your RPi a B+ version?

MrEngman
Posts: 4032
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Configure wifi

Tue Jul 22, 2014 6:37 pm

homercole wrote:I changed wifi adaptor and now raspberry recognize it.
.....
I've tried your code but it doesen't work.
This is output of command that you suggested:

Code: Select all

pi@raspberrypi ~ $ sudo ifdown wlan0
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/1c:af:f7:11:86:ba
Sending on   LPF/wlan0/1c:af:f7:11:86:ba
Sending on   Socket/fallback
DHCPRELEASE on wlan0 to 192.168.1.254 port 67
pi@raspberrypi ~ $ sudo ifup wlan0
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/1c:af:f7:11:86:ba
Sending on   LPF/wlan0/1c:af:f7:11:86:ba
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 10
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 12
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 10
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
fruitoftheloom wrote:
homercole wrote:Thanks for your answer, but I have discovered that my usb keyboard doesen't work, so I need to configure wifi from command line, but I don't know how to do.
If the USB Keyboard does not work are you actually accessing the Pi via SSH ?
Yes
Well, still no idea what wifi adaptor you were trying to connect, however, from the MAC address, 1c:af:f7:11:86:ba, in the output of sudo ifup wlan0 above it appears to be a D-Link device.

An alternative to sudo ifup wlan0 is to use sudo ifup --force wlan0. And even if your wifi is not connected you can often check if it works or not using the command sudo iwlist wlan0 scan. This will get your wifi to scan for networks it could connect to, quite useful. If it doesn't work this is could indicate that the config, /etc/network/interfaces or whatever, is not quite right, although it could also mean PSU problems or other issues



MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

homercole
Posts: 6
Joined: Sun Jul 20, 2014 2:16 pm

Re: Configure wifi

Tue Jul 22, 2014 6:44 pm

java wrote:Hmmm .... , can you say if your keyboard and USB wi-fi dongle work/function when plugged into another computer?

That is the USB ports on your RPi might not be functioning, is your RPi a B+ version?
No, my model is B.
I don't have a usb keyboard, but I've tried a wireless mouse and raspberry has recognized it. And I use the same wifi adaptor on my pc and it works fine.

homercole
Posts: 6
Joined: Sun Jul 20, 2014 2:16 pm

Re: Configure wifi

Wed Jul 23, 2014 7:58 pm

Now the adaptor works!!!!! I don't know why, but yesterday the adaptor didn't work, today works.
Thanks for your help and pacience ;) ;) ;)

java
Posts: 226
Joined: Mon Jul 21, 2014 9:41 am

Re: Configure wifi

Thu Jul 24, 2014 6:23 am

Glad you got sorted ... :D

Return to “Beginners”