2

Problem: nothing passes through the wlan0 (wifi) connection:

  • from my PC, no VNC, no ssh working either (works on eth0)
  • I cannot ping the router from the RPI shell either
  • I cannot go to the internet
  • I have setup a static IP lease on the wlan0 & eth0 MAC address
  • I even tried setting my router to 2.4GHz only, it does not work

The default gateway points to the router ip:

pi@raspberrypi:~ $ cat /etc/resolv.conf
# Generated by resolvconf
domain sitecom.router
nameserver 192.168.1.1

route :

pi@raspberrypi:~ $ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    302    0        0 wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     302    0        0 wlan0

netstat :

pi@raspberrypi:~ $ netstat -r | grep default
default         192.168.1.1     0.0.0.0         UG        0 0          0 wlan0

pinging router :

pi@raspberrypi:~ $ ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
From 192.168.1.54 icmp_seq=1 Destination Host Unreachable
From 192.168.1.54 icmp_seq=2 Destination Host Unreachable
...

checked wlan0 :

pi@raspberrypi:~ $ iw dev wlan0 info
Interface wlan0
    ifindex 2
    wdev 0x1
    addr b8:27:eb:4a:33:33
    ssid MyRouterSSID
    type managed
    wiphy 0
    channel 13 (2472 MHz), width: 20 MHz, center1: 2472 MHz
    txpower 31.00 dBm

pi@raspberrypi:~ $ iw dev wlan0 link
Connected to 64:d1:a3:4a:5a:79 (on wlan0)
    SSID: MyRouterSSID
    freq: 2472
    RX: 14784 bytes (136 packets)
    TX: 77120 bytes (672 packets)
    signal: -29 dBm
    rx bitrate: 1.0 MBit/s
    tx bitrate: 5.5 MBit/s

    bss flags:  short-slot-time
    dtim period:    1
    beacon int: 100

checked wpa conf :

pi@raspberrypi:~ $ cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=BE

network={
    ssid="MyRouterSSID"
    psk="******************"
    key_mgmt=WPA-PSK
}

ifconfig:

