I need to change the default TTL of TCP/IP packets sent from my Ubuntu computer. I found the solution for Windows:

  1. To make reg-file:

    Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\servic es\Tcpip\Parameters]
    "DefaultTTL"=dword:00000081
    
  2. To execute this commands in console:

    netsh int ipv4 set glob defaultcurhoplimit=129
    netsh int ipv6 set glob defaultcurhoplimit=129
    

The question is how should I translate this solution for Ubuntu?

up vote 11 down vote accepted

To change the default TTL of TCP/IP packets sent from your Linux computer you can run the following command:

sudo sysctl 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.