• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[Magisk][Stock] Bypass Tether Restrictions

Search This thread

fddm

Senior Member
Feb 24, 2011
167
112
I switched to Cricket, and so far the network seems better. I'm trying to get set up again, and I'm having trouble merging the APN's for my carrier. It doesn't help that there is no dun type in either of the entries that use the same mmsc as I do.
I don't have access to an AT&T line, so I haven't had the opportunity to test them much. Afaik they just use APN settings for categorization. In your case I think it should be a hidden APN with the carrier set to "mht". Depending on your device, you may be able to recreate your APN settings and add "dun" to type or run this command over ADB:
Code:
settings put global tether_dun_required 0
I'm not sure what device your using now, if it's a Cricket /AT&T phone you won't be able to bypass provisioning, and will have to either pay for the hotspot feature or use one of those apps that tunnel data through a local proxy. If you pull too much data they're more likely to scrutinize your account and boot you for ToS violation.
 

cowboah

Member
Jun 3, 2021
9
1
It's still the same phone. I got it unlocked specifically to avoid having software cause issues like this. So I suspect this mod should still work for me if I get the APN right. Which I'll need to do to get any hotspot since it's not even letting me use the 10 GB I'm paying for. From my research they only allow hotspot on their own devices. I'll try the dun = 0 trick, but it hasn't worked for me since my Stylo 4 with Boost, including on this device. That might be because T-Mobile is particularly effective at sniffing out tethering. Maybe having the device rooted will help. Otherwise I'll try adding dun to the APN and experiment with APN mergers and report back anything that does or doesn't work for the benefit of anyone who finds this thread like I did.
 

fddm

Senior Member
Feb 24, 2011
167
112
It's still the same phone. I got it unlocked specifically to avoid having software cause issues like this. So I suspect this mod should still work for me if I get the APN right. Which I'll need to do to get any hotspot since it's not even letting me use the 10 GB I'm paying for. From my research they only allow hotspot on their own devices. I'll try the dun = 0 trick, but it hasn't worked for me since my Stylo 4 with Boost, including on this device. That might be because T-Mobile is particularly effective at sniffing out tethering. Maybe having the device rooted will help. Otherwise I'll try adding dun to the APN and experiment with APN mergers and report back anything that does or doesn't work for the benefit of anyone who finds this thread like I did.
Both should methods work on Moto phones, I just do it through apns-conf.xml because it works on all phones with root.

My module adds net.tethering.noprovisioning=true to build.prop. This disables the provisioning check allowing you to tether/hotspot regardless. Root is required to set this option.
 

cowboah

Member
Jun 3, 2021
9
1
I tried the dun = 0 trick with the kernel and module installed after I rerooted the device. It allows hotspot as expected but the carrier cuts off internet when I use it. I know it's not just a bad connection this time because turning off hotspot and toggling the mobile data restores internet (to the device). It's either detecting something or requesting an APN that isn't available because I don't have hotspot according to the carrier. There has to be a way around this since PDAnet+ is able to get around the issue (subject to the app's problems that led me to look for a better solution). I suppose I'll try messing with the APN's unless you have any other suggestions.
 

fddm

Senior Member
Feb 24, 2011
167
112
The dun = 0 trick makes it so tethered data goes through the default APN. If you didn't flash the modified kernel the TTL can't be modified. It could also be IPv6 HL, since I can't modify that without using an app to control the connection. Hopefully I can get access to an AT&T line soon so I can test.

If you haven't tried, VPNHotspot works really well:
You can use it with a local VPN like AdGuard and it should work better than PDANet.
 

cowboah

Member
Jun 3, 2021
9
1
I did flash the kernel, so the TTL isn't the issue. Thanks for the app suggestion, I'll try that. Would I need to install something on the device I'm tethering to? That's the main downside of PDANet other than its constant disconnects that make wifi tethering unusable and USB tethering just barely tolerable. Also, should get rid of the modified kernel and the Magisk module to use the VPN method?
 

fddm

Senior Member
Feb 24, 2011
167
112
If you need to bypass tether provisioning, I made a module that only does that:

Other than that, all you need is root. You start your VPN and native tethering and then enable it in VPNHotspot(wlan0 or rndis0). You can also have it monitor the connection to enable automatically. Only downsides to this is the need for VPN software and no IPv6. The upside is that it's really stable. Remember to disable "Tethering hardware acceleration" in Developer options.
 

cowboah

Member
Jun 3, 2021
9
1
Now the internet error is ERR_NAME_NOT_RESOLVED on a consistent basis. It may or may not have anything to do with the DNS. It seems AT&T has gone to the ends of the earth to detect and block tethering. I may have to try another carrier.
 

cowboah

Member
Jun 3, 2021
9
1
I feel really silly now. I was doing everything above without my mobile data enabled. When I noticed it was off I tried again and it works perfectly. Thank you @fddm for all your help.
 
  • Like
Reactions: fddm
Well the way I have my hotspot undetectected.
Simple ,
Root of course,
1. Use adblocker or adaway first
2. Change DNS settings and apn.
DNS...dns.google or 1dot1dot1dot1.dns-.com
APN 4.4.8.8 NOT 4G.... I'll screen shot the settings.
4. Use app Hotspot VPN version 2.11.3
Set up hotspot on phone and activate hotspot via vpn app.. I'll screen shot the settings as well.
viola...😀

Edit..Thanks .O.P for this jewel. !! The VPN hotspot app works but only on the default apn..I guess metro/TMobile may have updated there servers..anyways I flashed the boot.img and installed the magisk module but I patched the boot.ing with the latest magisk 20.4 and manager 7.51.. I then said what does restore default apn mean? So I just took out my sim reinserted it and reset network settings only. Now I saw a fresh apn that allowed me to edit...yeah...before adding an apn was my only option. Now I noticed DNS and VPN apps work on default apn configs..
So VPN hotspot works and no detection from carrier or DNS errors..
I have two 5g ace phones I got for 89.99 a piece ..im on an unlimited data plan, I USB tether to my 5G ace to my laptop and utilized the windows 10 sharing feature. Share USB tether connection via Ethernet...then plug the Ethernet into my Netgear router. For Xbox and PlayStation I add port rules and assign a static i.p for both consoles.
Ii kid you not after 3 days of this method my average speeds using 5G per device connected to my router either by Ethernet or wifi , averages 40-90 MBs download and 33mb upload.. who needs an internet provider like spectrum anymore? Not me....;)
Me and you been fighting this battle together since the Moto G7 Power days,lol.
 
  • Like
