Skip to content

Network Testing with ping

The ping command in the ChromeOS Shell is a diagnostic tool used to test network connectivity by sending ICMP echo request packets to a specified host and measuring the response.

Usage

ping [options] <destination>

Options

  • -4: Use IPv4 addresses.
  • -6: Use IPv6 addresses.
  • -c <count>: Specify the number of packets to send.
  • -i <interval>: Set the interval between sending packets in seconds.
  • -n: Disable hostname resolution, displaying only IP addresses.
  • -s <packetsize>: Specify the size of the packets sent.
  • -W <waittime>: Set the time in seconds to wait for a response.

Special Destination

  • gw: When <destination> is set to gw, the command pings the next hop gateway for the default route.

Examples

Basic Connectivity Test

ping google.com

Send a Specific Number of Packets

ping -c 4 8.8.8.8

Test IPv6 Connectivity

ping -6 example.com

Ping the Gateway

ping gw

Additional Information

  • Use Cases: The ping command is commonly used to:
  • Test if a host is reachable.
  • Measure network latency.
  • Identify packet loss.

  • Protocol: The tool uses the Internet Control Message Protocol (ICMP), which is integral to the network layer.

  • Limitations: Some networks or firewalls may block ICMP traffic, leading to failed ping attempts even when the host is reachable.

Best Practices

  1. Limit Packet Count
  2. Use -c to avoid sending continuous packets in scripts or automated tasks.

  3. Test Specific Protocols

  4. Specify -4 or -6 to isolate issues with IPv4 or IPv6 connectivity.

The ping command is an essential utility for network diagnostics, offering quick insights into connectivity and performance issues.