Ping on Mac OS

Need to test your connection between your computer and a website or server? The ping command allows you to send small packets of data to a remote server to measure how long it takes to return them and if the server is online. You can run the ping command from the Network Utility or from the Terminal. You can also use the ping command to troubleshoot your own network by pinging yourself.

Steps

Using the Terminal

  1. Open the Terminal. The Terminal app is located in the Utilities folder, which can be found in your Applications folder. You can also search for Terminal using Spotlight, or quickly access the utilities folder from the Go menu.
  2. Enter in the Ping command. You can ping an address using the Terminal using the Ping command. This functions similarly to the Network utility app. Type ping -c and press Enter.
    • Replace with the number of times you want to ping the address. You can usually get all the info you need with 5-10 pings.
    • Replace with the address or website that you want to ping. You can ping your own computer by entering 127.0.0.1.
    • To view a full explanation of the command and all the available arguments, type in man ping and press Enter.
  3. Read the output. After sending the ping command, you will see a readout with all the data related to the pin. Interpreting this data can help troubleshoot your network or a server problem.
    • The first line of output describes what the Ping utility is going to do. It will display the address you are pinging along with the size of the data packet you will be sending. For example: ping example.com
      PING example.com (192.0.32.10): 56 data bytes
    • The ensuing lines of display the results of the ping and any communication received back from the server. This includes the amount of data returned, the amount of times until the packet expired (ttl), and the amount of time that the ping response took, in milliseconds (ms). For example: 64 bytes from 192.0.32.10: icmp_seq=0 ttl=240 time=98.767 ms
      64 bytes from 192.0.32.10: icmp_seq=1 ttl=240 time=96.521 ms
      64 bytes from 192.0.32.10: icmp_seq=2 ttl=240 time=95.766 ms
      64 bytes from 192.0.32.10: icmp_seq=3 ttl=240 time=95.638 ms
      64 bytes from 192.0.32.10: icmp_seq=4 ttl=240 time=95.414 ms
      64 bytes from 192.0.32.10: icmp_seq=5 ttl=240 time=93.367 ms
    • The final lines of output summarize the results. The number of packets transmitted, received, and lost will be shown. Lost packets are indicative of a poorly configured network or bad signal. For example: 6 packets transmitted, 6 packets received, 0.0% packet loss
      round-trip min/avg/max/stddev = 93.367/95.912/98.767/1.599 ms

Troubleshooting If the Ping Fails

  1. Try another host name. If you receive the ping report ping: cannot resolve example.com: Unknown host, it usually means that the you have misspelled the host name. Try another host name like “example.com”. If that reports “Unknown host,” then the problem is most likely the address of the domain name server.
  2. Use the host’s IP address instead of its name. If the problem is the address of the domain name server, ping using the host’s IP address instead of its name (e.g., 192.0.32.10). If this is successful then either the address you are using for the domain name server is incorrect or it is unreachable or down.
    • If you receive the ping report ping: sendto: No route to host, this may mean the address of the gateway is incorrect or that the connection from your computer is not up and running.
  3. Ping your own computer. Ping 127.0.0.1 This is the IP address of your own computer. If this fails, the network configuration or the NIC (Network Interface Card) may be bad. Install-Nic-Card or add a new one.
  4. Check the network connection. If you are connected directly to your router, check the cable from your computer to your router, especially if the connection worked previously. If the Ethernet cable came loose, it could be causing the connection to fail.
    • If you are connecting wirelessly, ensure that you are properly connected to the network, and that the correct security password has been entered.
  5. Check the NIC port's indicator light. Most computer NIC ports have an indicator light that indicates a good connection and one that blinks as data is transferred. As the ping command transmits packets at about 1 per second, you should be able to see the data light blink.
  6. Check the router. Check that the router’s indicator light is lighting up properly (and no faults), including the one that indicates a good connection to your computer. If a fault indicator is on, follow the cable from your computer to the router to make sure it is properly connected, then call your cable or broadband provider if necessary.

Tips

  • If your router to the Internet is configured with security, you can verify that your network is stealth by running an online port scanning service.
  • Not responding to ping does not improve security, as believed by many people.
  • You can also run a remote ping. This allows you to ping an IP address or computer from a computer other than yours to see if the problem may be associated with your local connection rather than the IP address you are trying to connect to.
  • The easiest way to enable stealth on a Macintosh:
    • Open “System Preferences.”
    • Select “Sharing.”
    • Click on “Firewall,” and a new window will appear with the “Advanced” option.
    • Click on “Advanced.”
    • Uncheck “Enable Stealth Mode.”
    • Click “OK.” Now you can ping this Macintosh from any machine on your local network. See How to Ping an IP Address for more details.

Related Articles