I'm having a small issue with my Synology NAS. It keeps throwing off the connection to the internet (local network works fine though). It is quite random, sometimes it doesn't happen for days, sometimes it happens every 10-20 minutes. Tried a hard reset, clean update, everything, yet even on a clean system, in a few day it continues. No other computers show such symptoms on the network.

Usually this problem can be solved by an ifdown&&ifup combo, but I'm getting annoyed by it - any time I wish to use the download station, I need to open a terminal session to make sure there's network connection for those few minutes.

So the question would be - is there a simple way of automatically resetting the network interface in case there's no connection to the outside? I've been thinking of a minute-poll to google.com, if the request takes longer than 10 seconds, restart the network interface. But I'd prefer something native, that does this automatically (sincerely, I do not wish to write such a script, it's a way too long and tedious process for me).


There are several packages that can govern/manage the network. NetworkManager and wicd are 2 that I'm familiar with. You can run these both from the command line, and they can fully manage the network. You could leverage either to check if the network is in a up/usable state and to initiate a restart if connectivity is lost.

If the device is providing a service like Upstart/Systemd you can also put rules into place at that level to trigger restarts when internet connectivity is lost.

Something from cron

If you're limited in what you can do in terms of the software available to you on your Synology box, you could run something from cron every couple of minutes.

if ! ping -Q 1 -c 1 -t 1 google.com; then
    ifdown eth0
    sleep 3
    ifup eth0


  • The problem is, as I mentioned in the question, that my system is not just any regular distro, but Synology's own solution. Just to get wicd working to an extent would mean recompiling half of the GTK runtime just to work with my NAS, and have GObject for Python ready. Of course I do not wish to do so. Best solution would be the same functionality as wicd's automatic reconnection, BUT in a bash script format, using ifconfig only (to manage the network).
    – fonix232
    Jun 5 '14 at 12:31
  • @fonix232 - have you taken a look at Synology's website? They offer many addons/packages - synology.com/en-us/dsm/app_packages/all_app
    – slm
    Jun 5 '14 at 13:11
  • Yes, I know about it - actually I've been cross-compiling my own packages, but they're nothing more than some end-user apps (e.g. CRM, different "Stations", etc.)
    – fonix232
    Jun 6 '14 at 15:10
  • Okay, I just saw your updated answer. I'm testing the script right now, will see how well it works (manually running it fixes the problem, now I'm checking if the crontab stays).
    – fonix232
    Jun 7 '14 at 15:39

Using the script above (slightly tweaked) as below running in the task scheduler each minute. You could use cron instead but it is nice to have in the gui.

if ! ping -I wlan0 -c 1 google.com; then
ifconfig wlan0 down
sleep 5
ifconfig wlan0 up

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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