Geek Posted August 8, 2011 Posted August 8, 2011 <div class="KonaBody"><p><img src="http://osxdaily.com/wp-content/uploads/2011/08/wifi-keepalive-script.jpg" alt="Mac Wi-Fi Keepalive Script" title="wifi-keepalive-script" width="518" height="126" class="aligncenter size-full wp-image-19941" /></p> <p>Many users who upgraded to Mac OS X Lion discovered that their Wi-Fi connections were dropping periodically for no apparent reason. We published a reasonably thorough <a href="http://osxdaily.com/2011/07/22/wifi-dropping-in-os-x-lion-fixes/">walkthrough with tips on fixing OS X Lion’s wireless dropping issues</a> and that’s a recommended starting point because most tips are easy and less complicated, but among those was a trick to maintain data transfer by pinging an IP address. </p> <p>The keepalive ping technique seems to work, but it turns out you don’t need to ping an external IP, you can also just<em> occasionally ping your local wifi access point</em>. With this in mind, we’re going to create a simple keepalive script that will run from the command line and ping your router every 5 seconds, allowing the wifi connection to maintain itself and prevent a drop.</p> <p><span id="more-19939"></span></p> <h2 style="font-size:1.2em;">1) Get your WiFi Router IP Address</h2> <p>You’ll need to know your wireless access points IP address before proceeding, it’s usually something like 192.168.0.1 or 192.168.1.1. </p> <p>You can get this information from System Preferences > Network > Advanced > TCP/IP and looking for the IP next to “Router”:</p> <p><img src="http://osxdaily.com/wp-content/uploads/2011/08/get-router-ip-address-mac.jpg" alt="Get WiFi Router IP Address in Mac OS X " title="get-router-ip-address-mac" width="611" height="134" class="aligncenter size-full wp-image-19940" /></p> <p>Make note of that IP and proceed with the following:</p> <h2 style="font-size:1.2em;">2) Create the Keepalive Bash Script</h2> <ul> <li>Launch the Terminal (located in /Applications/Utilities/)</li> <li>Type the following command:</li> <p><code>nano keepalive.sh</code></p> <li>Paste in the following, be sure to replace the IP with your own routers:</li> <p><code>#!/bin/bash ping -i 5 -n 192.168.1.1</code></p> <li>Hit Control+O to Save the contents of keepalive.sh</li> <li>Hit Control+X to exit from nano</li> </ul> <h2 style="font-size:1.2em;">3) Run the Wi-Fi Keepalive Bash Script</h2> <ul> <li>Back at the command line, we have to make the script executable, we do this with:</li> <p><code>chmod +x keepalive.sh</code></p> <li>Now to run the keepalive script, we type:</li> <p><code>./keepalive.sh &</code> </ul> <p>That last command starts and runs the keepalive.sh script in the background. Your wireless connection should stay alive now and dropping should come to an end.</p> <p>The idea of creating a simple bash script comes from <a href="http://actoker.blogspot.com/2011/08/mixed-up-confusion-how-i-solved-mac.html">Ahmet C. Toker</a>, who left the trick in our comments and said that after he ran it “the problem melted away” and the wifi stopped dropping. It’s less of a fix and more of a simple workaround, but it does seem to maintain wifi connections, and it’s probably better than pinging an external IP address like yahoo.com for a number of reasons.</p> <p>The remaining question is if there is a bug with how Mac OS X 10.7 handles wifi connections, or if some routers just don’t play well with OS X. I think it’s the latter, because I’ve only encountered the problem on select brands of routers and others are flawless, but for all routers I have found a solution that stopped the connection failures completely. It’s possible that a future update to OS X 10.7 will resolve the issue completely for everyone.</p> <p>If you’re still having troubles you can review our multitude of past guides on troubleshooting wireless issues in Mac OS X:</p> <ul> <li><a href="http://osxdaily.com/2011/07/22/wifi-dropping-in-os-x-lion-fixes/">WiFi Dropping in OS X Lion? Here are Some Wireless Troubleshooting Solutions</a></li> <li><a href="http://osxdaily.com/2009/12/22/mac-wireless-problems-guide-to-troubleshooting-airport-wireless-problems-on-your-mac/">Guide to Troubleshooting Wireless Problems on your Mac</a></li> <li><a href="http://osxdaily.com/2009/09/01/how-i-fixed-my-dropping-wireless-airport-connection-problem-in-snow-leopard/">Fixed dropping wireless Airport connection problem in Mac OS X 10.6 Snow Leopard</a></li> <li><a href="http://osxdaily.com/2010/04/02/wireless-dropping-problems-with-mac-os-10-6-3-update-a-simple-fix/">Simple fix for wireless dropping problems with Mac OS X 10.6.3</a></li> </ul> <p>Good luck!</p> </div> <p><a href="http://feedads.g.doubleclick.net/~a/Jr_hNGDqGYL-YZqehfYwbQlVsSc/0/da"><img src="http://feedads.g.doubleclick.net/~a/Jr_hNGDqGYL-YZqehfYwbQlVsSc/0/di" border="0" ismap="true"></img></a><br/> <a href="http://feedads.g.doubleclick.net/~a/Jr_hNGDqGYL-YZqehfYwbQlVsSc/1/da"><img src="http://feedads.g.doubleclick.net/~a/Jr_hNGDqGYL-YZqehfYwbQlVsSc/1/di" border="0" ismap="true"></img></a></p><div class="feedflare"> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=_3KYcsckeTg:CI9BYYj8iJE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=_3KYcsckeTg:CI9BYYj8iJE:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=_3KYcsckeTg:CI9BYYj8iJE:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=_3KYcsckeTg:CI9BYYj8iJE:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=_3KYcsckeTg:CI9BYYj8iJE:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=_3KYcsckeTg:CI9BYYj8iJE:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=_3KYcsckeTg:CI9BYYj8iJE:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=qj6IDK7rITs" border="0"></img></a> </div><img src="http://feeds.feedburner.com/~r/osxdaily/~4/_3KYcsckeTg" height="1" width="1"/> View the full article
Recommended Posts