How to change the default TTL of TCP/IP packets?
Solution 1:
To change the default TTL of TCP/IP packets sent from your Linux computer you can run the following command:
sudo sysctl -w net.ipv4.ip_default_ttl=129
Or:
echo 129 | sudo tee /proc/sys/net/ipv4/ip_default_ttl
Or:
sudo bash -c 'echo 129 > /proc/sys/net/ipv4/ip_default_ttl'
But you have to run one of those commands whenever the computer boots. To make this setting persistent across reboots you could append the following line to the file /etc/sysctl.conf
:
net.ipv4.ip_default_ttl=129
You should do the same with ipv6
instead of ipv4
if you want to change the settings for ipv6 as well.