yashsingh1/xdaforums huggingface dataset:
[Moto G 5G Guides, News, & Discussion] fddm:
Your apn is setup with CLAT, so you mangle v4-rmnet_data+. You know which interface because it has an IPv4 address, in this case 192.0.0.2. The plus sign means it applies to all numbered networks by that name.

T-Mobile allows IPv6 HL of 64 and 63, so IPv6 is not an issue unless your tethering to a router. ip6tables only has access to forwarded ICMP traffic, TCP and UDP is encapsulated and can't be modified. In this case you block IPv6 or setup SNAT or MASQUERADING. SNAT is the only viable option without recompiling the kernel entirely and is on my TODO list.

Moto phones do not have this patch yet afaik, there is no such restriction. Modifying apns-conf.xml is always an option though, as long as you have root. This is not required if your redirecting to a VPN and blocking IPv6 though, traffic never crosses the DUN.
[Moto G 5G Guides, News, & Discussion] XeoNoX:
@fddm thank you sir, i will look into this and try it this weekend, as shown by my screenshot above i assume mines is called "v4-rmnet_data2" . i have a different rooted custom rom phone, ill try out and play with it and see if i can get it to work.
[Moto G 5G Guides, News, & Discussion] XeoNoX:
@fddm thanks for your help, patience, and explanation, thanks i figured it out and got it working on a different rooted phone. I also incorporated some of jhjhjhjhjh's settings. i was lookng for a few weeks for a IPTABLES solution so this thread helped alot. I coulndt get the TTL mod to work via iptables on the phone because the filter requires kernal changes like you mentioned ( https://netfilter.org/projects/patch-o-matic/index.html) , as a work around i changed the TTL on the client. i was also able to mangle the rules to be able to tether direct bypassing tether restriction at full LTE speed. So far so good.
[Moto G 5G Guides, News, & Discussion] fddm:
I got unrestricted usb tethering working with IPv6 support via SNAT, if anyone wants that. It uses the patched kernel above with a new module that enables the IPv6 nat table and an app to manage the connection.

Magisk Module:

Meet Google Drive – One place for all your files

Google Drive is a free way to keep your files backed up and easy to reach from any phone, tablet, or computer. Start with 15GB of Google storage – free.

drive.google.com

USBTether app:

usbtether-v0.3-signed.apk

drive.google.com

In the app set Tether Interface to Auto, IPv6 NAT to SNAT, and enable Dnsmasq and Modify Outgoing TTL. After enabling the service it will automatically configure the connection, even after a reboot, until the service is disabled.

Make sure you restore default APN settings as mentioned in the OP, it disables CLAT which would otherwise prevent IPv6 from working(split network) unless your using a VPN.

Sources:

GitHub - worstperson/USBTether

Contribute to worstperson/USBTether development by creating an account on GitHub.

github.com

GitHub - worstperson/dnsmasq

Contribute to worstperson/dnsmasq development by creating an account on GitHub.

github.com
[Moto G 5G Guides, News, & Discussion] gullzway:
Does the same method for previous Motorola's not work? This works on my Z3 Play on Android 9 and G Stylus on Android 10.

Root with Magisk and use MagiskHide Props Config to add net.tethering.noprovisioning=true
[Moto G 5G Guides, News, & Discussion] fddm:
That only disables the provisioning check, for most carriers you still need to use "settings put global tether_dun_required 0" or change the apn to bypass the dun. On TMO/VZW, you additionally need to set the TTL/HL or the packets will be flagged as tethering regardless.

There are tons of ways to do this, but methods that are fully contained on the device are most interesting to me.
[Moto G 5G Guides, News, & Discussion] gullzway:
Indeed. I just set up this Ace 5g last night. Even after adding the net.tethering.noprovisioning=true prop, and "settings put global tether_dun_required 0" MY Hotspot is still being throttled. VPN doesn't help. I'm connecting with an iphone and its still throttled to 500kb/s.

I guess since I was Sprint before, now T Mobile signal, it not as easy.

Can you explain "set the TTL/HL." Will this only work on a PC? Not sure how to Edit APN's on this device either.
[Moto G 5G Guides, News, & Discussion] fddm:
You use Linux firewall rules on the router or bridge to overwrite that field in the packet or if it's a PC you can tell your kernel to create packets with a specific value. Try not to double Nat if you can avoid it. EDIT: Something like this is a good example:

