DNS IPs on default stack does not persist after rebooting the host
search cancel

DNS IPs on default stack does not persist after rebooting the host

book

Article ID: 402892

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

The host is not able to store DNS IPs on the ESXi host as the DNS information are removed after a host reboot.

Also the /etc/resolv.conf file is wiped out post reboot.

Environment

VMware vSphere ESXi 8.x

Cause

Adding the DNS servers before the host reboot was not successful

Resolution

To use manual DNS configuration, please ensure the DNS IPs are added explicitly via the vCenter UI and then verify /etc/resolv.conf before rebooting the host.

Additional Information

  • To use powercli command, use the steps below:
    • Connect to VC:
      Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
      Connect-VIServer -Server 10.161.195.52 -User [email protected] -Password SQESuq6vbN.7lJ_f
      $vmhost = Get-VMHost -Name "10.192.69.167"
    • Change DNS setting from DHCP to Manual.
      --------------------------------------
      Get-VMHostNetwork -VMHost $vmhost | Set-VMHostNetwork -DnsFromDhcp $false -Confirm:$false
      --------------------------------------
    • Without Step (2), setting DNS servers will fail with this error.
      --------------------------------------
      Get-VMHostNetwork -VMHost $vmhost | Set-VMHostNetwork -SearchDomain "corp.local" -Confirm:$false | Out-Null
      Set-VMHostNetwork : 6/25/2025 6:27:19 PM        Set-VMHostNetwork               You can specify the DnsAddress or SearchDomain parameters only if the DnsFromDhcp parameter is set to $false.
      --------------------------------------
    • Updating the manual DNS settings
      --------------------------------------
      Get-VMHostNetwork -VMHost $vmhost | Set-VMHostNetwork -SearchDomain "corp.local" -Confirm:$false | Out-Null
      Get-VMHostNetwork -VMHost $vmhost | Set-VMHostNetwork -DNSAddress "192.168.10.11", "192.168.10.12" -Confirm:$false | Out-Null
      --------------------------------------
    • Checked the resolv.conf and the configstore DB.