Page cover

Changing hostnames and IP addresses of nodes in Proxmox cluster

Let's face it, we've all been there. You set up your Proxmox homelab (or even a production cluster!), everything's purring along, and then you realise you need to change a hostname or, even more daunting, an IP address. While it seems like a straightforward task, a few missteps can quickly turn a perfectly good cluster into a digital headache. (Trust me, I've learned this the hard way more than once!)

This guide aims to demystify the process of safely and effectively updating hostnames and IP addresses for each node in your Proxmox cluster. Whether you're running a small homelab like my three-node setup (pictured below!) or managing a more extensive production environment, these steps will help you avoid the pitfalls and keep your cluster humming.

Our Proxmox Cluster: Before and After

For this walkthrough, we're taking our existing Proxmox cluster, currently configured with the following nodes and their respective IP addresses:

  • pve1: 192.168.100.250

  • pve2: 192.168.100.163

  • pve3: 192.168.100.174

Our goal is to transform this setup to a more streamlined naming convention and IP scheme. We'll be re-configuring them as:

  • pmx1: 192.168.100.101

  • pmx2: 192.168.100.102

  • pmx3: 192.168.100.103

We'll tackle this process one node at a time to ensure a smooth transition and minimise downtime. Let's dive in!

Important Precaution: Back Up! Back Up!

Before you start making any changes to your Proxmox cluster, it is absolutely crucial that you perform a full backup. This includes all your:

  • LXC containers

  • QEMU virtual machines (VMs)

While this process is designed to be smooth, unforeseen issues can always arise. Having a recent backup will save you a lot of headache (and potential data loss!) if anything goes awry. Don't skip this vital step!

Steps

Now, let's walk through the necessary steps for each Proxmox node. You'll need to perform these actions on every single node in your cluster, one by one, to successfully update their hostnames and IP addresses.

## Stop pve-cluster and corosyn daemon
systemctl stop pve-cluster corosync

## Mount the filesystem locally
pmxcfs -l

## Change the hostname to pmx1 with hostnamectl
hostnamectl set-hostname pmx1.lab

## Update the IP address details as required
vi /etc/network/interfaces

auto lo
iface lo inet loopback

iface enp1s0 inet manual

auto vmbr0
iface vmbr0 inet static
	address 192.168.100.101/24
	gateway 192.168.100.1
	bridge-ports enp1s0
	bridge-stp off
	bridge-fd 0


source /etc/network/interfaces.d/*

## Update the hostname entry in /etc/hosts
vi /etc/hosts

127.0.0.1 localhost.localdomain localhost
192.168.100.101 pmx1.lab pmx1

# The following lines are desirable for IPv6 capable hosts

::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

## Update /etc/pve/corosync.conf with new host details
vi /etc/pve/corosync.conf

logging {
  debug: off
  to_syslog: yes
}

nodelist {
  node {
    name: pmx1
    nodeid: 1
    quorum_votes: 1
    ring0_addr: 192.168.100.101
  }
  node {
    name: pmx2
    nodeid: 2
    quorum_votes: 1
    ring0_addr: 192.168.100.102
  }
  node {
    name: pmx3
    nodeid: 3
    quorum_votes: 1
    ring0_addr: 192.168.100.103
  }
}


quorum {
  provider: corosync_votequorum
}

totem {
  cluster_name: cluster1
  config_version: 3
  interface {
    linknumber: 0
  }
  ip_version: ipv4-6
  link_mode: passive
  secauth: on
  version: 2
}

## Update /etc/pve/priv/known_hosts with new host details
vi /etc/pve/priv/known_hosts

pmx1 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCxViEj2DTVxZe6o3wgzc3/6CrD7SkukgPZ+xNWE9u5gZFkhASY9jDeEpj03OUt79ZZJSJDooAp3c028tzzJgazSyHEkXuaMobNesI9lpK2kA/Z7m2oODlhwKh6/svkc/2I4GpfrAUI9K7fbr0wl8JXyxIds4UYiPoODKxwPIXNQ99qi/0X5/aylqKEAS1ZvSHwQhlttL/Cr8vL+JsnqWXltAmQ0mIwCp/6OOkuUX4/bJmpOfae/fX6EQCX4TEHeijh8bx4gJzaL8r9JmsuKeEpnyUh5UCHtYrfnSn2F9aNWaVB2b5Ivxqp2KmhjZSwgQdrUTbsc02OXB6r07yl3mvZlpUPTQHme4pOW32jJgHXRoKEmfXHj1wBG6NE+MP4YXj9kKrCMpGz6BgBNw6SK7AJQcX/3zSMjuQu+6dS3ERMTZ2goDvoZBTuTeR3D6wWe0L/WNMRNH/mrLmn6qEjnmIKv3YuIlcu/AYA2Io5hC7VaSnLTKmh2QmJxTk+UB02k1E=
192.168.100.101 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCxViEj2DTVxZe6o3wgzc3/6CrD7SkukgPZ+xNWE9u5gZFkhASY9jDeEpj03OUt79ZZJSJDooAp3c028tzzJgazSyHEkXuaMobNesI9lpK2kA/Z7m2oODlhwKh6/svkc/2I4GpfrAUI9K7fbr0wl8JXyxIds4UYiPoODKxwPIXNQ99qi/0X5/aylqKEAS1ZvSHwQhlttL/Cr8vL+JsnqWXltAmQ0mIwCp/6OOkuUX4/bJmpOfae/fX6EQCX4TEHeijh8bx4gJzaL8r9JmsuKeEpnyUh5UCHtYrfnSn2F9aNWaVB2b5Ivxqp2KmhjZSwgQdrUTbsc02OXB6r07yl3mvZlpUPTQHme4pOW32jJgHXRoKEmfXHj1wBG6NE+MP4YXj9kKrCMpGz6BgBNw6SK7AJQcX/3zSMjuQu+6dS3ERMTZ2goDvoZBTuTeR3D6wWe0L/WNMRNH/mrLmn6qEjnmIKv3YuIlcu/AYA2Io5hC7VaSnLTKmh2QmJxTk+UB02k1E=

## Update /etc/issue for MOTD banner with new IP address
vi /etc/issue

------------------------------------------------------------------------------

Welcome to the Proxmox Virtual Environment. Please use your web browser to 
configure this server - connect to:

  https://192.168.100.101:8006/

------------------------------------------------------------------------------

## Reboot at the end
reboot

Once you've successfully updated the first node, simply repeat these exact same steps on the remaining two Proxmox nodes in your cluster. After you've re-configured all of them, your cluster should seamlessly reflect the new hostnames and IP addresses as intended.

Troubleshooting: Stubborn Old Hostnames

Even after a successful re-configuration, you might occasionally see the old, inactive hostname still lingering in your cluster view. Don't fret - this is usually an easy fix!

This often happens when there are stray directories from the old node names in the Proxmox configuration. To clean this up and get your cluster looking spick and span, follow these steps on each individual Proxmox node:

  1. Navigate to the nodes directory:

cd /etc/pve/nodes
  1. Identify and remove old node name directories: Look for any directories that correspond to the old, inactive hostnames. For example, if your old node was pve1 and the new one is pmx1, you might still see a directory named pve1. Carefully remove these old directories. (Replace OLD_HOSTNAME_HERE with the actual old hostname you need to remove.)

rm -rf /etc/pve/nodes/OLD_HOSTNAME_HERE 
  1. Reboot the node: After removing the directory, reboot the node to ensure the changes take full effect and the cluster refreshes its view.

After these steps, your cluster should finally reflect only the active, newly configured nodes!

Last updated

Was this helpful?