Fix wi-fi dropping osxlion
Mac Wi-Fi Dropping? Use a Simple Keepalive Bash Script to Maintain Wireless Connection
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 thoroughwalkthrough with tips on fixing OS X Lion’s wireless dropping issues 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.
The keepalive ping technique seems to work, but it turns out you don’t need to ping an external IP, you can also justoccasionally ping your local wifi access point. 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.
1) Get your WiFi Router IP Address
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.
You can get this information from System Preferences > Network > Advanced > TCP/IP and looking for the IP next to “Router”:
Make note of that IP and proceed with the following:
2) Create the Keepalive Bash Script
- Launch the Terminal (located in /Applications/Utilities/)
- Type the following command:
Paste in the following, be sure to replace the IP with your own routers:
ping -i 5 -n 192.168.1.1
Hit Control+O to Save the contents of keepalive.sh Hit Control+X to exit from nano
3) Run the Wi-Fi Keepalive Bash Script
- Back at the command line, we have to make the script executable, we do this with:
chmod +x keepalive.sh
Now to run the keepalive script, we type:
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.
The idea of creating a simple bash script comes from Ahmet C. Toker, 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.
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.