Take the 2-minute tour ×

I have following startup (Administration-Commands-Startup script) script in my dd-wrt router

iptables -t mangle -I POSTROUTING -o `get_wanface` -j TTL --ttl-set 128

However it does not work. I suppose startup script run when iptables is not working yet. Are there any way to set ttl every time when router starts?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

iptables with that command does not set ttl at router start-up

it sets the ttl for "every" packet at POSTROUTING that means when exiting the routing engine...

share|improve this answer
What do you mean? Sorry, I am not so good with iptables. What I want to say is that command does not work from startup script, however it works when I run it after router started from ssh session. –  misha nesterenko Dec 15 '12 at 15:26
iptables is an interface to the kernel net-filter/router engine, then the command you mention tells the kernel net-filter/router that for every net packet that leaves the routing engine "mangle" (manipulate/set) the TTL field to a certain value. Remeber it is the kernel who does the things, iptables is the way you tell the kernel what to do with the packets. When the init script is run the kernel is already working then try to see if the command is well conformed and really present on a script that is really run on init –  Pat Dec 15 '12 at 20:01
How can I get current ttl value from iptables? –  misha nesterenko Dec 16 '12 at 10:23
you have to list iptables tables i.e "iptables iptables -nL -v --line-numbers -t mangle" –  Pat Dec 16 '12 at 13:30

Your Answer


