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

Troubleshooting • Bookworm, Point to Point Ethernet (inc g_ether)

$
0
0
There have a been a few reports that point to point ethernet links no longer come up on Bookworm. I've posted some workarounds but so far those have all required either a way to login to the Pi via another method or the ability to read and write to the root partition.

This workaround attempts to provide a method that requires neither.

Target Situation: Any Pi device running Bookworm or using Network Manager, and with a point to point network link (e.g. a direct cabled connection or the ethernet USB gadget).

Requirements:
  • A Raspberry Pi
  • A freshly flashed RPiOS SD card (or other storage device) that has not yet been booted
  • A text editor. Preferably one that support Linux style line endings.
  • Code snippets from this post
Steps:
  1. Open the boot partition of you SD card
  2. Find firstrun.sh
  3. Open it in your text editor
  4. Scroll to the end
  5. Locate the line

    Code:

    rm -f /boot/firstrun.sh
    It's likely the third from the end.
  6. Copy and paste one or more of the following code snippets immediately above that line.
  7. Save and close.
  8. Boot Pi
Note: Using any of these code snippets will prevent Network Manager from managing the interface.

For ethernet:

Code:

cat >/etc/network/interfaces.d/eth0 <<'EOF'auto eth00allow-hotplug eth00iface eth00 inet static        address 169.254.1.1        netmask 255.255.0.0auto eth0.1allow-hotplug etc0.1iface usb0.1 inet dhcpEOF
For the USB ethernet gadget:

Code:

cat >/etc/network/interfaces.d/g_ether <<'EOF'auto usb0allow-hotplug usb0iface usb0 inet static        address 169.254.1.1        netmask 255.255.0.0auto usb0.1allow-hotplug usb0.1iface usb0.1 inet dhcpEOF
Known Issues:
  • This solution is IPv4 only.
  • Using a static IP address is not ideal. There is a 1 in 64,516 chance of a conflict.
  • If using this on multiple PI that will be connected together (e.g. using an ethernet switch) each Pi must have a unique IP address in the 169.254.0.0/16 subnet.
  • Same thing applies when using multiple Pi connected via the USB ethernet gadget to the same USB host.
  • This configures one end of the link only. Additional configuration may be required on the other end.
  • Your Pi will show two ethernet interfaces. One may not be up.
How it works:
Placing a file in /etc/network/interfaces.d makes Network Manager ignore any interfaces configured in it.

The first block configures the actual interface with a static IP address in the link local/zeroconf/mDNS/avahi/Bonjour subnet. Most modern OS on the other end of the link will fallback to this subnet in the absense of a DHCP server. The Pi can be accessed via it's configured static address.

The second block creates a virtual interface and configures ro use DHCP. If you later add a DHCP server to your network or move the Pi to a network with one it will get it's network configuration for this interface in the usual manner.

Statistics: Posted by thagrol — Wed Jan 24, 2024 4:45 pm — Replies 0 — Views 30



Viewing all articles
Browse latest Browse all 4387

Trending Articles