How to Run the traceroute and ping Commands


Last modified: November 23, 2022

Overview

This document describes how to run the traceroute and ping utilities on different operating systems. The traceroute utility determines the route that a network packet travels from your local machine to reach the target destination. The ping command allows you to test the latency between your local machine and the target IP address.

More:

For more information about the ping and traceroute utilities, read the following documentation:

Traceroute

macOS or Linux

Note:
Some servers may restrict the traceroute command. If so, connect to the server via SSH as a privileged user, such as the root user.

To run the traceroute utility on a macOS® or Linux® server, perform the following steps:

  1. Log in to the server via SSH.

  2. Run the traceroute example.com command, where example.com represents the target host to test. Successful output will resemble the following example:

    1
    2
    3
    4
    
    traceroute to example.com (192.168.0.20), 30 hops max, 60 byte packets
     1  gateway (192.168.0.20)  0.868 ms  0.856 ms  0.728 ms
     2  10.1.0.1 (192.168.0.20)  0.664 ms  0.629 ms  0.595 ms
     3  vl118.ss-core.example.com (192.168.0.20)  1.041 ms  1.011 ms  0.974 ms

Microsoft Windows

Note:
Use the tracert command to run the traceroute utility on a Microsoft Windows® server.

To run the tracert command on a Microsoft Windows server, perform the following steps:

  1. From the Windows Start menu, enter cmd in the Search text box.
  2. Double-click Command Prompt in the list that appears. The Windows command prompt will appear.
  3. Run the tracert example.com command, where example.com represents the target host to test. Successful output will resemble the following example:
    1
    2
    3
    4
    
    Tracing route to example.com [192.168.0.20]
     1  2ms  1ms  1ms 192.168.0.20
     2  7ms  7ms  9ms 192.168.0.20 gateway (192.168.0.20)  0.868 ms  0.856 ms  0.728 ms
     3  11ms  11ms  11ms 192.168.0.20

Ping

macOS or Linux

To run the ping utility on a macOS or Linux server, perform the following steps:

  1. Log in to the server via SSH.

  2. Run the ping example.com command, where example.com represents the target host to test. Successful output will resemble the following example:

    1
    2
    3
    4
    
     PING example.com (192.168.0.20): 56 data bytes
     64 bytes from 192.168.0.20: icmp_seq=0 ttl=45 time=22.122 ms
     64 bytes from 192.168.0.20: icmp_seq=1 ttl=45 time=21.327 ms
     64 bytes from 192.168.0.20: icmp_seq=2 ttl=45 time=24.583 ms 
    

Microsoft Windows

To run the ping utility on a Microsoft Windows server, perform the following steps:

  1. From the Windows Start menu, enter cmd in the Search text box.
  2. Double-click Command Prompt in the list that appears.
  3. Run the ping example.com command, where example.com represents the target host to test. Successful output will resemble the following example:
    1
    2
    3
    4
    
    PING example.com (192.168.0.20) with 56 bytes of data:
    Reply from 192.168.0.20: bytes=64 ttl=45 time=22.921 ms
    Reply from 192.168.0.20: bytes=64 ttl=45 time=22.921 ms
    Reply from 192.168.0.20: bytes=64 ttl=45 time=22.921 ms

Additional Documentation