IP Address Not Assigned in Ubuntu VM Deployment

LRademakers

New Member
Feb 19, 2025
2
0
1
Hi,

I am currently working on deploying a VM, running Ubuntu 24.04.1 server, using OpenTofu. This has been successful; however, the network configuration is not working. Somehow, it is being correctly taken over and added to the Cloud-Init, but when I run the command 'ip a' on the VM, I see that the ens18 interface has not been assigned an IP address. Is there a way to configure this?

Additional information: It is important to note that the VM does not have an internet connection, and the IP address is configured to communicate with the other VMs. There is a second network interface, but it is intended for managing the hosts (devices). It may also be important to know that I am using the "bpg/proxmox" provider.

Code has been added: Code based on the documentation of the BPG/Proxmox provider link.

Code:
resource "proxmox_virtual_environment_vm" "ubuntu-server" {
  name        = "ubuntu-server"
  description = "Managed by Open Tofu"
  tags        = ["OpenTofu", "Ubuntu"]

  node_name = "host-proxmox-01"
  vm_id     = 115

  keyboard_layout = "en-us"
  scsi_hardware   = "virtio-scsi-single"
  started         = true

  agent {
    enabled = true
  }

  cpu {
    cores        = 2
    type         = "x86-64-v2-AES"  # Recommended for modern CPUs
  }

  memory {
    dedicated = 2048
    floating  = 2048 # Set equal to dedicated to enable ballooning
  }

  disk {
    datastore_id = "local-lvm"
    file_format  = "raw"
    interface    = "scsi0"
    size         = 32
  }

  cdrom {
    file_id      = "local:iso/ubuntu-24.04.1-autoinstall.iso"
    interface    = "ide1"
  }

  initialization {
    datastore_id = "local-lvm"
    interface    = "ide2"

    dns {
      servers = [
        "192.168.100.1"
      ]
    }

    ip_config {
      ipv4 {
        address = "192.168.100.10/24"
        gateway = "192.168.100.1"
      }
    }
  }

  network_device {
    bridge      = "vmbr1"
    model       = "virtio"
  }

  operating_system {
    type = "l26"
  }
}
 

Attachments

  • Cloud-Init(Configuration).png
    Cloud-Init(Configuration).png
    14.7 KB · Views: 4
Last edited: