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.
ip addr
,ip route
andsudo cat /etc/wpa_supplicant/wpa_supplicant.conf
(obscure the keys/passwords).