This is related to other questions about making an IP connection over USB from Android to Windows (SSH, ADB forward, etc), but it goes further, and I can't find any "howtos" or other information about it.
What I want is to fully bridge my phone to the LAN, meaning OSI level 2/broadcast traffic not just level 3+4/IP traffic, across USB not using Wifi. It's probably not that hard (if you know how).
The LAN is an ordinary straightforward home lab LAN (Windows 8.1 clients, test box used for lab work running pfSense (FreeBSD) with a couple of spare NICs that can be bridged as a virtual managed switch, and a 16 port switch linking them all). The phone is rooted (Samsung Galaxy S7, Sony ZX, or similar) running LineageOS 14.1 (Android 7.1).
I've figured there are two possible approaches, but I don't know how to do either:
- Tunnel Ethernet over USB to a Windows/FreeBSD box (using ADB?), then use some magic at the Windows/Linux end, so the USB link is 'seen' as Ethernet and virtual-bridged to the LAN connection. (Windows and *nix should both be able to do that "out of the box").
- Buy a reputable USB-to-RJ45 dongle/adapter which has an Android driver available, so Android just sees a USB network device;
I'd prefer only to use "standard" OS functions and "well known" software (SSHD? ADB?) and a bare USB cable, because most phones couldn't power a USB adapter at all or for long time periods and because it's one less adapter to buy and one less compatibility issue. What I don't want is "buy specialised App X off Google Play" :)
On the USB-to-LAN side, both pfSense and Windows can probably bridge the incoming USB to the LAN "out of the box". pfSense handles bridging in its GUI once the USB port is made to appear as an Ethernet connection, and I'd hope that Windows 8.1/10's built-in network sharing can do similar. But I don't really know, it's my guess. I'd prefer to use a Windows machine to bridge to the LAN, because it gives me easier access.
So I have a sense what a solution should look like, but I don't know how to do any of these, or what config will be needed at the Android or Windows/FreeBSD ends. Most hits about Android to LAN over USB only discusses a two device connection usually via TCP (not ICMP/ARP/STP/other broadcast protocols), only Android to a desktop PC (not LAN), often only forwarding of a single specific port, and often with well-defined client/server roles for the two endpoints.
It does looks like I should use ADB in some way for the actual IP-over-USB tunnelling bit, but I can't find anything that takes it from there to a complete solution and network bridge for all types of traffic.
Summing up, I want my phone to appear and act like it's directly connected to the wired LAN via its USB connection, without using Wifi and ideally only using standard OS capabilities and "well known apps" and a Windows PC (or at worst, only apps which provide an easy GUI to make CLI functionality easier). I'd like not to have to buy a hardware USB-to-RJ45 adapter for the phone, but if I have to get one then it's got to have a mainstream NIC/driver likely to work with future Android and "known reliable".
Is there a simple way to do it that just uses a USB cable and not a USB-Ethernet dongle?