Reactions: ShitHawk
i tether my laptop to my moto g7 and att clamps me to under 200k download. it sucks, but its all I have. i have 3 towers that I can see from where I live and maybe when the 5g comes, it will make a difference, but i doubt it.
If you use PDA Net that wouldn't happen. Trust, I was hitting 300GB a month on my G7 Power.
 
  • Like
Reactions: RETIEF and ShitHawk

fddm

Senior Member
Feb 24, 2011
167
112
I updated to Lineage OS 18.1
Sources: https://github.com/SyberHexen

---------------------------------------------------------------------------------------------
Native Tether

We don't need to install a patched kernel with Lineage. I added dun to T-Mobile in apns-conf.xml, MetroPCS already had it set. You still need to make sure you have dun under APN type or run "settings put global tether_dun_required 0" through adb for your traffic not to count.

Native Tether with IPv6 disabled:

OR

Native Tether with IPv6 untouched:
(You may want this if your on the T-Mobile network and you tether directly to your devices)

---------------------------------------------------------------------------------------------
USB Tether

We have the option between Magisk module or custom kernel, the latter with masquerade support. For a direct mobile IPv4/IPv6 dual stack connection, you need to set APN protocol to IPv4/IPv6 in your APN configuration. I applied this for T-Mobile and MetroPCS in apns-conf.xml.

Modules for IPv6 SNAT and TTL/HL:

OR

Kernel with IPv6 SNAT/MASQ and TTL/HL:

USB Tether v0.5 app:

---------------------------------------------------------------------------------------------

If you have connectivity issues, try disabling Tethering Hardware Acceleration in Developer Settings. Different APN settings can also help, using T-Mobile APN settings helped with MetroPCS for me. Also setting "persist.net.doxlat=false" in build.prop to disable CLAT and can help with IPv4 issues. I have a test module that does that here:
 
Last edited:
  • Like
