How to Use ping on Mac: Pinging Websites, Domains, or IP Addresses
Ping is an essential utility for network administrators, but it’s also pretty handy to check if websites are online, how your internet connection is working, if you are experiencing lag or packet loss on a network connection, or if a network resource is available.
There are two ways to access ping tools in OS X from any Mac running any version of system software, but we’ll focus primarily on using ping from the command line since it is universal, meaning once you know how to use it on Mac OS X, but you’ll find it in Unix, Linux, and Windows too.
How to Use Ping from Mac OS X Command Line
Here’s how to use it the ping utility in all versions of Mac OS X from the Terminal app command line.
Ping a Destination IP or Domain Until Stopped
The most basic usage of ping will ping a destination until it is manually stopped, meaning there is no limit and no count.
- Launch the Terminal, found in the Utilities folder of Applications
- Type the following command:
- This will ping to yahoo.com repeatedly until you stop the ping command from running by hitting Control+C
Ping an IP / Domain for a Specified Packet Count
Want to send a handful of packets and measure that instead of pinging endlessly until manually stopped? Use the -c flag attached to ping, everything else is the same:
- Go back to the command line if you’re not there again
- To send a specific number of packets to an address, modify ping syntax to use the -c flag like so:
- Hit return and let ping complete to the destination for the specified packet count before automatically terminating the ping
ping -c 5 192.168.0.1
In that example, -c 5 will send 5 packets to the destination IP.
Note the ping command only works if the Mac is online, and if the server you are pinging is online, and responds to ping requests. Most servers do respond if they’re online, except perhaps the most hardened networks who reject ping for security purposes.
Reading and Understanding Ping Results
An example of ping results may look like the following:
$ ping 220.127.116.11
PING 18.104.22.168 (22.214.171.124): 56 data bytes
64 bytes from 126.96.36.199: icmp_seq=0 ttl=57 time=23.845 ms
64 bytes from 188.8.131.52: icmp_seq=1 ttl=57 time=22.067 ms
64 bytes from 184.108.40.206: icmp_seq=2 ttl=57 time=18.079 ms
64 bytes from 220.127.116.11: icmp_seq=3 ttl=57 time=23.284 ms
64 bytes from 18.104.22.168: icmp_seq=4 ttl=57 time=23.451 ms
64 bytes from 22.214.171.124: icmp_seq=5 ttl=57 time=21.202 ms
64 bytes from 126.96.36.199: icmp_seq=6 ttl=57 time=22.176 ms
64 bytes from 188.8.131.52: icmp_seq=7 ttl=57 time=21.974 ms
--- 184.108.40.206 ping statistics ---
8 packets transmitted, 8 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 18.079/22.010/23.845/1.703 ms
Each line to the destination represents a packet transission, the time specified in milliseconds at the end is most relevant for testing an internet connection as a high number there indicates there is lag or a connection problem. If there is no response at all, either the server is down, there is a connection problem, it does not respond to ping requests, or it is very slow to respond.
Perhaps next most useful is the “packet loss” number at the end. If packet loss is high, you almost certainly have network issues, because packet loss means that data being sent between you and the server is being lost (the term is quite literal in that sense). Troubleshooting packet loss can be challenging, but it can be the result of a poor internet connection, wi-fi problems, general network problems, a bad connection, a struggling connection, an interfered connection, connection interruptions, or many other potential networking issues.
Using ping to Verify Network Assets & Test Network Latency
I use ping constantly to make sure network servers are available, because it’s a lot faster to ping an IP than to try and connect to it through any number of protocols. It’s also a great way to test internet connections latency, which can be helpful for troubleshooting network issues with wi-fi or wired connections.
For users who do not feel comfortable with the command line, users can turn to the Network Utility app, which is bundled with every version of Mac OS X and provides a simple user friendly interface to ping, as well as a host of other helpful networking utilities.