Change output TTL from all lan packet to wan

Hi all
I want to specify that all outgoing packets have a specific TTL. Eg Windows 10 to a TTL of 128 (ping-4 localhost ) give 128 but I don't want 128 but an other one.

do you know if this command is good ( where usb0 is the wan interface and XX the specific TTL )

iptables -t mangle -I POSTROUTING -o usb0 -j TTL --ttl-set XX

are there a way to verifiy outgoing ttl ?

thanks

ok iptables-mod-ipopt is the key :slight_smile:

Yes, if you wish to mangle the packet. Although, this may cause problems for utilities like PING and TRACEROUTE.

To do this for the system (and all interfaces, unfortunately), you would change the sysctl setting:

sysctl net.ipv4.ip_default_ttl=xxx

In LEDE, the file to make such permanent changes is found at: /etc/sysctl.conf

1 Like

for actual masking of ttl.

iptables -t mangle -A PREROUTING -j TTL --ttl-set 65

this will cause packet count to drop 1 number before hitting the first internet server(your provider) 64 is the number you are looking for