Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

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.

@drecha
Copy link

drecha commented Dec 14, 2020

Tried your steps, but no change to the TTL.

Please confirm that I only need to adjust the TTL value in one place on the script correct?

Where is says:

TTL=66
INTERFACE=rmnet_data0

I set mine to 65 and no change to the data cap of 5mb. Also, noticed quite a few other folders in the etc folder. Are you sure it goes in the rc5.d folder?

@xfgavin
Copy link

xfgavin commented Dec 18, 2020

Thank you for sharing. I found some results:
Carrier: Visible
with script: client was capped at 5MB/s
without script: client can go >10MB/s

Carrier: Cricket
with script: client was capped at 5MB/s
without script: client was capped <20KB/s
Interestingly, I only got 3G using cricket SIM.

@drecha
Copy link

drecha commented Dec 18, 2020

Set TTL as 64.

Visible:
Without Script 5MB/5MB
With Script 25MB/25MB

@xfgavin
Copy link

xfgavin commented Dec 19, 2020

No luck for me. Anything else did you tweak? APN? etc?

@drecha
Copy link

drecha commented Dec 19, 2020

Visible APN:
VSBLINTERNET
IPV4 only

Are you sure you did the script correctly?

First, I made a file in notepad with the specified script and named it S99set_ttl.txt

You only need to copy the script beginning with:

#!/bin/bash

...and ending with:

exit 0

Then I used PuTTY and WinSCP to drag and drop this file directly into the etc/rc5.d/ folder on the device. I then renamed it to remove the .txt from the file name and then right-clicked, select Properties, and gave it 755 rights. Then rebooted.

Much easier than following all the original steps.

@xfgavin
Copy link

xfgavin commented Dec 19, 2020

Thanks.
Positively, I've confirmed by pinging a target. I might have weak signal, I tried my sim card in my phone and got similar result. It's a bit weird though.

@sundown994
Copy link

sundown994 commented Dec 19, 2020

im a little stumped on the configuration.

Do I change where it says
TTL=66
INTERFACE=rmnet_data0

and make it like
echo "Setting TTL on $INTERFACE to $TTL=65"
ip6tables -t mangle -I POSTROUTING -o $INTERFACE -j HL --hl-set $TTL=65
ip6tables -t mangle -I PREROUTING -i $INTERFACE -j HL --hl-set $TTL=65
iptables -t mangle -I POSTROUTING -o $INTERFACE -j TTL --ttl-set $TTL=65
iptables -t mangle -I PREROUTING -i $INTERFACE -j TTL --ttl-set $TTL=65

I cant get it to stick for some reason

@drecha
Copy link

drecha commented Dec 19, 2020

No only change it in one place:

TTL=64
INTERFACE=rmnet_data0

.....and reboot to apply the changes.

@sundown994
Copy link

sundown994 commented Dec 19, 2020

No only change it in one place:

TTL=64
INTERFACE=rmnet_data0

.....and reboot to apply the changes.

I did that as well, and I get this

64 bytes from 192.168.0.1: icmp_seq=0 ttl=64 time=1.388 ms
64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=1.893 ms
64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=1.329 ms
64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=1.304 ms
64 bytes from 192.168.0.1: icmp_seq=4 ttl=64 time=1.310 ms
64 bytes from 192.168.0.1: icmp_seq=5 ttl=64 time=1.690 ms

I am trying to set it to 65, so I replaced the 64 with a 65

@drecha
Copy link

drecha commented Dec 19, 2020

Are you connecting directly to the Franklin T9 device or you have a router connected to it?

@sundown994
Copy link

sundown994 commented Dec 19, 2020

@drecha
Copy link

drecha commented Dec 19, 2020

Did you follow the instructions I sent?

First, I made a file in notepad with the specified script and named it S99set_ttl.txt

You only need to copy the script beginning with:

#!/bin/bash

...and ending with:

exit 0

Then I used PuTTY and WinSCP to drag and drop this file directly into the etc/rc5.d/ folder on the device. I then renamed it to remove the .txt from the file name and then right-clicked, select Properties, and gave it 755 rights. Then rebooted.

