TTL and HL settings and how they help when modified
Posted: Sun Jun 06, 2021 11:22 am
I am going to make this one as short as I can, and hopefully it can still help many without everyone needing to repeat this information over and over again.
Note: If you respond to this post with anything that does not help the “article” it will be deleted. Please do not ask questions about your device. Please read thoroughly. This is a tutorial post, not a post for you to get support with your setup. Go to the Questions and Support sections for that.
What is TTL?
TTL stands for "Time to Live" and in short is simply a decremental count of how many times a interwebz packet of data jumps from one device to the next to get to its destination. TTL is only for IPV4 protocol (nerd talk).
Your phone or router or computer, etc, will create a "packet" of data that is to be sent to somewhere that you are communicating with, like the google.com servers, so that you can receive information back. TTL number is one piece of information, in a simple number format, that your device places inside that packet.
Different device types (phone, PC, etc) will assign a number to the TTL value by default.
The computer then sends the packet away to be received at your computers chosen end point. Every device the packet goes through (like a router) to get to the end destination (remember, google servers to find out what kind of snake that was ) will subtract a count of 1 (one) away from the current TTL value. This is called decrementing. So if the original value was 255, and the packet went through a single router, the TTL value then becomes 254.
Every single device that your packet "hops" through will remove a value of 1 (one) from the packets current TTL value.
The reason TTL is there is to stop the packet for jumping around the world wide web literally forever. Once the number reaches 0 (zero) the packet is killed off by the device that gets the priviledge of docking the packets TTL from 1 to 0.
That is about it. The super nerdy details may not be ultra-precise, but you get the point.
What is HL?
HL stands for "Hop Limit" and is the exact same thing as TTL, but for IPV6 protocol only. It is it's own parameter in the packet, and decrements by 1 (one) for every "hop" as well.
The IPV6 HL seems to be where many have found they had data monitoring “leaking”. Once they set the HL value, the hotspot data seemed to stop getting counted.
Why does TTL and HL matter to some of us?
TTL and HL are a parameter in the packet that some cellular network operators around the world use in order to determine whether or not the device that sent the packet is a cellular phone, or tablet, or a device using that cellular phone, or tablets, hotspot function.
As we in some places around the world, like the USA, know, cellular hotspot data use is EXPENSIVE.
Until the cellular carriers stop gouging it's customers over data use, we have to ensure we are NOT often using our hotspot data.
TTL and HL settings manipulation can, in some cases, work around this little metric. Allowing someone to use a PC over a cellular connection, and not get charged tons of ridiculous money for going over their hotspot data allotment for the month.
Does this work for all carriers, everywhere?
No. you have to try it to find out, or do a simple search around to find out.
Currently it seems, in the US, AT&T and Sprint do not use TTL/HL for hotspot data monitoring. They seem to use a specific APN for monitoring hotspot use.
What number do I set to do this?
That depends on the network operator, and your location. Some cellular companies use one number on the west coast, and another similar number on the east coast.
Different numbers can work, but the most common are 64, 65, and 117. Sometimes you have to try these, or even 1 or 2 above or below. This is for both TTL and HL.
So far it seems 117 works only with Verizon based networks.
64 and 65 seems to be the most common with T-Mobile and Verizon, and Verizon MVNOs.
How do I set my TTL and HL?
That depends on your device. The TTL and HL can be manipulated in the firewall iptables and ip6tables rules.
The devices I deal with the most are openWRT based and have the ability to use a the mangle function of the iptables and ip6tables commands. All the openWRT based routers on The Wireless Haven can do this. If your device can not use the mangle function of iptables or ip6tables I can’t help you. You typically need only a single device on your network that can do this, so you may need to add a simple router between your network and your internet connection. This tutorial isn’t being written to cover which devices can and cant do this, and how to do it when you can’t, etc, etc.
In the popular firmware branch of openWRT called Rooter (or Goldenorb) you can set custom rules under the Network menu item “Firewall”. On the main Firewall page there are tabs along the top. One of these tabs says “Custom Rules”. Go in there.
Note: Do not use, or enable, the “Custom TTL” tab. It typically does not set the IPV6 HL.
In the text box on this page you can place your iptables mangle rules.
Other devices may have other interfaces to do this. Some have a simple interface that allows you to just enter a number for TTL and HL and it does the rules for you.
What rules do we use?
The perfect rules are up for debate, but here are my exact rules I use on all my routers that I need this for:
I paste this in the appropriate location and save and apply, or in some cases “Reset Firewall”.
These rules can also be set via CLI if you like, obviously just the iptables/ip6tables lines. If you don’t know what CLI is, you don’t need to be doing it.
Will this always work this way?
Not at all. The networks are always trying to use ways to make sure they can charge us maximum dollar for data. So this may be completely outdated as quickly as the moment after I post this.
Good luck with yours!
Note: If you respond to this post with anything that does not help the “article” it will be deleted. Please do not ask questions about your device. Please read thoroughly. This is a tutorial post, not a post for you to get support with your setup. Go to the Questions and Support sections for that.
What is TTL?
TTL stands for "Time to Live" and in short is simply a decremental count of how many times a interwebz packet of data jumps from one device to the next to get to its destination. TTL is only for IPV4 protocol (nerd talk).
Your phone or router or computer, etc, will create a "packet" of data that is to be sent to somewhere that you are communicating with, like the google.com servers, so that you can receive information back. TTL number is one piece of information, in a simple number format, that your device places inside that packet.
Different device types (phone, PC, etc) will assign a number to the TTL value by default.
The computer then sends the packet away to be received at your computers chosen end point. Every device the packet goes through (like a router) to get to the end destination (remember, google servers to find out what kind of snake that was ) will subtract a count of 1 (one) away from the current TTL value. This is called decrementing. So if the original value was 255, and the packet went through a single router, the TTL value then becomes 254.
Every single device that your packet "hops" through will remove a value of 1 (one) from the packets current TTL value.
The reason TTL is there is to stop the packet for jumping around the world wide web literally forever. Once the number reaches 0 (zero) the packet is killed off by the device that gets the priviledge of docking the packets TTL from 1 to 0.
That is about it. The super nerdy details may not be ultra-precise, but you get the point.
What is HL?
HL stands for "Hop Limit" and is the exact same thing as TTL, but for IPV6 protocol only. It is it's own parameter in the packet, and decrements by 1 (one) for every "hop" as well.
The IPV6 HL seems to be where many have found they had data monitoring “leaking”. Once they set the HL value, the hotspot data seemed to stop getting counted.
Why does TTL and HL matter to some of us?
TTL and HL are a parameter in the packet that some cellular network operators around the world use in order to determine whether or not the device that sent the packet is a cellular phone, or tablet, or a device using that cellular phone, or tablets, hotspot function.
As we in some places around the world, like the USA, know, cellular hotspot data use is EXPENSIVE.
Until the cellular carriers stop gouging it's customers over data use, we have to ensure we are NOT often using our hotspot data.
TTL and HL settings manipulation can, in some cases, work around this little metric. Allowing someone to use a PC over a cellular connection, and not get charged tons of ridiculous money for going over their hotspot data allotment for the month.
Does this work for all carriers, everywhere?
No. you have to try it to find out, or do a simple search around to find out.
Currently it seems, in the US, AT&T and Sprint do not use TTL/HL for hotspot data monitoring. They seem to use a specific APN for monitoring hotspot use.
What number do I set to do this?
That depends on the network operator, and your location. Some cellular companies use one number on the west coast, and another similar number on the east coast.
Different numbers can work, but the most common are 64, 65, and 117. Sometimes you have to try these, or even 1 or 2 above or below. This is for both TTL and HL.
So far it seems 117 works only with Verizon based networks.
64 and 65 seems to be the most common with T-Mobile and Verizon, and Verizon MVNOs.
How do I set my TTL and HL?
That depends on your device. The TTL and HL can be manipulated in the firewall iptables and ip6tables rules.
The devices I deal with the most are openWRT based and have the ability to use a the mangle function of the iptables and ip6tables commands. All the openWRT based routers on The Wireless Haven can do this. If your device can not use the mangle function of iptables or ip6tables I can’t help you. You typically need only a single device on your network that can do this, so you may need to add a simple router between your network and your internet connection. This tutorial isn’t being written to cover which devices can and cant do this, and how to do it when you can’t, etc, etc.
In the popular firmware branch of openWRT called Rooter (or Goldenorb) you can set custom rules under the Network menu item “Firewall”. On the main Firewall page there are tabs along the top. One of these tabs says “Custom Rules”. Go in there.
Note: Do not use, or enable, the “Custom TTL” tab. It typically does not set the IPV6 HL.
In the text box on this page you can place your iptables mangle rules.
Other devices may have other interfaces to do this. Some have a simple interface that allows you to just enter a number for TTL and HL and it does the rules for you.
What rules do we use?
The perfect rules are up for debate, but here are my exact rules I use on all my routers that I need this for:
Code: Select all
# A Hashtag is in place if not using that line.
# Popular TTL values: 64 for Visible. 65 for Verizon, ATT and Tmobile. 117 is sometimes a working TTL for Verizon.
# When changing values, first place # on all the TTL value lines beginning, like this line itself has. Then click Restart Firewall.
# Then change all of the TTL values to what you need and then delete the #s at their lines beginning.
# Then click Restart Firewall. Changes should then be applied properly.
# Start-IP6-TTL-Fix
ip6tables -t mangle -I POSTROUTING -o wwan0 -j HL --hl-set 65
# End-IP6-TTL-Fix
# Start-IP4-TTL-Fix
iptables -t mangle -I POSTROUTING -o wwan0 -j TTL --ttl-set 64
# End-IP4-TTL-Fix
I paste this in the appropriate location and save and apply, or in some cases “Reset Firewall”.
These rules can also be set via CLI if you like, obviously just the iptables/ip6tables lines. If you don’t know what CLI is, you don’t need to be doing it.
Will this always work this way?
Not at all. The networks are always trying to use ways to make sure they can charge us maximum dollar for data. So this may be completely outdated as quickly as the moment after I post this.
Good luck with yours!