TTL modification for outgoing traffic with OpenWRT

For OpenWRT 22.03 and above using firewall4, please refer to the following updated article. TTL modification for outgoing traffic with OpenWRT 22.03 and firewall4This is an admittedly belated post given the fact that the first stable build of OpenWRT 22.03 was released in September 2022, but I’

www.maroonmed.com

but the specifics depend on application. I've done this on DD-WRT, Tomato, and in plain Linux distros, as well as well as on the phone itself like shown in this thread.

VPN should always work though. Use VPN Hotspot with IPv6 and tethering hardware acceleration disabled. Cloudflare Warp and Google One VPNs are your best bets to avoid traffic shaping on mobile networks IMO.
[Moto G 5G Guides, News, & Discussion] gullzway:
What about connecting a Firestick or other Mobile phone to the Ace 5G hotspot? Any way to get around the TMobile throttle? That's the only time I use it.
[Moto G 5G Guides, News, & Discussion] fddm:
That's exactly what the OP is about, follow the steps and you'll be able to do exactly that with the native tether/hotspot on your phone.

Or if you want to use a VPN, use VPN Hotspot like I mentioned.
[Moto G 5G Guides, News, & Discussion] gullzway:
Thanks, I'll try VPN hotspot. After reading "After flashing the kernel and installing the module, you will need to enter your APN settings and restore defaults for them to take effect."

I'm a little hesitant as I am unable to edit APN's on this New phone either through settings, or ##3282##

Edit: VPN Hotspot is working, data not counted as hotspot. Not sure how it works, I'm not even using my VPN unless it has one built in.
[Moto G 5G Guides, News, & Discussion] russellglen72:
Will flashing the boot.img mess with my root
[Moto G 5G Guides, News, & Discussion] cowboah:
I flashed the kernel and installed the Magisk module without issue. I'm a total newb to all this though, and I don't know what the OP means by "enter your APN settings and restore defaults". I know how to restore default APNS's, but I don't know what do for the first part. Just restoring the default APN does enable tethering that's hidden from the carrier (once the connection decides to work properly that is), but the internet is getting cut off intermittently with messages like "can't find DNS" or "connection timed out". I can't help but suspect that this has something to do with me not knowing how to follow the last step in the OP. Any help would be appreciated.
[Moto G 5G Guides, News, & Discussion] fddm:
Sounds like you got it then, restoring default APNs is all that calls for.

Not sure about about the errors your receiving though. This should act the same as tethering normally does. You might try disabling "Tethering hardware acceleration" in Developer options or manually set DNS servers on your client.
[Moto G 5G Guides, News, & Discussion] cowboah:
Yeah, I ended up realizing it's the carrier. The connection was cutting out constantly and I just didn't notice it before setting things up. T-Mobile's network just isn't very good in my area. 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.

The top is what I have unrooted after the switch. What I don't understand is if I need to add dun to the types and whether to use "ndo" or "endo" for the apn value.
[Moto G 5G Guides, News, & Discussion] fddm:
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:

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.
[Moto G 5G Guides, News, & Discussion] cowboah:
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.
[Moto G 5G Guides, News, & Discussion] fddm:
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.
[Moto G 5G Guides, News, & Discussion] cowboah:
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.
[Moto G 5G Guides, News, & Discussion] fddm:
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:

VPN Hotspot - Apps on Google Play

Share your VPN connection over hotspot or repeater. (root required)

play.google.com

You can use it with a local VPN like AdGuard and it should work better than PDANet.
[Moto G 5G Guides, News, & Discussion] cowboah:
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?
[Moto G 5G Guides, News, & Discussion] fddm:
If you need to bypass tether provisioning, I made a module that only does that:

Meet Google Drive – One place for all your files

Google Drive is a free way to keep your files backed up and easy to reach from any phone, tablet, or computer. Start with 15GB of Google storage – free.

