> 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/traceroute.md).

# traceroute

Traceroute is a network diagnostic tool used to trace the path (route) that data packets take across the internet from a source to a destination, identifying the routers along the way.&#x20;

### Syntax

```bash
traceroute [options] <destination> [packet_length]
```

### Basic Usage

* **Trace route to a destination (default UDP method)**

  ```bash
  traceroute example.com
  ```
* **Use ICMP Echo Request instead of UDP**

  ```bash
  traceroute -I example.com
  ```
* **Use TCP SYN packets (default port 80)**

  ```bash
  traceroute -T example.com
  ```
* **Use UDP with a specific destination port (e.g., 53 for DNS)**

  ```bash
  traceroute -U -p 53 example.com
  ```

### Controlling TTL & Queries

* **Set the initial TTL (starting hop)**

  ```bash
  traceroute -f 5 example.com
  ```

  (Starts tracing from hop 5 instead of 1.)
* **Set the maximum number of hops**

  ```bash
  traceroute -m 50 example.com
  ```

  (Stops tracing after 50 hops.)
* **Set the number of probes per hop**

  ```bash
  traceroute -q 5 example.com
  ```

  (Sends 5 probes instead of the default 3.)

### Output Customization

* **Disable hostname resolution (numeric IPs only)**

  ```bash
  traceroute -n example.com
  ```
* **Show AS (Autonomous System) numbers**

  ```bash
  traceroute -A example.com
  ```
* **Increase wait time for each response (default: 5 seconds)**

  ```bash
  traceroute -w 10 example.com
  ```

### Performance & Routing Options

* **Specify a source IP or interface**

  ```bash
  traceroute -s 192.168.1.100 example.com
  ```

  ```bash
  traceroute -i eth0 example.com
  ```
* **Bypass normal routing and send packets directly**

  ```bash
  traceroute -r example.com
  ```
* **Set a minimum delay between probes**

  ```bash
  traceroute -z 5 example.com
  ```

  (Sends probes with a 5-second gap.)

### Advanced Options

* **Enable packet fragmentation (or prevent it)**

  ```bash
  traceroute -F example.com  # Do not fragment
  ```
* **Trace route using a raw protocol (e.g., DCCP, UDP-Lite)**

  ```bash
  traceroute -D example.com  # DCCP
  traceroute -UL example.com  # UDP-Lite
  ```
* **Discover MTU along the path**

  ```bash
  traceroute --mtu example.com
  ```

### Examples

1. **Basic traceroute with numeric output**

   ```bash
   traceroute -n google.com
   ```
2. **ICMP-based traceroute**

   ```bash
   traceroute -I google.com
   ```
3. **TCP-based traceroute on port 443**

   ```bash
   traceroute -T -p 443 google.com
   ```
4. **Tracing a route with AS number lookups**

   ```bash
   traceroute -A google.com
   ```
