If you have a Raspberry Pi on WiFi then you are probably aware of the struggles
with it randomly disconnecting. If anything goes wrong with the WiFi (access
point restarts, IP address changes, you look at the pi the wrong way, etc.) the
WiFi will drop and never fix itself. I’ve written a script called
to kick the network device if a ping check fails.
There are a lot of small scripts floating around forums that do what
net-dev-kick does (albeit, poorly and with a lot of assumptions) so I decided
to clean it all up and make a simple yet robust program to deal with this
This script attempts to ping a server that should always be up (use your
router or something similar) and if it fails, it restarts the interface given
net-dev-kick is intended to be used on the raspberry pi to fix wlan0, but can
theoretically be used on any machine to fix any interface. It’s best used
as a cronjob that runs every 5 or so minutes.