How to find the initial values of TTL for your current operating system

pingtraceroutettl

In this answer to a question related to interpreting the values of TTL from a ping operation it is said that the TTL values vary depending on the operating system. I understood more or less the purpose of TTL, which is basically used to prevent loops in the network. At each hop, that value is decremented, and when it reaches 0, the packet, if not arrived at destination, is dropped. I am not sure if this value is really associated with the operating system or with the actual router or modem, or something else. Please, explain me this.

My question is: how can I find those initial values? It would be nice if someone gives an exhaustive answer (i.e. both for Windows and Unix-based OSs, and maybe using the terminal or some other interface) .

A workaround could be to ping, and see the ttl value, and then to traceroute, and count the number of hops, but it could not be precise enough…

Best Answer

Packets sent to localhost don't go over any hops so the ttl shown will be the starting value.

Windows 10

C:\>ping -4 localhost 

Pinging Win10Main [127.0.0.1] with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
....

OpenWrt 15.05

root@OpenWrt:~# ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: seq=0 ttl=64 time=0.283 ms
...