Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

One way to prevent dropped network connections Apps
If, like me, you have a MacBook Pro -- or any other machine which has problems staying connected to a wireless network -- here's a quick and dirty fix. What I've found is that pinging the router continually prevents the loss of connection. I then minimize the Terminal window with the ping task, and all is well.

[robg adds: While solving the problem would be a better solution, this is a functional workaround. You could reduce the system impact a bit by using something like ping -c 2 192.168.1.1, where 192.168.1.1 is the router address. The -c 2 bit tells ping to stop after two responses. Then use cron (or Cronnix, a GUI front-end for cron) to run that command every few minutes -- just often enough to keep the connection alive.]
    •    
  • Currently 3.67 / 5
  You rated: 5 / 5 (3 votes cast)
 
[14,300 views]  

One way to prevent dropped network connections | 20 comments | Create New Account
Click here to return to the 'One way to prevent dropped network connections' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
One way to prevent dropped network connections
Authored by: redsweater on Dec 13, '06 08:04:09AM

Something I've noticed helps the robustness of a wireless connection is to have more than one router in the network. For instance, I had a pretty flaky connection from one computer in my house, and then added an Airport Express to the network topology. Before, when the connection between the computer and the (only) router was lost, it meant the Airport network was gone, so I would get disconnected. Now, with the APX on the network, it gives my computer something to "hang on to" even during the spotty times, so the network stays alive even if, for instance, I was to power cycle the main router.


---
--
Daniel Jalkut
http://www.red-sweater.com/



