Moved PVE host to new network, where else is networking info stored aside from /etc/network/interfaces, /etc/hosts, and /etc/resolv.conf?

Replicant

Member
May 31, 2021
11
6
8
43
I temporarily set up a PVE host on my home network and physically moved it to a different target network afterwards. Both networks are A.B.C.D/24 format but different IP addresses.

In the new network, I changed the static IP in /etc/hosts and the static IP and gateway in /etc/network/interfaces.
  • The machine is a single-NIC device whose interface name didn't change at all.
  • LXC containers are all DHCP
This mostly worked, aside from apt update on the host not resolving any addresses. I found this thread, apparently /etc/resolv.conf needs to be updated as well, fixing this solved apt.

As a sidenote, I performed another similar migration earlier and services in the LXC containers were accessible only via LAN but not the internet and I never figured out why - while writing this post discovered that updating /etc/resolv.conf fixed networking in LXC containers as well.


So... 3 files in total - /etc/network/interfaces, /etc/hosts, and /etc/resolv.conf - anything else needs updating?
 
  • Like
Reactions: takeokun
This will cause lots of issues to lots of people especially with cluster who will end up wondering what the heck is wrong with their corosync setup. The way PVE is designed ... it does not migrate. You will end up having the stale IPs in places like SSL X509s, SSH known_hosts, etc, etc.

I am all for PVE to support DHCP one day, but it's just a feature it does not have at the moment and for that reason you would have been better off backing up all VMs/CTs and recover into a freshly installed node.

If it was me doing it somewhere beforehand and knowing I am eventually moving it, I would create the same private IP subnet on a VLAN, then move without changing IPs.
 
Last edited:
I know this is your hobbyhorse and all but if the OP doesn't have a cluster changing the three files is all he needs to do.

ETA: If you care about the banner message when logging in on the console, also /etc/issue.
 
Last edited:
  • Like
Reactions: takeokun
The files you mentioned are totally fine and important. If you want to be sure, I'd recomment to grep for the old network info and ip in /etc just to be sure:

Code:
grep -r 1.2.3.4 /etc
grep -ri <oldhostname> /etc

Maybe some lvm files could also have your old hostname.
 
I know this is your hobbyhorse and all but if the OP doesn't have a cluster changing the three files is all he needs to do.

ETA: If you care about the banner message when logging in on the console, also /etc/issue.

That's fine, someone else might find the thread later.