How to set up a connection to OpenWrt on a Raspberry Pi Zero 2W through a USB-Ethernet HUB with RTL8152B chip?
Problem:
A Raspberry Pi Zero 2W with OpenWrt installed is not accessible on the network when connected through a USB-Ethernet HUB with RTL8152B chip.
Equipment used:
- Raspberry Pi Zero 2W
- SanDisk 32GB Class10 microSD card
- USB-Ethernet HUB with RTL8152B chip (RJ45 + 3 USB ports)
- USB 3.0 card reader
OpenWrt firmware:
- Image written via Raspberry Pi Imager
- Used image: openwrt-24.10.2-bcm27xx-bcm2710-rpi-3-ext4-factory.img
- Image downloaded from the official OpenWrt website
Sequence of actions:
- Write OpenWrt image to microSD card
- Install microSD card in Raspberry Pi Zero 2W
- Connect USB-Ethernet HUB with RTL8152B chip
- Connect Ethernet cable to HUB
- Power on Raspberry Pi
Current state:
- Activity indicator on Raspberry Pi is blinking (loading in progress)
- Link indicator on RJ45 port is constantly on
- Computer doesn’t detect new network device
- IP address 192.168.1.1 is not accessible
- No new network interface appears in ipconfig and arp -a output
Question:
What actions need to be taken to ensure network access to the Raspberry Pi Zero 2W with OpenWrt through the USB-Ethernet HUB with RTL8152B chip? Is manual activation of the rtl8152 driver or network interface configuration via UART required?
Raspberry Pi Zero 2W with OpenWrt requires manual installation of the RTL8152B driver through the kmod-usb-net-rtl8152 package, as this module is often missing from the base firmware. You also need to check the network interface configuration and, if necessary, perform initial setup via UART to activate the network.
Table of Contents
- Main Problems and Their Solutions
- Installing the RTL8152B Driver
- Network Interface Configuration
- Alternative Connection Methods
- Testing and Diagnostics
- Common Errors and Their Solutions
Main Problems and Their Solutions
The main issue is that the driver for the RTL8152B chip is not always included in the base OpenWrt firmware for the Raspberry Pi Zero 2W. According to OpenWrt forum research, many users have encountered the same situation where the USB-Ethernet adapter is not automatically recognized.
Problem causes:
- Missing
kmod-usb-net-rtl8152kernel module in the base build - Version conflicts between kernel and driver
- USB port power issues on the Raspberry Pi Zero 2W
- Need for manual network interface activation
The solution involves manually installing the required driver and then configuring the network interface. As noted in one forum, “USB ports are recognized, but the Ethernet port doesn’t work” without installing the correct module.
Installing the RTL8152B Driver
Method 1: Via Command Line (opkg)
- Connect to the Raspberry Pi Zero 2W via console (UART or USB-OTG)
- Update the package list:bash
opkg update
- Install the required modules:bash
opkg install kmod-usb-net-rtl8152 opkg install kmod-mii opkg install kmod-crypto-sha256
Important: Additional dependencies may sometimes be required. As noted in the OpenWrt documentation, the
kmod-usb-netandkmod-miipackages may be needed for RTL8152B to function.
Method 2: Through LuCI Web Interface
- Access the LuCI interface at the address (if available)
- Navigate:
System→Packages - Click “Install package” and install:
kmod-usb-net-rtl8152.ipkkmod-mii.ipk
- Reboot the device after installation
Method 3: Manual Installation via USB Drive
If the network is unavailable, use this method:
- Download the required packages on another computer from the official OpenWrt repository
- Copy them to a USB drive
- Connect the drive to the Raspberry Pi
- Install the packages manually:bash
opkg install /mnt/sda1/kmod-usb-net-rtl8152_*.ipk
Network Interface Configuration
After installing the driver, you need to configure the network interface:
1. Device Recognition Check
Run the command to check if the USB adapter is recognized:
lsusb
You should see output similar to:
Bus 001 Device 005: ID 0bda:8152 Realtek Semiconductor Corp. RTL8152 Fast Ethernet Adapter
2. Network Interface Check
Check which interfaces were created:
ifconfig -a
An interface such as eth1 or usb0 should appear.
3. Interface Configuration in UCI
Add configuration for the new interface:
uci set network.usb=interface
uci set network.usb.proto='dhcp'
uci set network.usb.type='bridge'
uci commit network
4. Network Restart
/etc/init.d/network restart
If the interface didn’t appear automatically, you can create it manually:
ifconfig eth1 up udhcpc -i eth1
Alternative Connection Methods
Connection via UART (for initial setup)
If Ethernet isn’t working, set up access via UART:
- Connect to the Raspberry Pi GPIO pins:
- TX (GPIO 14) → Adapter RX
- RX (GPIO 15) → Adapter TX
- GND → GND
- Use a terminal program (PuTTY, minicom, screen)
- Baud rate: 115200, 8N1
- Login:
root, password: empty
Temporary Access via USB-OTG
The Raspberry Pi Zero 2W supports USB On-The-Go:
- Connect the Pi Zero 2W to a computer via USB cable
- A RNDIS network interface should appear on the computer
- Use the IP address 192.168.7.1 to access the Pi
Testing and Diagnostics
Diagnostic Commands:
-
Module Loading Check:
bashlsmod | grep rtl8152
-
Kernel Log Check:
bashdmesg | grep -i rtl8152
-
Network Status Check:
bash/etc/init.d/network status
-
Routing Table Check:
bashroute -n
Possible Diagnostic Results:
- Module not loaded:
lsmoddoesn’t show rtl8152 - Driver error: errors in
dmesg - Interface conflict: multiple interfaces of the same type
Common Errors and Their Solutions
Error 1: “Unknown package ‘kmod-usb-net-rtl8152’”
Solution: Ensure you’re using the correct package architecture for the Raspberry Pi Zero 2W (arm_arm1176jzf-s_vfp). Check kernel version compatibility.
Error 2: USB adapter is recognized but not working
Solution: Try disabling USB power saving:
echo 'max_suspend=-1' > /sys/bus/usb/devices/1-1/power/autosuspend_delay_ms
Error 3: No response when connecting Ethernet
Solution: Check USB port power. The Raspberry Pi Zero 2W may not provide sufficient current for some USB-Ethernet hubs. Try using external power.
Error 4: Interface not created after driver installation
Solution: Check driver version compatibility with the kernel. Sometimes you need to manually rebuild the module or use an older/newer version of OpenWrt.
Sources
- Installing kmod-usb-net-8152 on a RPi Zero - OpenWrt Forum
- Realtek RTL8152B drivers for Pi Zero W - Raspberry Pi Forums
- USB-ethernet adapter not working on OpenWrt - OpenWrt Forum
- Raspberry Pi + OpenWrt, via USB On-The-Go
- Configuring a Raspberry Pi Zero with USB Ethernet and OpenWRT
- Rpi 4 Ethernet Hat via GPIO - OpenWrt Forum
- OpenWrt on Raspberry Pi 4 (and CM4) – WebIT Tech Blog
Conclusion
To successfully set up an RTL8152B USB-Ethernet hub on a Raspberry Pi Zero 2W with OpenWrt, you need to:
- Install the kmod-usb-net-rtl8152 driver via opkg or the LuCI interface
- Check device recognition with the lsusb command
- Configure the network interface in the UCI configuration
- Restart the network to apply changes
- Use UART if necessary for initial setup
If standard methods don’t work, try alternative approaches: temporary connection via USB-OTG, checking USB port power, or using an external power source. Always check kernel and driver version compatibility, as this is a common cause of RTL8152B issues on OpenWrt.