I have my openSUSE 11.2 connected to router by wifi. I want frequently to access it from my LAN or even Internet, but even so frequent the connection is lost for some reason.
When I am at the box, I can easily do a ifdown/ifup and it will reconnect, but that is a pain when I am not local.
is there some way or maybe a script to check the connection so now and then and if not online then re-connects it automatic ?
Yes, should be very simple to implement.
Script runs in an endless loop (while true ; do).
Checks with ping, if the router can be reached (or a site on the net maybe).
If there is no answer in a certain time (read man ping), restart network.
Can be automatically started/stopped with ifup for every interface (/etc/sysconfig/network/if-up.d|if-down.d/) or only a certain interface (read man ifcfg, especially about PRE/POST_UP/DOWN-scripts) or with NetworkManager using a “NetworkManager dispatcher script” (use search engine of your choice and search for that string).
Well yes, I was almost thinking about some same script, downside is I am not very good in scripting (yet) so my idea was:
Make the script run in cron
Script does following:
ping -c1 Google
if no answer, do ifdown & ifup
if answer, do nothing and go to start
Sorry to ask, but can you help me with some basics ?