Tuesday, January 14, 2025

Enable OTG Ethernet on Orange PI Zero 2w

    For this I'll be using Armbian community as I much prefer it over the official OrangePI builds.  With Armbian this is really very simple but I wasn't finding any recent guides so here we go.


WiFi is not needed for this configuration unless you want to use SSH.  The minimal Armbian builds use netplan by default so if you need some help enabling WiFi see here 

https://docs.armbian.com/User-Guide_Networking/


Enable OTG Ethernet support

First we need to enable the USB host support

sudo armbian-config









Select "System"











Select "Kernel"











Select "SY210 - Manage device tree overlays"
























Select "sun50i-h5-usbhost0", you can select all the usbhosts if you want

Save and reboot when prompted


After the reboot lets try enabling the kernel module for the interface

sudo modprobe g_ether
dmesg | grep "HOST"




If it worked you should something like this from the dmesg command


As long as "g_ether" started up we can enable it to automatically startup by adding it to /etc/modules

sudo nano /etc/modules








Just add "g_ether" ad the end of what ever is already there.  ctrl+o to save and ctrl+x to exit


Lets reboot again to make sure it loads


After the reboot you can check on it again with dmesg or ip addr

dmesg | grep "HOST"


ip addr




Configure Interface

Now lets give it an IP address using the example from https://docs.armbian.com/User-Guide_Networking/

I recommend remarking out the "routes" section, having a default route here will cause issues if you are using the WiFi interface for network/Internet access.


sudo nano /etc/netplan/20-static-ip.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    usb0: # Change this to your ethernet interface
      addresses:
      - 192.168.1.199/24
      #routes:
      #- to: default
        #via: 192.168.1.1
      nameservers:
       addresses:
         - 9.9.9.9
         - 1.1.1.1






Make sure you change the interface if yours is not usb0 and set the address, default route and nameservers appropriately for your environment.  Save and exit.


Apply netplan changes

If the file is new we need to update the permissions or netplan will yell at us

sudo chmod 600 /etc/netplan/20-static-ip.yaml


Now apply

sudo netplan apply


Now if we list our IP's we should have something on our usb interface

ip addr


Before we had


Now we should have something like this but with your settings






Windows

If you plugin your device to Windows it may not work, the driver needed is not standard. So it my show up as a new serial port.  That is fine we just need to install a driver.


 



Driver is available here https://github.com/unicaller/usb_rndis/raw/refs/heads/main/RNDIS.zip








Select "Update driver"









Select "Browse my computer for drivers"















Use the browse button to locate where you saved the driver then next.









Now we can assign an IP address to our local interface and test communication.












Done!


No comments:

Post a Comment

UniFi Network force DNS over TLS network wide

The post on doing this in OPNSense has been pretty popular so let's do this with UniFi!  You will need a UniFi gateway and the Network a...