Reactions: xdaSEx10

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    This is an example of how I seamlessly bypass native tether restrictions for both usb and wifi tethering. For the Moto G Ace 5G, this comes in two parts. A kernel mod to disable CONFIG_MODULE_SIG_FORCE and Magisk module to set things up. The kernel modification was made through reverse engineering with Ghidra and the kernel module included in the Magisk module was built by compiling official sources with CONFIG_NETFILTER_XT_TARGET_HL=m added to the config.

    The Magisk Module has three main parts:
    system.prop - Disable tether provisioning
    apns-conf.xml - Modify APN configuration
    service.sh - Insert xt_HL and apply the iptables rule

    The rule looks like:
    Code:
    iptables -t mangle -I POSTROUTING -o rmnet_data+ -j TTL --ttl-set 64
    It tells the kernel to modify the TTL of all IPv4 traffic exiting through any mobile interface. The interface can be different on other devices, another common example would be "v4-rmnet_data+". It should also be noted that this only touches IPv4 traffic. If your carrier flags the hop limit of IPv6 traffic, I can only recommend blocking IPv6 to the tethered interface with an ip6tables rule or using another method.

    The supplied apns-conf.xml is modified for T-Mobile and MetroPCS, you may need to edit it if your carrier differs. This is done by finding the DUN APNs, merging them with the primary APNs, and removing them as follows:
    <apn carrier="MetroPCS"
    mcc="310"
    mnc="160"
    apn="fast.metropcs.com"
    mmsc="http://metropcs.mmsmvno.com/mms/wapenc"
    type="default,supl,mms"
    protocol="IPV6"
    mvno_match_data="6D38"
    mvno_type="gid"
    mtu="1440"
    user_editable="0"
    carrier_id="1949"
    />
    <apn carrier="MetroPCS DUN"
    mcc="310"
    mnc="160"
    apn="pcweb.metropcs.com"
    type="dun"
    protocol="IPV4V6"
    mvno_match_data="6D38"
    mvno_type="gid"
    mtu="1440"
    user_visible="0"
    carrier_id="1949"
    />

    ****************************************************

    <apn carrier="MetroPCS"
    mcc="310"
    mnc="160"
    apn="fast.metropcs.com"
    mmsc="http://metropcs.mmsmvno.com/mms/wapenc"
    type="default,supl,mms,dun"
    protocol="IPV4V6"
    mvno_match_data="6D38"
    mvno_type="gid"
    mtu="1440"
    user_editable="0"
    carrier_id="1949"
    />

    Modified Kernel:

    Magisk Module:

    After flashing the kernel and installing the module, you will need to enter your APN settings and restore defaults for them to take effect.
    Note: The Magisk module also disables nondisable, preinstall, and system upgrades.

    I think I might of got a GPL report for this thread, so here's a link to stock sources used to build modules:
    and also my patching guide that was made after this post:
    2
    Well the way I have my hotspot undetectected.
    Simple ,
    Root of course,
    1. Use adblocker or adaway first
    2. Change DNS settings and apn.
    DNS...dns.google or 1dot1dot1dot1.dns-.com
    APN 4.4.8.8 NOT 4G.... I'll screen shot the settings.
    4. Use app Hotspot VPN version 2.11.3
    Set up hotspot on phone and activate hotspot via vpn app.. I'll screen shot the settings as well.
    viola...😀

    Edit..Thanks .O.P for this jewel. !! The VPN hotspot app works but only on the default apn..I guess metro/TMobile may have updated there servers..anyways I flashed the boot.img and installed the magisk module but I patched the boot.ing with the latest magisk 20.4 and manager 7.51.. I then said what does restore default apn mean? So I just took out my sim reinserted it and reset network settings only. Now I saw a fresh apn that allowed me to edit...yeah...before adding an apn was my only option. Now I noticed DNS and VPN apps work on default apn configs..
    So VPN hotspot works and no detection from carrier or DNS errors..
    I have two 5g ace phones I got for 89.99 a piece ..im on an unlimited data plan, I USB tether to my 5G ace to my laptop and utilized the windows 10 sharing feature. Share USB tether connection via Ethernet...then plug the Ethernet into my Netgear router. For Xbox and PlayStation I add port rules and assign a static i.p for both consoles.
    Ii kid you not after 3 days of this method my average speeds using 5G per device connected to my router either by Ethernet or wifi , averages 40-90 MBs download and 33mb upload.. who needs an internet provider like spectrum anymore? Not me....;)
    2
    i tether my laptop to my moto g7 and att clamps me to under 200k download. it sucks, but its all I have. i have 3 towers that I can see from where I live and maybe when the 5g comes, it will make a difference, but i doubt it.
    If you use PDA Net that wouldn't happen. Trust, I was hitting 300GB a month on my G7 Power.
    1
    @jhjhjhjhjhjh how did you change the APN TYPE and add DUN to it? the newer version of android wont allow this modification. what version of android are you using?
    1
    I updated to Lineage OS 18.1
    Sources: https://github.com/SyberHexen

    ---------------------------------------------------------------------------------------------
    Native Tether

    We don't need to install a patched kernel with Lineage. I added dun to T-Mobile in apns-conf.xml, MetroPCS already had it set. You still need to make sure you have dun under APN type or run "settings put global tether_dun_required 0" through adb for your traffic not to count.

    Native Tether with IPv6 disabled:

    OR

    Native Tether with IPv6 untouched:
    (You may want this if your on the T-Mobile network and you tether directly to your devices)

    ---------------------------------------------------------------------------------------------
    USB Tether

    We have the option between Magisk module or custom kernel, the latter with masquerade support. For a direct mobile IPv4/IPv6 dual stack connection, you need to set APN protocol to IPv4/IPv6 in your APN configuration. I applied this for T-Mobile and MetroPCS in apns-conf.xml.

    Modules for IPv6 SNAT and TTL/HL:

    OR

    Kernel with IPv6 SNAT/MASQ and TTL/HL:

    USB Tether v0.5 app:

    ---------------------------------------------------------------------------------------------

    If you have connectivity issues, try disabling Tethering Hardware Acceleration in Developer Settings. Different APN settings can also help, using T-Mobile APN settings helped with MetroPCS for me. Also setting "persist.net.doxlat=false" in build.prop to disable CLAT and can help with IPv4 issues. I have a test module that does that here: