How to change TTL to 65 on 4G router?

The default TTL value on the 4G router is 64. In some conditions, we need to change the TTL value to 65. The TTL parameter is controlled by /etc/sysctl.conf. We can edit the “sysctl.conf” file via SSH terminal or WinSCP software.

After connected to the 4G router, access the router admin. Go to “System > Terminal” to access the SSH interface on the web page. We can also use PuTTY software to access the SSH interface.

Input the below command and press enter to check the current TTL value. If the return value includes “TTL=64”, follow the below steps to change the TTL value.

ping -c 3 localhost

Step 1 - Edit TTL on sysctl.conf

  1. Use the below command to open the configure file.
    vi /etc/sysctl.conf 
  2. Find a free line, and hit “Insert” on the keyboard to edit the configure file.
    Note: On a Mac computer, use Fn+i or Fn+Command+Return to insert a new line. 
  3. Add the below content on the free line.
  4. Hit “ESC” on the keyboard to stop editing
  5. Input “:wq” to save the configuration file and quit the VI editor.
  6. Reboot the router
  7. Use the above “ping -c 3 localhost” command to verify the TTL value.
Video Tutorial

Step 2 - Add Custom Firewall Rule

After logging into the router’s admin panel.
Navigate to “Network > Firewall.” Click the “Custom Rules” tab. Add the below scripts to the end of the input box.

iptables -t mangle -I POSTROUTING -o wwan0 -j TTL --ttl-set 65

If using the Mobile 4G-PPP protocol, use the below script.

iptables -t mangle -I POSTROUTING -o 3g-MOBILE -j TTL --ttl-set 65

Other TTL Values

In some oscillations, the TTL value needs to use the other value, such as 128.
To set the TTL value to 128, replace 65 with 128 on the above step 1 and 2.

Related Articles