TTL.md
 1  ## TTL (Time to Live)
 2  
 3  **What it is:**
 4  TTL is a mechanism to prevent data packets from endlessly circulating on a network. It acts as a countdown timer for each packet.
 5  
 6  **How it works:**
 7  1. **Initial Value:** Each packet starts with a TTL value, usually set by the sending device.
 8  2. **Decrementing:** Every time the packet passes through a router (a network hop), the TTL value is decreased by 1.
 9  3. **Expiration:** 
10      - If the TTL reaches 0 before reaching its destination, the router discards the packet.
11      - This prevents packets from looping indefinitely in case of routing errors.
12  
13  **Why it's important:**
14  - **Prevents network congestion:**  Stops lost or undeliverable packets from clogging the network.
15  - **Security measure:**  Can help mitigate certain types of denial-of-service attacks.
16  
17  **Key points:**
18  - TTL is measured in hops, not time units.
19  - Different operating systems have different default TTL values.
20  - Can be used for network diagnostics (e.g., traceroute).