Automating hostname assignment based on VMID in Proxmox

exhani

New Member
Mar 19, 2024
1
0
1
Hello everyone,

I hope you're all doing well!

I’m looking for advice on automating hostname assignment for newly created VMs in Proxmox. Specifically, I’d like each VM to automatically take a hostname based on its VM ID, following this format:

<vmid>.domain.com

For example:
  • vmid10.domain.com
  • vmid599.domain.com
Additionally, each VM is assigned a public IP address.

In this case, domain.com is the company domain associated with these VMs.

If anyone has experience with this or can suggest the best way to implement such automation, I’d greatly appreciate your input.

Thank you in advance for your help!
 
Last edited:
Hi,
if ip assignment is done by dhcp, you could assign the hostname in this way too.
Another option would be the use of qm guest exec to set the hostname in the vm. This requires the qemu agent to be enabled in vm config and the package itself to be installed in the vm.
 

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!