> For the complete documentation index, see [llms.txt](https://riteshs4hu.gitbook.io/infosec-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://riteshs4hu.gitbook.io/infosec-notes/reconnaissance/active-reconnaissance-approach/netwrok-scanning-tools/ping.md).

# ping

The `ping` command is a network utility used to test the reachability of a device on a network and measure the round-trip time (RTT) for messages sent from the source to the destination. It helps diagnose connectivity issues and assess network performance.

### Syntax

```bash
ping [options] <destination>
```

### Examples

* **Show the help menu of the command**

  ```bash
  ping -h
  ```
* **Ping a website using its DNS name or IP address**

  ```bash
  ping example.com
  ```
* **Use audible ping (beeps on reply)**

  ```bash
  ping -a example.com
  ```
* **Use adaptive ping**

  ```bash
  ping -A example.com
  ```
* **Sticky source address**

  ```bash
  ping -B example.com
  ```
* **Stop after sending 4 packets**

  ```bash
  ping -c 4 example.com
  ```
* **Call connect() syscall on socket creation**

  ```bash
  ping -C example.com
  ```
* **Print timestamps with each ping reply**

  ```bash
  ping -D example.com
  ```
* **Use SO\_DEBUG socket option**

  ```bash
  ping -d example.com
  ```
* **Define a custom identifier for the ping session**

  ```bash
  ping -e 1234 example.com
  ```
* **Flood ping (send packets as fast as possible)**

  ```bash
  ping -f example.com
  ```
* **Force reverse DNS name resolution**

  ```bash
  ping -H example.com
  ```
* **Specify network interface for sending packets**

  ```bash
  ping -I eth0 example.com
  ```
* **Set interval between packets to 2 seconds**

  ```bash
  ping -i 2 example.com
  ```
* **Suppress loopback of multicast packets**

  ```bash
  ping -L example.com
  ```
* **Send 5 packets immediately while waiting for replies**

  ```bash
  ping -l 5 example.com
  ```
* **Tag packets with a specific mark**

  ```bash
  ping -m 10 example.com
  ```
* **Set Path MTU discovery option to "do"**

  ```bash
  ping -M do example.com
  ```
* **Disable reverse DNS resolution**

  ```bash
  ping -n example.com
  ```
* **Report outstanding replies**

  ```bash
  ping -O example.com
  ```
* **Specify a custom padding pattern**

  ```bash
  ping -p ff example.com
  ```
* **Quiet output (only summary displayed)**

  ```bash
  ping -q example.com
  ```
* **Set quality of service bits**

  ```bash
  ping -Q 0x20 example.com
  ```
* **Send packets with a specific data size (1000 bytes)**

  ```bash
  ping -s 1000 example.com
  ```
* **Set socket buffer size**

  ```bash
  ping -S 4096 example.com
  ```
* **Set time-to-live (TTL) value to 64**

  ```bash
  ping -t 64 example.com
  ```
* **Print user-to-user latency**

  ```bash
  ping -U example.com
  ```
* **Enable verbose output**

  ```bash
  ping -v example.com
  ```
* **Show the ping command version**

  ```bash
  ping -V
  ```
* **Set a deadline of 10 seconds for ping responses**

  ```bash
  ping -w 10 example.com
  ```
* **Wait 5 seconds for each reply before timeout**

  ```bash
  ping -W 5 example.com
  ```

#### IPv4-Specific Options

* **Force IPv4 usage**

  ```bash
  ping -4 example.com
  ```
* **Allow pinging a broadcast address**

  ```bash
  ping -b 192.168.1.255
  ```
* **Record the route of packets**

  ```bash
  ping -R example.com
  ```
* **Use a timestamp option**

  ```bash
  ping -T tsonly example.com
  ```

#### IPv6-Specific Options

* **Force IPv6 usage**

  ```bash
  ping -6 example.com
  ```
* **Set an IPv6 flow label**

  ```bash
  ping -F 12345 example.com
  ```
* **Use IPv6 node info query**

  ```bash
  ping -N help
  ```
