DNS server and search domain can be overwritten by NetworkManager mistakenly when customizing Debian 11.x/12.x/13.x
vCenter Server 7.0
vCenter Server 8.0
vCenter Server 9.0
The network interface is managed by NetworkManager.
NetworkManager will detect that an interface is re-connected which does happen during guest customization between finishing perl script execution and triggering reboot.
Because of this, /etc/resolv.conf gets updated with DHCP configuration according to the configuration file located at /etc/NetworkManager/system-connections/Wired connection 1, the content written by perl script during customization is overwritten.
This issue has been resolved in vCenter Server 9.0.2 and later versions.
Before vCenter Server 9.0.2, to workaround this issue:
1. Modify your VM or VM template by creating a new file as follows:
touch /etc/NetworkManager/conf.d/workaround.conf
2. Modify this file with vi or other text editor:
vi /etc/NetworkManager/conf.d/workaround.conf
3. Add the following lines to the file and save:
[main]dns=none