The Linux counterpart to tethering is called USB Ethernet Gadget and allows you to use the network of your smartphone or notebook. As an example, I connected a Raspberry Pi 4 to a Google Pixel via one of its USB 3.0 ports. I control the Raspberry via its Gigabit Ethernet using ssh from a Linux desktop PC.
No smartphone is connected yet.
>
pi@rpi20
_,met$$$$$gg. --------
,g$$$$$$$$$$$$$$$P. OS: Debian GNU/Linux 11 (bullseye) aarch64
,g$$P" \"""Y$$.". Host: Raspberry Pi 4 Model B Rev 1.4
,$$P' `$$$. Kernel: 5.15.84-v8+
',$$P ,ggs. `$$b: Uptime: 24 mins
`d$$' ,$P"' . $$$ Packages: 573 (dpkg)
$$P d$' , $$P Shell: bash 5.1.4
$$: $$. - ,d$$' Terminal: /dev/pts/0
$$; Y$b._ _,d$P' CPU: ARM Architecture: aarch64 (4)
Y$$. `.`"Y$$$$P"' Memory: 0.25 GiB / 7.62 GiB (3%)
`$$b "-.__ Network: 1 Gbps
`Y$$
`Y$$.
`$$b.
`Y$$b.
`"Y$b._
`\"""
pi@rpi20:~ $ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 0403:c630 Future Technology Devices International, Ltd lcd2usb interface
Bus 001 Device 003: ID 2e8a:f00a Raspberry Pi Pico W
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@rpi20:~ $ ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:e7:db:b8:07 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.178.120 netmask 255.255.255.0 broadcast 192.168.178.255
ether dc:a6:32:bf:7a:a9 txqueuelen 1000 (Ethernet)
RX packets 20496 bytes 23184177 (22.1 MiB)
RX errors 0 dropped 2 overruns 0 frame 0
TX packets 5561 bytes 939519 (917.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 8 bytes 734 (734.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 8 bytes 734 (734.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Now I connect the smartphone without tethering activated.
pi@rpi20:~ $ lsusb
Bus 002 Device 006: ID 18d1:4ee1 Google Inc. Nexus/Pixel Device (MTP)
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 0403:c630 Future Technology Devices International, Ltd lcd2usb interface
Bus 001 Device 003: ID 2e8a:f00a Raspberry Pi Pico W
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Now I have activated tethering on the Pixel.
pi@rpi20:~ $ lsusb
Bus 002 Device 007: ID 18d1:4eeb Google Inc. Pixel 7
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 0403:c630 Future Technology Devices International, Ltd lcd2usb interface
Bus 001 Device 003: ID 2e8a:f00a Raspberry Pi Pico W
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@rpi20:~ $ ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:e7:db:b8:07 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.178.120 netmask 255.255.255.0 broadcast 192.168.178.255
ether dc:a6:32:bf:7a:a9 txqueuelen 1000 (Ethernet)
RX packets 20981 bytes 23216425 (22.1 MiB)
RX errors 0 dropped 2 overruns 0 frame 0
TX packets 5625 bytes 948399 (926.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 8 bytes 734 (734.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 8 bytes 734 (734.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.197.3 netmask 255.255.255.0 broadcast 192.168.197.255
ether d6:be:e6:e7:a2:00 txqueuelen 1000 (Ethernet)
RX packets 10 bytes 1212 (1.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 15 bytes 1464 (1.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
pi@rpi20:~ $ ^
Thanks to tethering and USB Ethernet Gadget, usb0 now appears as an Ethernet interface.
Not only the Raspberrys, but also BeagleBone SBC can all do this and I love it. When I had to go to hospital for a few weeks, I took my laptop and a PocketBeagle with me and had a lot of fun with it.
How to Connect a PocketBeagle to the Internet via USB on a Windows 10 PC