I have a raspberry pi 4 which is running raspbian. I am using the device as a local server inside my network so the device is always on. The setup works great but every few hours the raspberry pi can no longer be reached via SSH until I restart the pi. I assumed this was just the pi not connecting back to the internet after it disconnects so I set it to restart anytime it fails to ping the router. However, I setup a temporary monitor and keyboard to the pi and it turns out that when this internet issue occurs the pi can still ping the router (and other devices connected to the router), it's just that other devices cannot ping it. Any suggestions for how I can fix this?
I should also mention the pi is using wifi (and cannot be connected via ethernet).