TTL in Windows and Linux
Created: 2024-09-25 03:02:35 | Last modified: 2024-09-25 03:49:17
Access: Read | Views: 13 | Rating: N/A | Tags:
How to resolve an issue with traceroutes not completing in Linux when it works in Windows.
We had a problem when installing an LTE router for external access to a Linux machine. What we were experiencing was that with one SIM from one provider, the traceroute would complete and when using a SIM from another provider the traceroute would timeout and we couldn't ping the destination. We also found that it would work with both SIMs and providers when using a windows PC to test.

What we found was that the distance and time between providers were different, we originally thought it was an MTU issue, but looking further was an issue with TTL. What was happening was that the TTL was expiring before the traceroute could complete, the reason for this is that default TTLs are different for Linux (64ms), Windows (128ms) and network devices (255ms).
Default Values
Operating System |
Value (ms) |
Windows |
128 |
Linux |
64 |
Network (e.g. router) |
255 |
Windows
To edit the TTL in Windows open regedit;
# Go to
HKEY_LOCAL_MACHINE => System => CurrentControlSet => Services => Tcpip => Parameters
# Create a new key
Type: DWORD
Name: DefaultTTL
Value: 128 (or whatever value you would like)

Linux
To edit the default TTL on Linux (Ubuntu)
# Set to test (replace 128 with the required value)
sudo sysctl -w net.ipv4.ip_default_ttl=128
# To make it permanent
vim /etc/sysctl.conf
# Add the following
net.ipv4.ip_default_ttl=128