USB Internet

You can enable Internet through the USB cable when WiFi doesn't work yet on your device. For this to work you set your host machine as gateway for your phone and let your host machine do for the phone or a guest machine.

Linux
If neither of those work or run correctly, try

To make the configuration persistent after reboot do: Disable it if you plug the USB cable out and want to use WiFi, because it can interfere with routing (packets would try to use the USB networking, even though it's disconnected)

Windows


Configure the IP addresses like the screenshot above.

On the host machine:
First, enable IP forwarding: Then follow the instructions according to the distribution or firewall you use.

iptables (Ubuntu/Arch/Alpine)
This will enable IPv4 forwarding on your host machine which basically lets it function as a router. The postrouting command will make the kernel on the host translate the packets between the phone network and your normal network on the host machine.

firewalld (RHEL/CentOS/Fedora/Rocky/SLE/openSUSE)
Use the  and   options for a persistent configuration.

nftables (postmarketOS)
postmarketOS has chain  configured for USB interfaces by default. If using other distributions or the following lines are missing, add them manually.

You can now verify the Internet connection on your phone by pinging something. If this does not work it means you need to compile the kernel with  setting enabled in menuconfig.

ufw
In the file, change   to.

In the file, uncomment.

Add the following rule to  BEFORE the   table rules.

Restart  to make changes take effect.