drive.google.com

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.
[Moto G 5G Guides, News, & Discussion] cowboah:
I'm trying to set this up now. I'll report on how it works.
[Moto G 5G Guides, News, & Discussion] cowboah:
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.
[Moto G 5G Guides, News, & Discussion] cowboah:
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.
[Moto G 5G Guides, News, & Discussion] ShitHawk:
I recently bought a motorola one 5g ace. I didn't find it on LineageOS device list and I am wondering if it will eventually be on there.
[Moto G 5G Guides, News, & Discussion] 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.
[Moto G 5G Guides, News, & Discussion] fddm:
I updated to Lineage OS 18.1

https://xdaforums.com/t/rom-11-0-kiev-lineageos-18-1-unofficial.4301693/

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:

Meet Google Drive – One place for all your files

Google Drive is a free way to keep your files backed up and easy to reach from any phone, tablet, or computer. Start with 15GB of Google storage – free.

drive.google.com

OR

Native Tether with IPv6 untouched:

Meet Google Drive – One place for all your files

Google Drive is a free way to keep your files backed up and easy to reach from any phone, tablet, or computer. Start with 15GB of Google storage – free.

drive.google.com

(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:

Meet Google Drive – One place for all your files

Google Drive is a free way to keep your files backed up and easy to reach from any phone, tablet, or computer. Start with 15GB of Google storage – free.

drive.google.com

OR

Kernel with IPv6 SNAT/MASQ and TTL/HL:

Meet Google Drive – One place for all your files

Google Drive is a free way to keep your files backed up and easy to reach from any phone, tablet, or computer. Start with 15GB of Google storage – free.

drive.google.com

USB Tether v0.5 app:

usbtether-v0.5-signed.apk

drive.google.com

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

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:

Meet Google Drive – One place for all your files

Google Drive is a free way to keep your files backed up and easy to reach from any phone, tablet, or computer. Start with 15GB of Google storage – free.

drive.google.com
[Moto G 5G Guides, News, & Discussion] bernsmonke:
This works great on my moto one 5g ace Metro. Thank you so much! I have v 3 of the USB tether app but noticed a v5 linked on p2. Should I update to that?
[Moto G 5G Guides, News, & Discussion] fddm:
V0.5 is certainly better, but is a bit out of date now. I try to keep updated builds in the main thread for the app:

https://xdaforums.com/t/app-root-6-0-usb-tether-v0-7.4240271/

You'll probably need to uninstall the old version to install the latest.

Thanks for your feedback, it's much appreciated.
[Moto G 5G Guides, News, & Discussion] l0csta:
i'm planning on doing this to get faster tethering speeds on my oneplus n200. While I should be able to modify the kernel using the guide, i'm confused about the module. You mentioned something about official sources, but I don't get exactly what I need to build it.
[Moto G 5G Guides, News, & Discussion] fddm:
I wouldn't worry too much about this thread, there are a ton of approaches for tethering.

As a general rule, disable 'Tethering hardware acceleration' in Developer options. This option can save battery life, but can also reduce throughput and effect tether bypasses.

If you don't have root, run a proxy server on the phone and connect through it. Any proxy will do, or even ssh tunneling, you are only limited by the traffic supported and whether it supports IPv6. You'd use regular tethering to connect if your phone/carrier allows you, otherwise you'd be stuck forwarding traffic through adb like those apps on the Playstore. If your carrier only uses uses APN configuration to flag traffic and you can enable tethering, you can try adding 'dun' to APN type or running 'settings put global tether_dun_required 0' through adb.

If you have root, you have much more control. You can directly, or through a Magisk module, modify apns-conf.xml to remove the hidden dun APN or add 'dun' to APN type. Some carriers additionally check the TTL/HL of packets coming in and use that to flag traffic. You either set that on each client, or use an iptables rule on your bridge to overwrite it (and disable IPv6 or run double NAT). There is also VPN tethering, something that only requires root. VPN Hotspot and my app USB Tether can do that.
[Moto G 5G Guides, News, & Discussion] JDToo:
Since you had the source code for the kernel, what exactly required reverse engineering to implement?

Given that T-mobile's Internet connection is native IPv6 only why did you not create a corresponding Ip6tables rule which also sets the HL to 64 for IPv6 packets?

Why did you merge the DUN APN's? Don't carriers (like T-Mobile) use the separate APN for the hotspot as the primary means to determine the throttling, e.g. primary APN is unlimited data and DUN APN is 40GB?
[Moto G 5G Guides, News, & Discussion] fddm:
Stock kernels are built with the option CONFIG_MODULE_SIG_FORCE, an option that forces signature checks on kernel modules before they can be loaded. Stock kernel sources did not fully build, so I just built modules and patched the kernel to work with them.

I do, with USB tethering, were IPv6 NAT is supported. Normally you'd just use physdev to modify those packets on the way out, but that doesn't seem to work with ipv6. You need a NAT on the phone or router. I run the NAT on the phone so it shares the tunnel(and IP) with the phone, effectively hiding behind it just like ipv4.

Deleting it would work just as well. If you look at the example, "pcweb.metropcs.com" is the DUN and it gets deleted. I mark the primary as DUN for good measure, but it is not strictly necessary. If the phone can't find a DUN apn it just uses the primary.
[Moto G 5G Guides, News, & Discussion] flash713:
I use a OnePlus 7 pro (rooted w/DerpFest rom) I had initially made a ,DUN apns-conf.xml without ipv6 just ipv4 and I also did: adb shell (and) settings put global tether_dun_required 0

I added the ole: net.tethering.nonprovisioning=true using Magisk Props hide module, added new custom prop.... Along with the open source VPN hotspot app.. (with the green and yellow icon) Then I uncheck "tethering hardware acceleration" in dev options. In the past I've used a proxy server I always had connection issues.. I know VPN Hotspot app doesn't

allow ipv6 as it's already set that way by default in the app but I have used my tether this past week and the week before and I didn't think about my apn that I made with ,DUN, I had to do a clean install last week and I never made another apn without ipv6. My hotspot still works and is usually at a decent speed when tethering my desktop. I've gotten between 25-72 mbps download and about half that upload regularly. I haven't and don't use it much unless I have to but I ran speed tests off and on just to see.. I use Ubuntu on my home PC and i had initially changed TTL on it to 65 but I have rebooted since I changed it and never redid it again. Anyway that's my report. ✌️
[Moto G 5G Guides, News, & Discussion] JDToo:
So T-mobile doesn't assign IPv6 global unicast addresses to connecting devices on the hotspot? My only experience thus far with T-mobile has been with dedicated cell service routers, and T-mobile does assign global IPv6 addresses to clients on those. I assumed phones would do the same.
[Moto G 5G Guides, News, & Discussion] fddm:
It certainly does when using built-in tether feature, but most tethered traffic doesn't seem accessible through the kernel firewall. Further, if you set your router up as a bridge and use a physdev rule to modify the HL, IPv6 will not work. If you setup NAT6 on the phone or router modifying HL works as intended. Seems like a kernel bug.
[Moto G 5G Guides, News, & Discussion] fddm:
@Articul8Madness I don't mind patching stock Moto kernels and building modules on request, I just need three things:

1. Link to stock kernel sources from Moto's github

2. /proc/config.gz pulled from your device

3. Stock boot image to patch

I only have an app for usb tethering, but can make one to support hotspoting as well if necessary.
[Moto G 5G Guides, News, & Discussion] fddm:
Does your device code name show up in download mode like it would on Qualcomm devices?
[Moto G 5G Guides, News, & Discussion] fddm:
Mind sharing it? So I can download your firmware to get your boot.img and extract the kernel config.
[Moto G 5G Guides, News, & Discussion] fddm:
There's kernel sources for milan though a shared tree (MMI-RRWB31.Q3-46-64-2-2, for example, looks to have the required files). Just no readme describing how to compile these recent mtk kernels. Will take a bit of experimenting to set up the required toolchain and learn how to use it.

[+] Version string: Linux version 4.14.186+ (nobody@android-build) (Android (6443078 based on r383902) clang version 11.0.1 (https://android.googlesource.com/toolchain/llvm-project b397f81060ce6d701042b7
82172ed13bee898b79), LLD 11.0.1 (/buildbot/tmp/tmp6_m7QH b397f81060ce6d701042b782172ed13bee898b79)) #1 SMP PREEMPT Wed May 4 02:04:49 CDT 2022