0

Dec 2017 With a new RPi 3, Model B I installed the latest Raspbian Stretch. Built in wifi wlan0 does not connect. When running

sudo iwlist wlan0 scan

I see my router and others. Yet ip addr shows

 ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:df:2d:e1 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.16/24 brd 192.168.0.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 ::884:38ea:542:9997/64 scope global mngtmpaddr noprefixroute dynamic
       valid_lft 3599sec preferred_lft 3599sec
    inet6 fe80::5fcf:899a:bca5:5b8d/64 scope link
       valid_lft forever preferred_lft forever
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether b8:27:eb:8a:78:b4 brd ff:ff:ff:ff:ff:ff

My /etc/wpa_supplicant/wpa_supplicant.conf looks like this:

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

network={
        ssid="my-ssid"
        psk="my-password"
        key_mgmt=WPA-PSK}

(the closing curly brace is correct in the file)

my /var/log/syslog contains this snippet:

Dec 17 15:25:44 raspberrypi dhcpcd[360]: DUID 00:01:00:01:21:b0:d9:e1:b8:27:eb:8a:78:b4
Dec 17 15:25:44 raspberrypi dhcpcd[360]: wlan0: IAID eb:8a:78:b4
Dec 17 15:25:44 raspberrypi dhcpcd[360]: wlan0: adding address fe80::ea80:de60:3e85:442f
Dec 17 15:25:44 raspberrypi dhcpcd[360]: wlan0: carrier lost
Dec 17 15:25:44 raspberrypi dhcpcd[360]: wlan0: deleting address fe80::ea80:de60:3e85:442f

I found a thread somewhere that suggested adding a line to /etc/rc.local

rc.local:

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi


/sbin/iw dev wlan0 set power_save off

exit 0

ifconfig wlan0:

 wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether b8:27:eb:8a:78:b4  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Is there further configuration? Is my configuration correct? I've looked at the password and ssid twenty times, it's correct. Could the conflict be WPA vs WPA2 and my router? Is there a way to diagnose it?

Edit: I edited my wpa_supplicant.conf to connect to an old Netgear router and the wifi on wlan0 connected right away. So something with the router (Comcast) is not working correctly. Every other wifi device connects fine, laptops, cell phone wifi, iPad, smart TV. My router from the ISP has two Wifi networks. One has a long SSID XXXXXNNNNXXXNN and another XXXXXNNNNXXXNN-5G. I tried both in my wpa_supplicant.conf but the RPi only seems to see XXXXXNNNNXXXNN when scanning with iwlist. Here is some good info, namely you can't use the 5G network.

My router has two WPA choices: WPA/WPA2-PSK(TKIP/AES) and WPA2-PSK(AES)

I tried both and restarted the RPi network services. Still won't work. Also router was using CH 12, changed to CH 4.

Also used a USB wifi dongle with RTL8188CUS chipset. It connects to the Netgear router, not the Comcast router.

I'm going to have to piggyback the Netgear to my ISP router. It's a bandaid until I can figure it out. I would like to blame the router but everything else can connect to it except multiple RPis. So annoying.

JanuskaE
  • 131
  • 5
  • In your wpa-supplicant.conf, under network, do you have spaces or indents? I've found indents don't work. –  Dec 17 '17 at 16:21
  • Also, it looks like you're using a secure network. Inside of network={} (in wpa_supplicant.conf), underneath psk, add "key_mgmt=WPA-PSK". –  Dec 17 '17 at 16:25
  • By indents do you mean Tabs ? – JanuskaE Dec 17 '17 at 17:37
  • Yes, are you using them? –  Dec 17 '17 at 17:38
  • I think so. I'll get back to it later and edit/update. – JanuskaE Dec 17 '17 at 17:56
  • So I added to key_mgmt line to wpa_supplicant.conf file and used spaces instead of Tab/Indents. No change. – JanuskaE Dec 17 '17 at 19:45
  • What country are you in? You may want to update the country code - it may have an effect, depends on the wifi standards for your country. Also, does your wifi use wpa/wpa2 security? –  Dec 17 '17 at 19:47
  • Okay, I thought this didn't matter - but it turns out it does. The closing bracket for network ("}") needs to be on it's own line. –  Dec 17 '17 at 19:53
  • It is but the formatting of this editor shows it as such. Hence the comment "(the closing curly brace is correct in the file)" after the code for the conf file – JanuskaE Dec 17 '17 at 20:43

1 Answers1

0

Well it went to working but I'm not 100% sure what fixed it. Most likely the router settings. After last RPi reboot of many both the USB dongle and the built-in Wifi connected. Here is my wpa_supplicant.conf

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

network={
        ssid="my_ssid"
        psk="my_pw"
        key_mgmt=WPA-PSK
}

My router is set for WPA2-PSK

Here is my /etc/rc.local

_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi


/sbin/iw dev wlan0 set power_save off

exit 0

That is all

JanuskaE
  • 131
  • 5