The definitive guide on hacking the Nexus 4, part 6: How to fix LTE Wifi tethering or hotspot
The definitive guide on hacking the Nexus 4, part 6
Legal disclaimer: We are not responsible for any damage or loss to your device or computer system. Therefore, should you decide to follow these steps, you do so at your own risk and peril and agree to hold us harmless from any damage or loss you may experience. Should you disagree with the foregoing, please do not read any further.
Why is wifi hotspot broken when you’re using LTE?
If you haven’t noticed already, wifi hotspot works when you’re connected to 3G, but it doesn’t work when you’re using LTE. For a while, it was suggested that Robelus blocked tethering when LTE is activated, but in fact it has nothing to with Robelus. What’s the problem? It’s the firewall. Tethering doesn’t work on LTE because of the configuration of the internal firewall in Android (as this phone was never supposed to have LTE). Therefore, in order to fix this, we just need to correct the firewall rules. As Android is based on linux, the firewall rules are all command line based and the syntax is quite complicated (as you can see here). If you’re interested, there are many front ends that allows you to create firewall scripts for linux, such as this, this and this. Unless you’re a linux sysadmin that works with firewalls on a regular basis, I wouldn’t bother trying to figuring this out on your own. Luckily for us, some clever person on XDA figured it out the firewall rules for us. It only takes one.
There are various different ways to permanently fix the LTE tethering issue. One way is if you have a custom kernel installed, you can add a shell script to /system/etc/init.d. However, we’re going to take a slightly different approach by installing an Android app which we’re going to tell it to run a script on every boot. The script will configure the correct firewall rules. The source of the below information was found on this thread at XDA. After executing the firewall script, LTE wifi tethering started working immediately for us.
How to permanently fix LTE wifi hotspot
1) Download and install this app called Script Manager – SManager (free).
2) Send yourself an email (that can easily be accessed from your phone) with the following text in the content of the email. Try to avoid blank spaces at the beginning and at the end of the lines.
#!/system/bin/sh iptables -A bw_FORWARD -i !lo+ iptables -A natctrl_FORWARD -j RETURN -i rmnet+ -o wlan0 -m state --state RELATED,ESTABLISHED iptables -A natctrl_FORWARD -j DROP -i wlan0 -o rmnet+ -m state --state INVALID iptables -A natctrl_FORWARD -j RETURN -i wlan0 -o rmnet+ iptables -A natctrl_FORWARD -j DROP iptables -A natctrl_nat_POSTROUTING -t nat -o rmnet+ -j MASQUERADE
3) Open up that email on your phone and copy the contents of the email.
4) Open SManager and you should see something like below. We’re going to enable Root access for SManager. Click on “…” and select “More” then “Advanced” then select “Mount /system rw“, push “Ok”.
5) Go back to the “Advanced” menu and select “Configuration”, tick the checkboxes below.
6) We’re going to create a new script in the next few steps, but before we do that. Navigate to /system/app/ as we had some difficulty setting the correct permissions for the script in various other folders (not sure why that is). Once you’re at /system/app/ click on “…” and select “New Script“.
7) You will see the screen below, type in a name, such as “lte” and push “Ok”.
8) If you get a “DANGER!!!” warning screen, just push “Brick”. Don’t worry about the warning. It’s just saying that you’re trying to modify a Read-only directory. It may request Root access afterwards.
9) On the next screen, choose “Open Directly”.
10) Select your favorite text editor, we’re going to use SM Editor.
11) You should now see a screen like below.
12) Paste the content of the email inside this text editor. It should look something like below.
13) Navigate to /system/app/ again and long press the lte file that you created. Select “Properties”
14) Check all of the boxes just to make sure that it has sufficient privileges (this is equivalent to chmod 777 in linux) and push “Apply” then “Close”. Long press the lte file again to make sure that the permissions have “stuck”. The file’s icon should change now.
15) Click on the icon for lte and you should see something like below.
16) Click on “Su” (which means superuser or Root) then click “Boot” (to make it run on boot), select “Is executable” then push “Save”
17) The icon for “lte” should change again to the “Su” and “Boot” icons in the screen above. Reboot your phone and LTE wifi tethering should work. If you have any questions or require any clarifications, please leave a comment below and we’ll get back to you. In part 7, we’ll discuss how to go back to stock Android 4.22.