@drecha
Copy link

drecha commented Dec 19, 2020

What are you connected to over USB? A desktop or a router?

@drecha
Copy link

drecha commented Dec 19, 2020

Try to see what speeds you get over WiFi

@sundown994
Copy link

sundown994 commented Dec 19, 2020

@drecha
Copy link

drecha commented Dec 19, 2020

You probably need to change the TTL on the desktop. If it’s Windows 10:

Open Registry Editor (regedit.exe).
From the HKEY_LOCAL_MACHINE subtree, go to the following key: \SYSTEM\CurrentControlSet\Services\Tcpip\Parameters.
In the right pane, add the following value: Name: DefaultTTL. Type: REG_DWORD. Valid Range: 1-255. (Try 64 or 65)
After that, please restart the computer and check the result.

@sundown994
Copy link

sundown994 commented Dec 19, 2020

@drecha
Copy link

drecha commented Dec 19, 2020

I just configure another Test Drive Hotspot device from scratch and I’m getting 25/25mb with Visible after the script!

So, if you’re using Visible, it will work if you follow the steps. Again I’ve only used both of these with Visible.

@ghostyroasty
Copy link

ghostyroasty commented Jan 23, 2021

I just configure another Test Drive Hotspot device from scratch and I’m getting 25/25mb with Visible after the script!

So, if you’re using Visible, it will work if you follow the steps. Again I’ve only used both of these with Visible.

To use with Visible, do you need to alter the imei of the t9?

@drecha
Copy link

drecha commented Jan 23, 2021

No need to change the IMEI.

@ghostyroasty
Copy link

ghostyroasty commented Jan 23, 2021

No need to change the IMEI.

Good to know, thanks!!! Now to find a party pay group.

@ghostyroasty
Copy link

ghostyroasty commented Jan 27, 2021

No need to change the IMEI.

Well I tried and after using it once, the firmware upgraded. I downgraded back to 891 and now I have no service on the Franklin. If I transfer the card over to a phone, all is well.

@numberlstunna
Copy link

numberlstunna commented Mar 3, 2021

Will the TTL change work without USB tether? Can you connect to T9 via wireless and have the TTL @ 65?

@espinola17
Copy link

espinola17 commented May 11, 2021

I just configure another Test Drive Hotspot device from scratch and I’m getting 25/25mb with Visible after the script!

So, if you’re using Visible, it will work if you follow the steps. Again I’ve only used both of these with Visible.

are you able to help me modify ttl settings? New to coding and i've unlocked my T9 and can access root of device via wifi using mac terminal but struggling on what to do next. I created a file with the code you mentioned but I don't know how to properly code in terminal to move the file to the Franklin T9

@nmz787
Copy link

nmz787 commented Dec 29, 2021

on firmware 891, ifconfig doesn't show rmnet_data0 but rather rmnet0, and when I tried pasting in the comment you made on snt.sh, neither the iptable nor ip6tables commands work (I get an error message telling me to check the syntax in the help info, i.e. -h). Should I change my adapter interface to rmnet0 or is rmnet_data0 correct (I'm not an iptables wiz)?

Edit: after playing with various options, I found rmnet_data0 did work. Here's what I finally ended up with:

~ # cat /etc/rc5.d/S99set_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=64
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

@letthelightin
Copy link

letthelightin commented Mar 29, 2022

I can't get this script automatically running on firmware 891. I confirm to see what rules are active via commands:

iptables -L PREROUTING -t mangle
iptables -L POSTROUTING -t mangle

ip6tables -L PREROUTING -t mangle
ip6tables -L POSTROUTING -t mangle

The commands function great when manually run via SSH.

Any ideas?

edit1:

less /var/log/boot

Tue Mar 29 19:50:01 2022: Starting powerconfig for mdm9607: /etc/init.d/rc: line 174: /etc/rc5.d/S99set_ttl: not found

edit2: solved - issue was with a return character in the script file

https://confluence.atlassian.com/kb/starting-service-on-linux-throws-a-no-such-file-or-directory-error-794203722.html

sed -i -e 's/\r//g' /etc/init.d/set_ttl

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