[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: leamanc on Dec 13, '06 08:35:33AM

Seems like a pretty sad day for Mac wireless networking when you have to constantly ping your router to stay connected.

On the other hand, I have had good range and connectivity with my 17" Mac Book Pro (1st gen). At home, though, I do have two routers (an AirPort Extreme and Express) like the above poster mentions.



[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: kainewynd2 on Dec 13, '06 08:44:40AM

Can't say this has occurred to me. Guess I must be lucky (17" MacBook Pro).



[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: chally on Dec 13, '06 09:39:45AM
I haven't had that problem with my Airport connection, but it's an irritating problem I've had with Sprint, through my bluetooth phone. I noticed that if I keep it busy, I don't get dropped (as much.) Instead of hassling with the terminal, I wrote an applescript, which I saved as an application named "Ping":

do shell script "ping -i20 xxx.xxx.xxx.xxx &> /dev/null &echo $!"
set pid to the result
tell application "Ping" to deactivate
display dialog (option-return)
  "Pinging xxx.xxx.xxx.xxx every 20 seconds." & return & (option-return)
  "Waiting to kill process ID: " & pid (option-return)
  buttons "OK" default button "OK"
do shell script "kill " & pid
You'll need to replace xxx.xxx.xxx.xxx with a valid IP address or domain reference (if it works for you) outside your intranet a domain name may work too (EG www.macoshints.com.)

[ Reply to This | # ]
xxx.xxx.xxx.xxx
Authored by: chally on Dec 13, '06 09:44:52AM

Obviously, I've been pinging my.yahoo.com...I meant to replace that with the same "xxx.xxx.xxx.xxx" reference as I did in the command.



[ Reply to This | # ]
-i20 is 20 second delay between ping attempts
Authored by: chally on Dec 13, '06 09:46:30AM

By the way, -i20 delays 20 seconds between ping attempts, which is kinder to everyone between you and the server you're pinging, inclusive.



[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: stutemp1 on Dec 13, '06 10:18:48AM

Be careful of the IP you use! Repeated pings, though minimal in packet size, do add up bandwidth-wise and can be misconstrued as a type of DoS attack. If you pick an address that pays by the bandwidth used, they will not appreciate the added non-productive traffic to their site. Perhaps use an address like the home page of your ISP.... sprint.com or etc. Plus, I like MacOSXhints.com to be speedy. :-)

Personally I use the widget named Geek Image which allows one to load a URL periodically like from a webcam site, or weather radar map etc. it has separate timers for updating when activated and updating in the background, so you can set it to reload the map every 4-5 minutes or whatever it takes to keep the connection alive. This probably uses more bandwidth than a few pings, but will not flag you in security programs as a potential hacker.



[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: chally on Dec 13, '06 10:39:11AM

Yes, I'm sensitive to this. That's why I use yahoo, and limit the traffic to the minimum necessary (I found -i20s about right.)

...and, sure...the best solution, if you have it, is your own service. I don't know if pinging sprint from sprint will have the desired effect--maybe.



[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: xianman on Dec 13, '06 03:48:29PM

I would really like to try this script, but I get an error saying 'The variable deactivate is not defined.'. My Script editor is seeing 'deactivate' in the 3rd line as a variable and not a function, as indicated by its green color. Unfortunately I am not saavy enough to know how to fix this problem. Any ideas?



[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: chally on Dec 13, '06 04:23:40PM

That's weird. Works for me. Try this: http://tinyurl.com/yfrsqn

Don't forget to change the IP address, and just try commenting out the deactivate line if it doesn't work for you.



[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: xianman on Dec 13, '06 04:56:58PM

Thanks, that works to comment that line out. Not sure why it works for you and not for me though.



[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: chally on Dec 13, '06 07:04:07PM

Frankly, it *did* work for me (it was in the same place from which I've used it) but it doesn't work now. Something must have changed. Very strange. Maybe applescript applications can no longer understand the deactivate command, or maybe I had something installed that made it understand. I don't know. In any case, it's not entirely necessary. It was helpful when I launched the app from another script, though.

Glad it's working for you now.



[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: gregor on Dec 13, '06 05:23:44PM
Another way might be installing the airport update released yesterday. It is not available through software update app only on Apple's website:

http://www.apple.com/support/downloads/airportupdate2006002.html

[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: chally on Dec 13, '06 08:39:01PM
I've posted a significantly enhanced version of the above script:

http://tinyurl.com/yfrsqn

It essentially allows you to change the interval or address on the fly. There's no address checking, so if you put in an invalid address, it'll probably tell you the process doesn't exist when it tries to kill it.

Also, as discussed here, for some reason, the "deactivate" command stopped working. I don't know why that is, but I've removed it.

[ Reply to This | # ]
You could do it with style, and run this from geektool...
Authored by: blurred on Dec 13, '06 09:52:30PM

Handy for me, (changing networks almost hourly sometimes) to verify connectivity all layers by running this script under geektool, and displaying it on my desktop...

#!/bin/bash
DATE=`date`
GATEWAY=`netstat -nr | grep default |grep -v "#"| awk '{print $2}'`
echo "[*]-- Pinging Default Gateway @ ${DATE}"
echo
if [ "${GATEWAY}" != "" ]
then
ping -c3 ${GATEWAY}

else
echo "[*]-- No Default Gateway Found"
exit 1
fi



[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: doglan on Dec 14, '06 04:49:14AM

The problem with pinging on a laptop is that the sleep mode never triggers as it "sees" activity all the time.

My MB keeps disconnecting even with the ping running when it wakes up from sleep.

Apple service says that the problem is between the new AirPort cards on the MBs & MBPs and certain non-Apple AP like linksys (not sure if with or without the original firmware)

I'm very upset with this disconnection problem after having to swap the motherboard for unexpected turn-offs :-(

Don't get me wrong, I love the Mac, I've been using one since the Plus, but this problem is really annoying and unexpected.



[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: chally on Dec 14, '06 06:51:09AM

I use an SMC wireless router and a MacBook Pro, and I *never* have the problem with Airport. Maybe I'm just lucky or something.

I do have the problem on the road when using my GPRS phone, though, which is why the script is useful or me when I go online. I wouldn't expect it to properly sleep while running the script.



[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: pbm on Dec 16, '06 03:53:19PM

I've had my mbp for 5 weeks. I was having the same network dropped problems as described. I have an old ibook clam shell and an iMac. The other computers worked fine, but the mbp had problems. I found on the net to try changing the channel your hub uses. I have an airport extreme. I tried most of the channels, recorded the ping time to the hub and dropped packet count. There was a huge difference. I chose the channel with the best results. The mbp hasn't dropped a connection yet in 3 weeks. The same article said you might not want to pick a channel next to one your neighbors may be using...it could affect you.



[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: burtman on Dec 19, '06 01:29:53PM

Interestingly since I posted this hint I've swapped routers from a Wrt54g, to another Wrt54g and now I have no problems with the network dropping, and I've stopped using the ping to keep the network up.



[ Reply to This | # ]
i just have a question
Authored by: coronadopcc on Mar 01, '07 02:15:01AM

I just moved to a different house, and it happens that my neighbor is got wireless connection without an access password to it, so, the nice thing about it, is that i can get online without having to pay at all.
My question is: is it a way that i could somehow make the signal go stronger? i have a powerbook G4 laptop.



[ Reply to This | # ]