3

I'm having trouble connecting to wifi. I have a fresh install of Raspbian, all packages are up to date.

The wifi adapter (Belkin N300 Micro Wireless USB Adapter - model F7D2102) is being detected, so there's no issue there; here's the output of lsusb:

Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 hub
Bus 001 Device 008: ID 05ac:020b Apple, Inc. Pro Keyboard [Mitsumi, A1048/US layout]
BUS 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
BUS 001 Device 004: ID 050d:2103 Belkin Components F7D2102 802.11n N300 Micro Wireless Adapter v3000 [Realtek RTL8192CU]
BUS 001 Device 005: ID 050d:0304 Belkin Components FSU304 USB 2.0 - 4 Ports Hub
BUS 001 Device 006: ID 05ac:0302 Apple, Inc. Optical Mouse [Fujitsu]
BUS 001 Device 007: ID 05ac:1003 Apple, Inc. Hub in Pro Keyboard {Mitsumi, A1048]

And here's the output of iwconfig:

wlan0     IEEE 802.11bgn  ESSID:"MY-NETWORK-NAME"  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency:2.452 GHz  Access Point: <mac address>
          Bit Rate: 300 Mb/s   Sensitivity:0/0
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=98/100  Signal level=63/100  Noise level=0/100
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0  Missed beacon:0

lo        no wireless extensions

eth0      no wireless extensions

Here's the output of ipconfig:

eth0      Link encap:Ethernet  HWaddr:b8:27:eb:28:5c:6c
          UP BROADCAST MULTICAST MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr ec:1a:59:64:3a:36
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10 errors:0 dropped:26 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2586 (2.5KiB)  TX bytes: 288(288.0 B)

This is my /etc/network/interfaces:

auto lo

iface lo inet lookback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
address 192.168.2.34
netmask 255.255.255.0
gateway 192.168.2.1
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

And this is what I have in /etc/wpa_supplicant/wpa_supplicant.conf:

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

network={
ssid="<my-network-name>"
psk="<my-network-password>"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
auth_alg=OPEN
}

But no luck when I try to ping google.com:

pi@raspberrypi ~ $ ping google.com
ping: unknown host google.com

Any ideas? Let me know if I can include any additional information here.

2
  • 1
    Could you post /etc/resolv.conf ? (That's what gets used to work out what DNS server to query to turn DNS names into IP addresses to connect to)
    – Gagravarr
    Commented Aug 22, 2013 at 14:46
  • Actually, I just figured it out! I'll post the answer in a moment. Also, sorry I wasn't able to approve your edits - apparently I need 1k rep before I can do that :| Commented Aug 22, 2013 at 18:19

3 Answers 3

3

I figured it out! So it turns out that all I had to do was let DHCP automatically configure the interface. No idea why I was trying to configure it manually before.

I changed /etc/network/interfaces to:

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

All the other files were left as-is and I did a sudo reboot. Once it booted up again, this was what I had in my /etc/resolv.conf:

domain home
search home
nameserver 192.168.2.1

And now I have wifi!

pi@raspberrypi ~ $ ping google.com
PING google.com (184.150.183.168) 56(84) bytes of data.
64 bytes from 184.150.183.168: icmp_req=1 ttl=60 time=18.4 ms
64 bytes from 184.150.183.168: icmp_req=2 ttl=60 time=22.9 ms
64 bytes from 184.150.183.168: icmp_req=3 ttl=60 time=20.4 ms
^C64 bytes from 184.150.183.168: icmp_req=4 ttl=60 time=20.7 ms

--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 30096ms
rtt min/avg/max/mdev = 18.415/20.620/22.902/1.592 ms

I'm actually using the wifi now to type out this answer. It's a little slow, but at least it works now. Thanks @Gagravarr for the hint :)

0

I've now also figured out how to set up a static IP for the rpi.

This is how:

Leave /etc/wpa_supplicant/wpa_supplicant.conf as is, but change /etc/network/interfaces to:

auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet static
    address 192.168.0.3
    netmask 255.255.255.0
    gateway 192.168.0.1
    broadcast 192.168.0.255
    network 192.168.0.0
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Then restart the network interface:

$ sudo /etc/init.d/networking restart

It seems that changing wpa-roam to wpa-conf was the key (see Start wireless network automatically on boot-up - how to? and Wifi connection not working (using static IP)), but I don't know why; I'll post a question asking this shortly.

0

If i do this then it says wpa-roam can only be used with manual mode. even I have the same problem connecting it to my laptop wifi hotspot. it only works for (unshared internet) if i try to share the internet then it wont work, my raspberry pi wont het the IP address at all, but if i unshare my internet then it gets the IP... I dont know why, I was also testing my wifi hotpost with android it was perfect no issues besides its from Intel.

when the system boots it starts scanning for DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4 ... and this goes on for a while and then it prints no DHCPOFFERS received and then stops and continues normal boot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.