I need to use 5G mobile network as home broadband for a few months, as this is temporary, I'm looking for an inexpensive way to do this, I think 5G dongle currently is quite expensive, so I'm considering using a spare Android smartphone to do USB tethering.
I haven't used USB tethering before, I think the smartphone creates a subnet for the connected device, this involves NAT for IPv4, and connecting an OpenWrt router which also does NAT would result in double NAT. What's the best way to avoid double NAT? Is it possible to configure the smartphone as a bridge so that routing/NATing only happens in the router? It's fine for the phone to lose network access. The smartphone is unrooted Google Pixel 5.
I prefer using router to do routing and NATing instead of the smartphone, but if double NAT can't be avoided in this configuration, is it possible to configure the router to bridge the USB connection to LAN so that routing/NATing can be disabled on the router? If so, what UCI commands do I need to run?
It's possible to bridge android's usb network card with lan ports and wifi - just add it to the br-lan device.
This is much more difficult but it is also possible to initiate a new PDP context on at least qualcomm phones, but it afaik requires root and setting a value which i don't remember via adb shell: setprop sys.usb.config and then you can use network manager on openwrt to set up the connection.
I doesn't work, I assume this brings up the USB tethering option? If so, I already know how to bring up that option. What I'm trying to resolve is the double NAT.
So avoiding double NAT using unrooted smartphone needs the phone to do routing and NATing then.
First check the network status in ordinary phone mode. Unless you are in a place like Africa that still has more IPv4 addresses than ISP customers, you will find that the phone company is using CGNAT or 464 to deliver IPv4 and you can't get a public IPv4 all the way to your line anyway. So another NAT is not a big difference.
If IPv6 is supported it should be without any NAT at all.
Most do not, but you get one complete /64 routed to your line so you can use IPv6 relay to set up each lan endpoint with a globally unique address within that /64.
I don't think that phones offer a way to install static routes in their hotspot / tethering system. You get a /24 which I suppose you could split into two /25s to route between in your router, but this may be complicated by the phone itself not guaranteed to be the .1 IP.