Best practice question - Should static IP reassignment take place using cloud-init image or directly in the VM?

HardyBiscuit

Member
Oct 10, 2022
16
2
8
Used cloud image Ubuntu server for creating a template and, of course, used cloud-init. For my templates and (initial) clones, I have it set to dhcp, just to be sure access can be had. However, I static assign all of my devices after cloning. This is actually the first time I have used this method and noticed that since I used cloud-init, that it seems to be controlling all IP Addressing within. (i.e. no /etc/netplan/01-netcfg.yaml file. Instead, I have a /etc/netplan/50-cloud-init.yaml, e.g.

YAML:
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    version: 2
    ethernets:
        eth0:
            addresses:
            - 192.168.10.40/24
            gateway4: 192.168.10.5
            match:
                macaddress: ae:61:e7:0f:64:b2
            nameservers:
                addresses:
                - 192.168.10.5
                search:
                - miller.home
            set-name: eth0

(Note, this is what it looks like after I assign a static). This might be a basic question, but it seemed to me that logically I go into the cloud-init image, change to static with the proper info, regenerate image, reboot and have it continue to provide the networking. Is this the best way to handle it? It doesn't really matter to me much, was just curious and couldn't find the answer elsewhere.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!