pi@raspberrypi:~ $ ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 36448  bytes 125276811 (119.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 36448  bytes 125276811 (119.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.54  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::6b29:3275:cfb8:b8cc  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:4a:33:33  txqueuelen 1000  (Ethernet)
        RX packets 165  bytes 23589 (23.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 486  bytes 72311 (70.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

iw reg get,on rpi zero (and on rpi3 that does'nt have any issue):

global
country CN: DFS-FCC
    (2402 - 2482 @ 40), (N/A, 20), (N/A)
    (5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
    (5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW
    (5735 - 5835 @ 80), (N/A, 30), (N/A)
    (57240 - 59400 @ 2160), (N/A, 28), (N/A)
    (59400 - 63720 @ 2160), (N/A, 44), (N/A)
    (63720 - 65880 @ 2160), (N/A, 28), (N/A)

I am out of ideas, please help me, I really need my pi zero to be accessed headless

thanks in advance

[edit]

I use a Sitecom AC750 Router :

  • 2.4Ghz (B+G+N)
  • channel : auto

the main (only) RPI usb port is linked to a hub

I use an ethernet USB dongle and

so far I tried :

  • forcing the channel to 1
  • an additional USB WIFI dongle (ODROID)
  • removed the odroid dongle, removed the static ip on wlan0

still the same issue.

PER THE COMMUNITY'S FEEDBACK THE STATIC IP WAS CHANGED TO DHCP

enter image description here

ROUND 2 : AS PER COUMMUNITY RECOMMENDATIONS

  • I unplugged the eth dongle
  • I use a monitor on the HDMI output
  • I checked dmesg, /var/log/messages, and /var/log/syslog. this is what happen when running sudo ip link set wlan0 down/up

(I dont see any relevant info, I'll now create a new sd card)

enter image description here

ROUND 3 :

  • I did a full format of my 16gb sandisk with https://www.sdcard.org/downloads/formatter/
  • I burned the image 2019-09-26-raspbian-buster.img with https://www.balena.io/etcher/ (I usually use Win32DiskImager-odroid-v1.3, that supposably double checks each writing cycle, never had any problem with it)
  • did not do any update/upgrade, just first boot setup, checked the ip, usual 192.168.1.51
  • tried to ping the router and...it does not work...

my setup can't be more simple than this

enter image description here

I'd be tempted to think I killed the wifi ship soldering the header, but I get an IP,

  • just installed a terminal on my android phone, I can ping the router....

(next step : I am getting a wizard and maybe an exorcist too...)

ROUND 4 : I received the new PI

I just found out that putting down the wlan0 interface, iw reg get shows

country BE: DFS-ETSI

then, once I bring back up the interface, iw reg get shows

country CN: DFS-FCC

I found this but it does not say how to solve it

github.com/raspberrypi/firmware/issues/630 

apparently the router sends the wrong country code, so why is this working with all my other devices ...smartphone, RPI3, RPI4....

phil
  • 121
  • 1
  • 5
  • Please identify the MAC address of your wireless adapter. I added the statement "PER THE COMMUNITY'S FEEDBACK THE STATIC IP WAS CHANGED TO DHCP" above the screenshot. Only you can ensure that it is position correctly. Test results above the statement would be STATIC IP related and test results below the statement would be DHCP related. Now that you are using DHCP: when testing the wireless, be sure that the ethernet is disconnected when DHCP assigns IP address (boot time). Best to reboot with ethernet disconnected, then test wireless. – gatorback Feb 15 '20 at 15:25
  • Have you tried connecting the Pi to a TV to setup and test the wifi from the Raspbian GUI? This is an easy fast & fast test: especially coming from a fresh Raspbian flash of the SD card. https://www.raspberrypi.org/documentation/configuration/wireless/desktop.md – gatorback Feb 15 '20 at 15:30
  • I did put down the wlan0 and brought it back up, I tried rebooting too, dhcp works fine, still cannot pigng the router, I never encountered such a case – phil Feb 15 '20 at 15:57
  • I either use an ethernet dongle to debug it or I plug it to a pc hdmi screen – phil Feb 15 '20 at 15:57
  • I strongly, strongly suggest removing the ethernet dongle, reboot and test \ debug from a Raspbian console (connect HDMI and USB keyboard). I have edited my Answer this morning and would be interested in the test results. My hunch is that your hardware is good and that the problem lies on the SD card – gatorback Feb 15 '20 at 16:01

5 Answers5

2

There is a high correlation between Questions which state "I have setup a static IP lease" and XXX doesn't work.

You have listed lots of files, but not provided any information which would enable anyone to answer.

What did YOU do? - in particular HOW did you set "a static IP lease".

I recommend you remove the attempt to set "static IP addresses" and let your router do its job.

If you REALLY insist on static IP addresses (which are totally unnecessary except in a few circumstances) do it properly.
See How to set up Static IP Address

Or to setup networking properly How to set up networking/WiFi

Milliways
  • 59,890
  • 31
  • 101
  • 209
1

I recommend trying to verify hardware is working: DHCP requires communication between the wifi adapter and the router, otherwise it can not be assigned an IP address. If you can confirm the wifi's MAC address was received by the router, then the wifi's transmit side is working.

If you had a second Zero-W with functional wifi, you could transfer the SD card and expect it to work in the system under evaluation.

My experience tells me that you would be better off to:

  1. Disconnect the ethernet dongle from the Zero-W
  2. Flash a different Raspbian version to a new/different SD card and install SD-Card
  3. Connect the Zero-W to a keyboard and monitor THEN
  4. Configure wifi from the Raspbian GUI per instructions:
  5. Identify & Test DHCP issued address
    • ping gateway from rPi
    • nslookup yahoo.com's IP address and ping that number from rPi
    • ping rPi's IP address from another LAN connected PC
  6. Post the current (Ampere) rating of your 5V power source and compare it to the requirement

There are all kinds of ways to misconfigure a wifi connection, which is why I recommended starting 'fresh': your observations are very unusual: a DHCP LAN address is assigned to the wifi adapter, however, communication between wifi and another point fails. DNS failures can be ruled out by using IP addresses and not FQDNs.

gatorback
  • 637
  • 1
  • 6
  • 20
  • it's a fresh install and brand new card..bakc in the day , people recomended using an ethernet dongle...I see now the wifi issues are still not fixed on RPI zero...that thing newer worked over wifi – phil Feb 14 '20 at 15:31
  • and I did a dist upgrade – phil Feb 14 '20 at 15:32
  • Did you try configure wifi via raspi-config? https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md My device is rPi-ZW with built-in wifi. I suggest that you update your original post with a separate & full list of hardware. Have you had success setting up a LAN connection with this device in the past? – gatorback Feb 14 '20 at 16:33
  • it's just a simple router, all my other devices work on wifi without issue – phil Feb 14 '20 at 23:10
  • I'll remove all static lease and give it a try, but I did that a year ago, and it never worked..I am already considering buying a new RPI zero,the one I got just never been able to connect through wlan0 since day one – phil Feb 14 '20 at 23:11
  • If buying a new device, consider the rPi Zero-W with built-in wireless and BT. – gatorback Feb 14 '20 at 23:55
  • LAN works, other RPI's work lan and wlan, the only issue is with that one, I use a Sitecom router, that's it – phil Feb 15 '20 at 08:07
  • it's an RPI zero W – phil Feb 15 '20 at 08:08
  • That's great because you could purchase a new Zero-W and transfer the SD card: if it works then you know your original Zero-W is borked-up (faulty). If it does not work, then there is good chance that the problem is somewhere on the SD card. – gatorback Feb 15 '20 at 14:54
  • man I wish it was that simple, let's hope :-) – phil Feb 15 '20 at 15:54
  • Based on my experience, I expect (80% chance) that the problem is on the SD card and that the hardware is fine. This would be good because if it is a hardware problem, then that can not be fixed. I have made significant changes to my answer this morning and believe it is your best shot at determining if your wireless adapter is good / bad. – gatorback Feb 15 '20 at 15:59
  • I updated the question, next step is to burn a new sd card and start over – phil Feb 17 '20 at 17:06
  • I have updated my posting in response to round 3. – gatorback Feb 18 '20 at 15:57
1

With iw dev wlan0 info you show that you are using:

channel 13 (2472 MHz), width: 20 MHz, center1: 2472 MHz

I remember that I had problems some times ago with connections using channels above 11. Since then I only use channels up to 11. I'm unsure if it also an issue for you because you have a link shown with iw dev wlan0 link but maybe there is a problem with key negotiation or with the regulatory domain set with country=BE in /etc/wpa_supplicant/wpa_supplicant.conf. You can get info about the latter withiw reg get.

Anyway, it's worth a try just to use a channel up to 11. The channel to use is configured on the hotspot/access point.

Ingo
  • 42,107
  • 20
  • 85
  • 197
  • how do you change the channel ? – phil Feb 14 '20 at 15:32
  • note that I only have that issue with the pi zero...my other raspbery pi 3 & 4 work seamlessly on eth0 and wlan0 – phil Feb 14 '20 at 15:40
  • @phil The channel to use is configured on the hotspot/access point. – Ingo Feb 14 '20 at 16:08
  • I tried channel one, same issue, I tried an odroid wifi dongle (that I know to be working) and still the same problem, so I suspect something wrong with the software (RPI or router), I'll try my old odroid board, but I am pretty sure it worked back in the day – phil Feb 15 '20 at 08:17
  • I added teh output of iw reg get – phil Feb 15 '20 at 12:04
1

At least your PI was able to get an IP address (192.168.1.51 as per your screenshot). So the radio link is working although it may not be perfect. Looks more like a routing issue than a hardware issue. If you type ifconfig you should see the same address now or you still have an issue. What is your /etc/network/interfaces file like ?

One thing: your output of iw reg get says China, but your location is Belgium so I would do this: iw reg set BE. Also, I am wondering if you restarted both PI and router after making all those changes. Sometimes that's all it takes. There might be a bad route or stale IP address cached on either end.

I am also wondering if your router has some debugging tools (I had a quick look at the manual but didn't see anything). If you can, try to ping the PI from the router to check if the ping at least works in that direction, and verify that the PI is reachable.

Last but not least, check your logs on the PI ie dmesg, /var/log/messages and /var/log/syslog.

Kate
  • 304
  • 2
  • 4
  • @phil if you are going to check the logs, I suggest copying and pasting them to pastebin.com so that you can post a link to them and ask questions. – gatorback Feb 15 '20 at 14:47
  • I think Phil has ethernet and wifi adapters: if this is correct then we must first confirm that 192.168.1.51 is wifi and not ethernet? – gatorback Feb 15 '20 at 15:12
  • yep so I have a ethernet adapter, ip is..58, the built in wlan0 is 51 and the other odroid wifi dongle, I forgot – phil Feb 15 '20 at 15:55
  • @phil That is very important information and needs to be in your original post. Important facts should be in the OP and not buried in a comment – gatorback Feb 15 '20 at 16:14
  • If there is an additional USB/wired ethernet adapter on the RPi Zero then it is dead and has no functionality according to the output of ifconfig and routing table. But the DHCP server has given an ip address 192.168.1.58. Sorry, but the hole thing gets more and more mysterious. – Ingo Feb 15 '20 at 23:44
  • 58 is the usb dongle, I use it to debug the box, once I made anew change, I unplug it and reboot it – phil Feb 17 '20 at 16:52
  • I noticed CN, but in raspi-config, it is set to BE, I also compared to my RPI3, I also have CN – phil Feb 17 '20 at 16:59
  • also there is a log in the router but does not say much appart from allocating an ip and releasing it – phil Feb 17 '20 at 17:05
  • I tried iw res set BE, but it says country 98 : DFS-UNSET, then once I down/up the wlan interface, the country is back to CN – phil Mar 18 '20 at 14:25
  • I just found out that downing the wlan0 interface, iw reg get shows "country BE: DFS-ETSI" then, once I bring back up the interface, iw reg get shows "country CN: DFS-FCC"...how is it possible ? I found this but it does not say how to solve it https://github.com/raspberrypi/firmware/issues/630 I am not sure it's related – phil Mar 18 '20 at 14:37
0

I faced the same issue with my Pi Zero, it's well connected to Wifi as I can see its assigned IP in the DHCP list, but I can not access the Pi using SSH.

It's solved simply by replacing its power source, I realized that the issue was due to insufficient ampere in the first power supply I used.