I have built a custom Ubuntu 22.04 install that runs unattended from a USB stick. I am now trying to add a default static IP address that the target will boot with. These systems will be booting in tiny environments that may not have DHCP or other network services, and will be be further customized by a post-install script, but I need them to be network reachable upon first bootup after cloud-init.
I will not know any mac addresses in advance, or even the interface device as this image needs to work across several classes of hardware that may have interface name format variants. Is there a way to make use of cloud-init's ability to identify a "best" physical interface, and set a static ip there? I would also like it to to grab a DHCP address on the same interface if the service is available, but that is not a necessity.
The usb stick I am creating has a vfat formatted CIDATA partition with a user-data file that works as expected. I have read in the docs that user-data cannot be used for network config, and I have tried to create a network-config file in this partition as below, but I think I am heading off down the wrong rabbit hole. Can anyone provide any advice for how to accomplish my goal?
The network-config file I have tried is:
ethernets:
eno1:
dhcp4: true
dhcp6: false
addresses: [ "192.168.1.13/24" ]```