Update: The above method no-longer works as ifupdown is no longer installed by default on Bookworm (since October/November 2024).
There are a couple of potential workaround but both currently require that the Pi be booted and connected to a network.
Option 1 (Requires login and network access):
Option 2 (login only):Replace <some-name> and <interface-name> as appropriate.
Link local adressing only. Even if a DHCP server is available.
Option 3 (no login, no network):
Use the following code snippet in firstrun.sh as detailed above:Replace <interface-name> as appropriate.
Link local adressing only. Even if a DHCP server is available.
Untested, use with caution. Created file contents based on what was created using sudo nmcli con add con-name foo type ethernet ifname usb0 ipv4.method link-local
There are a couple of potential workaround but both currently require that the Pi be booted and connected to a network.
Option 1 (Requires login and network access):
Code:
sudo apt update
Code:
sudo apt install -y ifupdown
- Rather than modify firstrun.sh, create the file in /etc/network/interfaces.d as indicated above.
Option 2 (login only):
Code:
sudo nmcli con add con-name <some-name> type ethernet ifname <interface-name> ipv4.method link-localsudo nmcli con up <some-name>
Link local adressing only. Even if a DHCP server is available.
Option 3 (no login, no network):
Use the following code snippet in firstrun.sh as detailed above:
Code:
cat >/etc/NetworkManager/system-connections/linklocal.nmconnection <<'EOF'[connection]id=linklocaltype=ethernetinterface-name=<interface-name>[ethernet][ipv4]method=link-localEOFchmod 600 /etc/NetworkManager/system-connections/linklocal.nmconnection
Link local adressing only. Even if a DHCP server is available.
Untested, use with caution. Created file contents based on what was created using sudo nmcli con add con-name foo type ethernet ifname usb0 ipv4.method link-local
Statistics: Posted by thagrol — Wed Nov 27, 2024 2:59 pm