§2023-09-12

It was booted OK, but network interface is not set up.

¶1. Network Interface is down at first boot

# ip link set end0 up
# ip addr add 192.168.2.1/24 dev end0
# ping 192.168.2.132    <-- responded well
# ip route add default via 192.168.2.254
# ping 192.168.2.254   <-- no response

# ip route
default via 192.168.2.254 dev end0
192.168.2.0/24 dev end0 proto kernel scope link src 192.168.2.1

Solutions:

$ sudo cp -v /usr/bin/dhcpcd /mnt/usr/bin
'/usr/bin/dhcpcd' -> '/mnt/usr/bin/dhcpcd'
$ sudo cp -v /etc/dhcpcd.conf /mnt/etc
'/etc/dhcpcd.conf' -> '/mnt/etc/dhcpcd.conf'
[alexlai@hc4Gentoo ~]$ sudo umount /mnt
[alexlai@hc4Gentoo ~]$ sudo eject /dev/sda
[alexlai@hc4Gentoo ~]$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    1     0B  0 disk 
# dhcpcd end0
# ping 168.95.1.1
...

¶2. systemd first boot

# systemd-firstboot --prompt --setup-machine-id

Welcome to your new installation of Gentoo Linux!

Please configure your system!

-- Press any key to proceed --
. Please enter system keymap name or number (empty to skip, "list" to list options): 232
Select 'us'
/etc/console.conf written.

. Please enter hostname for new system (empty to skip):rpi4bGentoo
/etc/hostname written
/etc/machine-id written

# systemctl preset-all

Created symlink /etc/systemd/system/sysinit.target.wants/systemd-network-generator.service -> /lib/systemd/system/systemd-network-generator.service.
Created symlink /etc/systemd/system/sysinit.target.wants/systemd-pstore.service -> /lib/systemd/system/systemd-pstore.service
Created symlink /etc/systemd/system/dbus-org.freedesktop.network1.service -> /lib/systemd/system/systemd-networkd.service
Created symlink /etc/systemd/system/multi-user.target.wants/systemd-networkd.service -> /lib/systemd/system/systemd-networkd.service
Created symlink /etc/systemd/system/sockets.target.wants/systemd-networkd.socket -> /lib/systemd/system/systemd-networkd.socket
Created symlink /etc/systemd/system/network-online.target.wants/systemd-networkd-wait-online.service -> /lib/systemd/system/systemd-networkd-wait-online.service
Created symlink /etc/systemd/system/ctrl-alt-del.target -> /lib/systemd/system/reboot.target
Created symlink /etc/systemd/system/dbus-org.freedesktop.timesync1.service -> /lib/systemd/system/systemd-timesyncd.service
Created symlink /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service -> /usr/lib/systemd/system/systemd-timesyncd.service
Created symlink /etc/systemd/system/sockets.target.wants/systemd-journald-audit.socket -> /lib/systemd/system/systemd-journald-audit.socket
Created symlink /etc/systemd/system/systemd-journald.service.wants/systemd-journald-audit.socket -> /lib/systemd/system/systemd-journald-audit.socket
Created symlink /etc/systemd/system/dbus-org.freedesktop.resolv1 ??
Created symlink /etc/systemd/system/sysinit.target.wants/systemd-resolve.service ??
Created symlink /etc/systemd/system/multi-user.target.wants/machines.target -> /lib/systemd/system/machines.target
Created symlink /etc/systemd/system/sockets.target.wants/systemd-userdbd.socket -> /lib/systemd/system/systemd-userdbd.socket
# systemctl status systemd-networkd
○ systemd-networkd.service - Network Configuration
     Loaded: loaded (/lib/systemd/system/systemd-networkd.service; disabled; vendor preset: enabled)
     Active: inactive (dead)
TriggeredBy: ○ systemd-networkd.socket
       Docs: man:systemd-networkd.service(8)

# systemctl enable  systemd-networkd
Created symlink /etc/systemd/system/dbus-org.freedesktop.network1.service → /lib/systemd/system/systemd-networkd.service.
Created symlink /etc/systemd/system/multi-user.target.wants/systemd-networkd.service → /lib/systemd/system/systemd-networkd.service.
Created symlink /etc/systemd/system/sockets.target.wants/systemd-networkd.socket → /lib/systemd/system/systemd-networkd.socket.
Created symlink /etc/systemd/system/sysinit.target.wants/systemd-network-generator.service → /lib/systemd/system/systemd-network-generator.service.
Created symlink /etc/systemd/system/network-online.target.wants/systemd-networkd-wait-online.service → /lib/systemd/system/systemd-networkd-wait-online.service.
root@h2Jammy:/home/alexlai/build/rpi-4B#
[Match]
Name=end0
 
[Network]
Address=192.168.48.7/24
Gateway=192.168.48254
DNS=8.8.8.8

or,

[Match]
Name=end0

[Network]
DHCP=yes
- reboot

# ip route
default via 192.168.2.254 dev end0
192.168.2.0/24 dev end0 proto kernel scope link src 192.168.2.1

Even everything looks OK, I still can not ping 192.168.48.254