The definitive guide on hacking the Nexus 4, part 6: How to fix LTE Wifi tethering or hotspot

solar

The definitive guide on hacking the Nexus 4, part 6
This is part 6 of an 8 part series of articles on the Nexus 4. This guide assumes that you have successfully rooted your phone (part 2) and that you have enabled LTE (part 5). This guide will describe how to get LTE wifi tethering or hotspot working on the Nexus 4 running Android 4.2.2.

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).

Screenshot_2013-02-24-04-49-24

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”.

Screenshot_2013-02-24-04-56-05

Screenshot_2013-02-24-04-56-09

5) Go back to the “Advanced” menu and select “Configuration”, tick the checkboxes below.

Screenshot_2013-02-24-04-56-16

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“.

Screenshot_2013-02-24-04-53-36

7) You will see the screen below, type in a name, such as “lte” and push “Ok”.

Screenshot_2013-02-24-04-53-45

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.

firewall3

9) On the next screen, choose “Open Directly”.

firewall2

10) Select your favorite text editor, we’re going to use SM Editor.

firewall1

11) You should now see a screen like below.

firewall4

12) Paste the content of the email inside this text editor. It should look something like below.

Screenshot_2013-02-24-04-54-48

13) Navigate to /system/app/ again and long press the lte file that you created. Select “Properties

Screenshot_2013-02-24-04-55-25

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.

Screenshot_2013-02-24-04-55-37  

15) Click on the icon for lte and you should see something like below.

script1

16) Click on “Su” (which means superuser or Root) then click “Boot” (to make it run on boot), select “Is executable” then push “Save”

script2

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.

  • James

    Do you have a fix for the Google Now issues when LTE is enabled? Thanks.

    • Hippowise

      Google Now still works if you have GPS enabled and if you’re outdoors. I haven’t seen a workaround for this limitation yet.

  • Marc Andrews

    Thanks for this tutorial!

    My ROM supports init.d scripts so I’ve put those 6 iptables lines in a script in /system/etc/init.d/ with 755 permissions. When I run it with Script Manager, it works, but when it runs at boot (and I can confirm that it does run), it still does not fix LTE tethering. Any ideas?

  • chris

    One question, you have this written in step6
    “Once you’re at /system/app/ click on “…” and select “New Script“.”

    But the picture shows you are under storage/emulated/
    Just a bit confused

    • Hippowise

      The written instructions are correct. Therefore, please ignore “storage/emulated” in the screenshot. I was in the wrong directory when i took the screenshot. Sorry about that.

      • chris

        ah crap. is it ok to just delete the “lte” file and recreate then under storage/app/ ?

      • chris

        Ok so i followed the pictures. i went to delete the file, however i cannot find it. Suggestions??

        • Hippowise

          if you click on the “…”, various buttons should appear at the bottom of the screen, click “Scripts”, click on the lte file, then click “delete config” and it should be deleted. You can really put the LTE file anywhere, i just had trouble getting it to run properly at certain locations. I couldn’t get the file permissions to “stick”. That’s the only reason that I recommend that you create the lte file in /system/app as that’s where all of the apps are located so it’s normal that files are “executable” there.

  • all_black_nexus

    Thanks so much! Can I uninstall SManager after completing this tutorial, or do I need to keep it in order for this to continue to work?

    • Hippowise

      I’m pretty sure that you need to keep smanager installed to keep the script running.

  • http://joinowr.com Matt Wilkins

    Does this have to be repeated every time a ROM is refreshed example updating Cyanogenmod. Only ask because I know that Cm overwrites build.prop which means the other fix you mentioned has to be repeated every time.

    • Hippowise

      I don’t know about other ROMs, but I know that you don’t need to redo the steps to permanently enable LTE if you’re updating cyanogenmod. I used to update cyanogenmod whenever a new release was available, so I may have updated cyanogenmod over 10x times in the last month and I never had to redo the steps to re-enable LTE. I’ve rebooted my phone many times as well and LTE always came up afterwards.

      • http://joinowr.com Matt Wilkins

        I just did the latest CM nightly build update and it looks like CM does overwrite build.prop. The tethering script and APN settings (I didn’t go as far as to change the XML file) survived.

        • Hippowise

          Did you update CM from settings > about phone? I don’t know what to say. I’ve updated CM countless times and I’ve never lost LTE or LTE tethering.

          • http://joinowr.com Matt Wilkins

            Yup used the built in updated. Like I said the LTE teyhering script stays but Cm overwrites build.prop with its default version. Maybe CM will edit build.prop in a future nightly.

  • Helder

    How will this affect when it’s time to update?

    • Hippowise

      Depending on what you did, you may not get OTA updates from Google anymore. If you’re referring to custom ROM updates, LTE stuck for me, but other people seemed to have lost LTE.

      • Helder

        I have root, cwm, 0.33 radio, and custom kernel. I am pretty sure I won’t get OTA however if I flash the update.zip will this stick or would I have to do it again?

        • Hippowise

          Ya, it looks like if you won’t get OTA updates from Google. What’s in the update.zip? Is that the new version for the custom ROM? I’ve updated my custom ROM without having to re-enable LTE, but other people had to re-enable it. So, I guess it depends…

  • waaw

    i think i have it working… i can tether with lte but its really slow did a speedtest on the other phone using nexus 4 LTE wifi tether only got 7down and 10ish up did i do something wrong?

    • Hippowise

      Hmm, if wifi tethering works at all (to any degree) then you did it correctly. If you did it incorrectly, you shouldn’t get any download or upload speed at all (as it simply wouldn’t work). The slow download/upload speed is probably caused by other factors, such as LTE signal strength, wifi interference, wireless drivers on computer, wireless chip on device, etc.

      • Waaw

        that makes sense i guess it does work. some how the passwords don’t work (couldn’t connect with iphone 5 or computer).
        Also is there a way to make it like before where it drops down to 3g when im not using data so its not always on LTE?

        • Hippowise

          The only way that I am aware of to force it to use 3G instead of LTE (even when LTE is available), is to select the profile manually each time. However, you will lose LTE on reboot, until you select LTE manually again.

        • Hippowise

          I noticed that some ROMs have a toggle button to enable LTE, i haven’t tried using it, but maybe that’s what you want? A screenshot is here http://i.snag.gy/XQpg1.jpg (screenshot taken in Pacman ROM) if you’re interested

  • Afterlife

    This Firewall rule breaks the GPS on the nexus 4. You will not be able to use the built in GPS with this rule added.

  • Afterlife

    GPS does not work with these firewall rules any idea why?

  • Djsherif

    Is there any way to make this work on 4.3 (using a nexus 4). I’ve tried like 10 different ways and nothing happens.

  • Djsherif

    Doesn’t work on 4.3 (nexus 4). Any ideas? Using stock rom.

  • christy

    How do I reverse this? My GPS stopped working completely, even after factory reset/ flashing new roms.

  • Balls O’Steele

    Thanks it worked but I lost GPS. Icon flashes but doesn’t lock a fix. Any solutions? Nexus 4 CM 10.1.3 stable

  • http://www.aruntuts.com Admin

    Hello I use galaxy note 8.0 wifi version. I also have samsung star galaxy. I turned off wifi in my note and enable wifi in star. I connected my note using star’s wifi hotspot. I obtained an ip address and got it connected. When I went to surf, I couldn’t access any. I mean no pages were opening. Any solutions?

  • Pingback: Fix for LTE Tethering topic | usa6