Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3873

Networking and servers • Re: Gadget Mode SSH

$
0
0
Unfortunately that guide is A. probably the wrong one, and B. not up to date for Bookworm. Updating is on my to do list but I've not yet got there.
I've started looking at Gadget Mode on Bookworm again. The main issue seems to be getting NetworkManager to start the interface when it is created.

Presently I'm running a script from cron @reboot that does the modprobe (moved it here from the cmdline.txt so I could see what was happening), waits for NM to show the interface, then enables it.
That's not great as NM isn't running initially, so I have put a delay in to wait for it.

I'm going to try running it as a systemd service next, and have it dependent on NM having started.

Really NM should detect the new interface and configure it automatically. I don't know why it doesn't do that.

The problem is defintely with NM. Even enabling linklocal/zeroconf on that connection resulted in no IP address and the interface being down. The issue seems to be with the default DHCP client and zeroconf (i.e. no DHCP server on that link).

The workarounds I've found so far are:
  1. Go old school: configure the interface via /etc/network/interfaces[.d] with a static IP address.
  2. Go old school: configure the interface via /etc/network/interfaces[.d] with a static IP address in the link local subnet and a second virtual interface (e.g. usb0.1) set to DHCP to cover both bases
  3. Run a DHCP server on one end of the gadget link possibly in conjunction with i, above.
  4. Install dhcpcd and configure NM to use that instead of its default dhcp client
Option ii is my current go to, especially for models without WiFi, as it can be configured by modifying firstrun.sh after flashing the OS image but before fthe first boot. Which means you can get a working network connection without needing either a keyboard, mouse, and monitor or a machine capable of reading and writing ext4 partitions.

But for your use case, I'd do the following on the 3B+/4B:
  • Tie all the usb0 interfaces into a bridge (e.g. br0)
  • Assign that bridge a static IP address via /etc/network/interfaces[.d]
  • Install dnsmasq and configure it to only hand out addresses via the bridge
  • Configure NAT and routing as required.
I'd also run RPiOS Legacy/Bullseye on the zeros to side step the whole NM thing.

Statistics: Posted by thagrol — Wed May 01, 2024 10:11 am



Viewing all articles
Browse latest Browse all 3873

Trending Articles