Troubleshooting Raspberry Pi Zero with USB Ethernet

Picture dongle

The Raspberry Pi Zero v1.3 is the one without Wi-Fi and Bluetooth. But to install/update my software, I often need it to be connected to the network.

I found a cheap USB 2.0 / 100 Mpbs ethernet dongle based on the Realtek 8152B chipset. But it didn't work out of the box. Somehow it kept flipping the connection on and off and I could not connect to the network.

From years of experience in networking, I've learned that when auto-negotiation doesn't work between two network devices, you just set manually the settings on one or both sides. You do this by setting the link speed, duplex and disabling auto-negotiation. In this case just fix the settings on the Raspberry Pi side fixes the issue:

sudo ethtool -s eth0 autoneg off speed 100 duplex full

This fixed the ethernet connection and my Raspberry Pi Zero got online.

Making this persistent on the Raspberry Pi by applying these settings in /etc/networking/interfaces:

# Include files from /etc/network/interfaces.d:
 source-directory /etc/network/interfaces.d
 auto lo
iface lo inet loopback
 allow-hotplug eth0
 iface eth0 inet manual
 link-speed 100
 link-duplex full
 ethernet-autoneg off

Because PiOS relies on dhcpcd for most of the network configuration, the configuration is slightly different compared to regular Debian network configuration. You have to define all interfaces including loopback and wlan0 (in case you have Wi-Fi) and instead of using the dhcp option, you should set the interface to manual allowing dhcpd to take over.

If you want to do this on a Raspberry Pi Zero W, your /etc/networking/interfaces configuration will need to include wlan0:

# Include files from /etc/network/interfaces.d:
 source-directory /etc/network/interfaces.d
 auto lo
iface lo inet loopback
 allow-hotplug wlan0
allow-hotplug eth0
 iface wlan0 inet manual
 wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
 iface eth0 inet manual
 link-speed 100
 link-duplex full
 ethernet-autoneg off

These settings also work if you have issues with your ethernet connection on a regular Raspberry Pi 2/3/3B/4 etc. Speed settings can be 1000, 100 or 10 depending on your lan switch. You would prefer 1Gbps (1000) if your network switch can handle it. Duplex settings are mostly full or in the odd case half if you have an old switch/hub to connect to.

This was tested on serveral models running the latest version of Raspbian GNU/Linux 10