Change DNS server on vLCM Appliance

Changing the DNS server configuration on your servers is not a task you do on a daily basis. But when you have to, it is not always a straight forward action, as I experienced when trying to change the DNS server on the VMware Life Cycle Manager Appliance.

Changing the DNS configuration under Windows is no big deal and is as easy as next, next, finish. Under linux however there are multiple ways to accomplish this task depending on the linux distribution. In most cases the easiest and common way is to edit /etc/resolv.conf and restart the service.

In this case, I am working with a virtual appliance, so I want to keep the editing on the command line to a minimum.  Virtual appliances are normally managed through a management webpage, and for the vLCM appliance this is equally so. I login to the vLCM management page and under settings I see the configured IP and DNS configuration.

Unfortunately, I can only view the configuration but can’t make any changes. So I searched the VMware knowledgebase to see what the supported method for changing DNS on Photon OS was, but got nothing. Even a Google search didn’t give any good results. This left me with no other option than to dive into the command line and edit the configuration by hand.

As mentioned earlier, most linux based distributions use resolv.conf as the configuration file for DNS. However upon opening resolv.conf I saw that Photon uses “systemd-resolved” to manage name resolving and that I shouldn’t edit this file by hand.

When working with system and DNS there a few places where you can configure settings. Let’s look at them for a second:

  • /etc/resolv.conf is a symbolic link to /run/systemd/resolve/resolv.conf and is the running configuration which must not be edited by hand.
  • /etc/systemd/network/ is the configuration file for the vm’s ethernet adapter. You set the IP address, subnet mask and gateway here, but can also specify search domains, NTP and DNS.
  • /usr/lib/systemd/network this folder contains the configurations of other (virtual) adapters on the system
  • /etc/systemd/resolved.conf this file contains the configuration of DNS that would normally be located in resolv.conf

I changed both and resolved.conf with the desired DNS servers and search domains, restarted the services, and for a short time everything seemed to work. But after a reboot all settings where back to the old configuration. I was rattled and searched for some other configuration files, looked through a lot of log files, but couldn’t find the culprit.

When all seemed lost, I had a bright moment. I did a search for the old DNS IP in all files (grep -rnw '/' -e ''), and there between all the rows of text I saw the mentioning of “/opt/vmware/etc/vami/ovfEnv.xml”.

ovfEnv.xml is a file that is created at the deployment of an OVF and apparently is loaded every time the VM boots. I changed the configuration in the XML file and after a reboot the new configuration was still there.