VMWare ESXi ESXCLI Commands to Update Host DNS Servers

Problem You have a requirement to update host DNS server IP addresses on a VMware ESXi host, and want a fast, scriptable way to do it via SSH/CLI rather than clicking through the vSphere Client UI – useful for automation, host provisioning scripts, or when you’re managing a standalone host without vCenter. Resolution Connect to […]

Vmware Esxi Esxcli Commands To Update Host DNS Servers

Problem

You have a requirement to update host DNS server IP addresses on a VMware ESXi host, and want a fast, scriptable way to do it via SSH/CLI rather than clicking through the vSphere Client UI – useful for automation, host provisioning scripts, or when you’re managing a standalone host without vCenter.

Resolution

Connect to your VMWare host using PuTTy and login using the root account.

Adding a DNS Server IP Address

To add DNS servers to your connected host, run the following command:

esxcli network ip dns server add --server=8.8.8.8

Where:

  • 8.8.8.8 is your primary DNS server.

Run the same command again with a different DNS server IP address to add multiple DNS servers.

Removing a DNS Server IP Address

To remove a DNS server IP address from your VMWare ESXi host, run the following command:

esxcli network ip dns server remove --server=1.1.1.1

Where:

  • 1.1.1.1 is the DNS server IP you want to remove from your host.

Run the same command again with a different DNS server IP address to remove multiple DNS servers.

List DNS Server IP Addresses

To list the DNS server IP addresses that are now set on your VMWare ESXi host, run the following command whilst connected to your host in PuTTy:

esxcli network ip dns server list

Conclusion

This should now allow you to add and remove DNS server IP addresses from your VMware ESXi host via the CLI. You can also manage this through the vSphere Client (Host > Configure > Networking > TCP/IP configuration > DNS), which is faster for a one-off change on a single host – the CLI approach shown here is mainly worth it when scripting across multiple hosts or automating provisioning.

FAQ’s

If you are messing around with CLI commands on an ESXi host, then you really should know the below, however, these are genuine things that I have been asked in the past in the real world.

What does DNS stand for?

DNS stands for Domain Name System.

What does IP stand for?

IP stands for Internet Protocol.

What does ESXi stand for?

ESXi stands for ESX integrated.

Verifying the Change

After adding or removing DNS servers, confirm the current list with:

esxcli network ip dns server list

If you’re managing more than a handful of hosts, this is a good candidate for PowerCLI instead of per-host SSH sessions – Get-VMHostNetwork and Set-VMHostNetwork -DNSAddress let you script the same change across an entire cluster in one pass. If you’re evaluating whether to stay on ESXi/vSphere long-term or move workloads to Hyper-V, see our VMware to Hyper-V migration guide for the current 2026 picture.

🛠️

Gear We Recommend

Firewall rules are only half the story. Here’s the networking hardware we recommend for a properly segmented setup.

Browse our Networking Equipment picks on Amazon

As an Amazon Associate, TechyGeeksHome earns from qualifying purchases.


Discover more from TechyGeeksHome

Subscribe to get the latest posts sent to your email.

Andrew Armstrong

Andrew Armstrong is a UK-based IT professional with 26+ years of hands-on experience in Windows, Windows Server, SCCM/ConfigMgr, Active Directory, PowerShell, and enterprise infrastructure.

He founded TechyGeeksHome in 2010 and has published over 1,500 practical guides covering real-world IT problems and solutions. When not solving IT problems,

Andrew develops free Windows utilities including Ultimate Settings Panel, which has been downloaded over 850,000 times.