0

Backstory: I have a Pi 3b for like some years now and I've been using it as a webserver for my personal websites. Like 2 weeks ago the wlan0 interface kept going missing and tried multiple solutions on the internet to fix it. Because of that, I thought I fully broke the pi and after a simple back-up, I installed the latest raspbian os from the official website.

After I had a fresh install, I did some modem/router changes like: port forward 21&22&80 and static ip(192.168.1.200) and also assigned a public ip(because I have set it to static instead of dynamic). The pi also picks up the public ip as ipv4(via ifconfig(wlan0)) but after any communication outside to the pi, wlan0 just keeps shutting down and wont work until I manually reboot it. its been working fine for years and now it decided to not work if I make any communication with it.

When it occurs:
-sshing to public ip which the pi has until request send
-web reqest to public ip

technical stuff:
1: dhcpcd status is active(running) until wlan0 shuts down, than it says failed with some error like:
"wlan0: adding route to PUBLIC-IP"
"wlan0: hardware address 00:4a:77:49:ec:a4 claims PUBLIC-IP"
"wlan0: deleting route to PUBLIC-IP"
"dhcpcd.service: Failed with result signal"

2:raspi-config->localisation options->change wi-fi country
"could not communicate with wpa_supplicant"
"there was an error running option I4 Change Wi-Fi Country"

3: rfkill list all = all unblocked

4: iwlist wlan0 scan = "wlan0 Interface doesn't support scanning: Network is down."

5: ifconfig = wlan0 dissapeared

6: i've kept all the config files default because didnt want to mess up a fresh install again.

I hope you guys can help me out with this struggle of mine. Thanks in advance. From EU time btw.

On Fresh Reboot:
pi@raspberrypi:~ $ ip addr

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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<br>
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether b8:27:eb:2e:4d:04 brd ff:ff:ff:ff:ff:ff<br>
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:7b:18:51 brd ff:ff:ff:ff:ff:ff
    inet XX.XXX.XXX.XX/24 brd XX.XXX.XX.255 scope global noprefixroute wlan0
       valid_lft forever preferred_lft forever
    inet6 fe80::6354:8067:543b:b21f/64 scope link 
       valid_lft forever preferred_lft forever

pi@raspberrypi:~ $ ip route

default via XX.XXX.XXX.1 dev wlan0 proto dhcp src XX.XXX.XXX.XX metric 303<br>
XX.XXX.XXX.0/24 dev wlan0 proto dhcp scope link src XX.XXX.XXX.XX metric 303

pi@raspberrypi:~ $ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=NL
network={
    ssid="XXX"
    psk="XXX"
    key_mgmt=WPA-PSK
}

After any communication with pi:

pi@raspberrypi:~ $ ip addr

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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<br>
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether b8:27:eb:2e:4d:04 brd ff:ff:ff:ff:ff:ff<br>
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether b8:27:eb:7b:18:51 brd ff:ff:ff:ff:ff:ff

pi@raspberrypi:~ $ ip route

*No Result*

pi@raspberrypi:~ $ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=NL
network={
    ssid="XXX"
    psk="XXX"
    key_mgmt=WPA-PSK
}

Final Edit: Thanks you for taking time to investigate into this problem. However i did not solve it. Tried both your methods but i've tried other methods to solve my issue. since i don't have an extra Pi, i could check if the wifi module was bricked. after that i tried using ethernet cable and still the same issue. after looking at the logs of the debug i saw that after i rebooted it and the internet still worked, it tried to add a wlan/eth interface even though 1 already existed. when the ethernet didn't work after a request was send, it tried to make add an interface when there was none but still failed. so i did quit this problem because i can't test it on hardware level. Again thanks for helping me. A mod may close this thread as closed but not solved.

2
  • Please edit your question and add the output of these three commands: ip addr, ip route and sudo cat /etc/wpa_supplicant/wpa_supplicant.conf (obscure the keys/passwords).
    – Ingo
    Dec 21, 2019 at 16:06
  • @Ingo I just posted de output of both scenarios. Hope you now have more insight on my annoying problem. Thanks in advance for taking time to help me.
    – Omer Erdem
    Dec 21, 2019 at 18:00

1 Answer 1

1

I can't see much from your setup. It looks like a default network setup from a fresh flashed image. That's good for analyzing problems and if the problem is the RasPi or not. Anyway, the WiFi interface should never go down no matter what's going wrong outside (except there is an exploit used).

But I do not understand this issue with the public ip address and what device uses it and how it is managed in your network. You cannot use just one. They are reserved. Usually you have to pay for it to get a public ip address reserved for you from your provider. Maybe wpa_supplicant determines somehow that there is used a reserved public ip address and disables itself?

The main problem belonging to Raspberry Pi is to find why the WiFi interface shut down. A simple test is to use temporary another/new Raspberry Pi if possible to exclude a hardware problem and maybe to use a new SD Card. On the current RasPi you should look at the journal if wpa_supplicant is giving some error messages:

rpi ~$ journalctl --unit=wpa_supplicant.service

You can also run wpa_supplicant in debug mode in the foreground in the hope it will tell you why it crashes. It is a good idea to run it with screen so you can do other things in another screen and you can logout. Managing screen is out of scope here. Just look at the man page and use ctrl+A+?. If not available install it with sudo apt install screen and run it with screen.

First shutdown the background service:

rpi ~$ sudo systemctl stop wpa_supplicant.service
# check status
rpi ~$ systemctl status wpa_supplicant.service

Then start it in foreground debug mode:

rpi ~$ sudo /sbin/wpa_supplicant -d -c/etc/wpa_supplicant/wpa_supplicant.conf -Dnl80211,wext -iwlan0

If it doesn't crashed after a time then stop it with ctrl+C.

Your Answer

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

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