Skip to content

Instantly share code, notes, and snippets.

@weirded
Created October 26, 2020 21:29
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save weirded/f49ac134aecbd32b71ab22619c7496ab to your computer and use it in GitHub Desktop.
Save weirded/f49ac134aecbd32b71ab22619c7496ab to your computer and use it in GitHub Desktop.

Steps to enable TTL modification on Franklin T9:

  1. Read this blog
  2. Based on the blog, enable SSH.
  3. Once SSH is enabled, place this file in /etc/init.d/set_ttl:
#!/bin/bash
### BEGIN INIT INFO
# Provides:		ttl
# Required-Start:	$remote_fs $syslog $networking
# Required-Stop:	$remote_fs $syslog
# Default-Start:	2 3 4 5
# Default-Stop:		1
# Short-Description:	Set TTL in iptables
### END INIT INFO

TTL=66
INTERFACE=rmnet_data0

case "$1" in
  start)
	echo "Setting TTL on $INTERFACE to $TTL..."
	ip6tables -t mangle -I POSTROUTING -o $INTERFACE -j HL --hl-set $TTL
	ip6tables -t mangle -I PREROUTING -i $INTERFACE -j HL --hl-set $TTL
	iptables -t mangle -I POSTROUTING -o $INTERFACE -j TTL --ttl-set $TTL
	iptables -t mangle -I PREROUTING -i $INTERFACE -j TTL --ttl-set $TTL
	;;
  *)
	echo "$1 is not implemented"
	;;
esac

exit 0
  1. Adjust TTL to the value you desire
  2. chmod 755 /etc/init.d/set_ttl
  3. cd /etc/rc5.d/; ln -s ../init.d/set_ttl S99set_ttl
  4. reboot

If you upgrade firmware, this will need to be redone.

@ftt1211
Copy link

ftt1211 commented Dec 31, 2023

those script commands didn't work for me. Here's mine that worked instead:

#!/bin/bash

BEGIN INIT INFO

Provides: ttl

Required-Start: $remote_fs $syslog $networking

Required-Stop: $remote_fs $syslog

Default-Start: 2 3 4 5

Default-Stop: 1

Short-Description: Set TTL in iptables

END INIT INFO

case "$1" in
start)
iptables -t mangle -I POSTROUTING 1 -j TTL --ttl-set 65
;;
*)
echo "$1 is not implemented"
;;
esac

exit 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment