Hello,That guide is very light on details (for instance why are they setting up two ethernet interfaces? Why are they talking about bridging them?) and mistaken in at least one place.
Running rpi-update is also not generally recommended.
You can do it withourt running dnsmasq but Network Manager doesn't play well with the ethernet gadget so you have some different hoops to jump through.
Here's the minimum you need to do:
- See and apply Bookworm Point to Point Ethernet (inc g_ether).
Code:
sudo apt update && sudo apt upgrade -y
- Add the following to your config.txt
Code:
dtoverlay=dwc2,dr_mode=peripheral
- Add the following to the end of your cmdlline.txt making sure everything remains on one line
Code:
modules-load=dwc2,g_ether
- Reboot
I'll leave configuring things on the USB host as an exercise for the reader.
You might want to take a look at USB Ethernet Gadget A Beginner's Guide but bear in mind that the networking sections have not yet been updated for Bookworm/Network Manager.
Oh, and unless you're running with no additional devices connected and with a light CPU/system load expect power issues - most USB port can't supply the current needed.
I actually posted a comment on that blog but it isn't approved yet, I found this thread in the meantime and thought to post here as well.
Can't seem to get that guide to work to create additional ethernet interfaces.
This is what I've done:
Code:
cat /boot/firmware/config.txt
Code:
[cm5]dtoverlay=dwc2,dr_mode=host
Code:
cat /boot/firmware/cmdline.txt
Code:
console=serial0,115200 console=tty1 root=PARTUUID=cc6cf2c5-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles cfg80211.ieee80211_regdom=SE
Code:
modules-load=dwc2
cat /etc/modules returns:
Code:
i2c-dev
Code:
libcomposite
Code:
sudo apt-get install dnsmasq
Code:
sudo nano /usr/local/sbin/usb-gadget.sh
Code:
chmod +x /usr/local/sbin/usb-gadget.sh
Code:
sudo nano /lib/systemd/system/usbgadget.service
sudo systemctl enable usbgadget.service
returns:
Code:
Created symlink /etc/systemd/system/sysinit.target.wants/usbgadget.service /lib/systemd/system/usbgadget.service.
systemctl status usbgadget returns:
Code:
usbgadget.service - My USB gadget Loaded: loaded (/lib/systemd/system/usbgadget.service; enabled; preset: enabled) Active: failed (Result: exit-code) since Fri 2024-08-02 23:33:10 CEST; 46s ago Process: 1680 ExecStart=/usr/local/sbin/usb-gadget.sh (code=exited, status=203/EXEC) Main PID: 1680 (code=exited, status=203/EXEC) CPU: 1msAug 02 23:33:10 rpi5 systemd[1]: Starting usbgadget.service - My USB gadget...Aug 02 23:33:10 rpi5 (adget.sh)[1680]: usbgadget.service: Failed to locate executable /usr/local/sbin/usb-gadget.sh: Permission deniedAug 02 23:33:10 rpi5 (adget.sh)[1680]: usbgadget.service: Failed at step EXEC spawning /usr/local/sbin/usb-gadget.sh: Permission deniedAug 02 23:33:10 rpi5 systemd[1]: usbgadget.service: Main process exited, code=exited, status=203/EXECAug 02 23:33:10 rpi5 systemd[1]: usbgadget.service: Failed with result 'exit-code'.Aug 02 23:33:10 rpi5 systemd[1]: Failed to start usbgadget.service - My USB gadget.
Rebootedsudo chmod +x /usr/local/sbin/usb-gadget.sh
systemctl status usbgadget returns:
Code:
usbgadget.service - My USB gadget Loaded: loaded (/lib/systemd/system/usbgadget.service; enabled; preset: enabled) Active: active (exited) since Fri 2024-08-02 23:36:19 CEST; 22s ago Process: 1680 ExecStart=/usr/local/sbin/usb-gadget.sh (code=exited, status=0/SUCCESS) Main PID: 1680 (code=exited, status=0/SUCCESS) CPU: 91msAug 02 23:36:09 rpi5 systemd[1]: Starting usbgadget.service - My USB gadget...Aug 02 23:36:14 rpi5 usb-gadget.sh[1727]: Error: unknown connection 'bridge-br0'.Aug 02 23:36:14 rpi5 usb-gadget.sh[1735]: Error: unknown connection 'bridge-slave-usb0'.Aug 02 23:36:14 rpi5 usb-gadget.sh[1739]: Error: unknown connection 'bridge-slave-usb1'.Aug 02 23:36:19 rpi5 systemd[1]: Finished usbgadget.service - My USB gadget.
Code:
DEVICE TYPE STATE CONNECTION eth0 ethernet connected Wired connection 1 lo loopback connected (externally) lo wlan0 wifi disconnected -- p2p-dev-wlan0 wifi-p2p disconnected --
Statistics: Posted by TheSwede86 — Tue Aug 06, 2024 7:44 pm