Close Menu
DPC Virtual Tips
    Read More

    How to Investigate TCP Retransmissions on Linux

    August 11, 2026

    Slurm Node Is DRAINED: How to Find the Exact Reason

    August 10, 2026

    Why Is My Slurm Job Pending? How to Decode Every Common Reason

    August 9, 2026
    • Home
    • About Us
    • Contact
    • Cookie Policy
    • Comment Policy
    • Privacy Policy
    • Terms of Use
    • Disclaimer
    Tuesday, August 11
    DPC Virtual Tips
    • Home
    • Operating Systems
    • PowerFlex
    • HPC
    • Virtualization
    • About the Author
    • About Us
    • Contact
    DPC Virtual Tips
    Home » Changing DNS Settings on ESXi Hosts
    Virtualization

    Changing DNS Settings on ESXi Hosts

    DaniloBy DaniloMay 20, 2025Updated:August 5, 2026No Comments2 Mins Read
    Facebook Twitter Pinterest LinkedIn Tumblr Email
    Changing DNS Settings on ESXi Hosts
    Share
    Facebook Twitter LinkedIn Pinterest Email

    Changing DNS Settings on ESXi Hosts is an article that shows an automated approach to changing the DNS configurations on all connected ESXi hosts under the same vCenter Server, using a Python script.

    The idea is to use a Linux CentOS 9 as a script server. We’ll execute a Python script from this server to connect to each ESXi host and upgrade the VMware Tools.

    1- Install CentOS 9 (without GUI) – We have tested it with CentOS 9, but feel free to install a different Linux flavor and adjust the script to run on it.

    2- Access it by SSH with root rights and install Python:

    curl -O https://raw.githubusercontent.com/danchiacchio/scripts/refs/heads/main/sh_PythonInstall/install-python.sh
    
    chmod +x install-python.sh
    
    ./install-python.sh

    Grab a coffee and wait for a while. The automated Python install takes a while to complete! ☕

    3- Creating a working directory (something such as /root/scripts/py_vESXiDNS) – you can choose the directory name:

    mkdir -p /root/scripts/py_vESXiDNS

    4- Go to the working directory and download the Python script “py_vESXiDNS.py“:

    cd /root/scripts/py_vESXiDNS
    
    curl -O https://raw.githubusercontent.com/danchiacchio/scripts/refs/heads/main/py_vESXiDNS/py_vESXiDNS.py
    
    pip install pyvmomi paramiko

    5- Run the Python script:

    chmod 700 py_vESXiDNS.py
    
    python py_vESXiDNS.py

    Rechecking the DNS config after changing the DNS Servers and DNS domain name:

    In the following picture, we run the nslookup inside each ESXi host. The command failed because we’re using an unreachable DNS server:

    After fixing it (changed to a working DNS server):

    That’s it 🙂

    Note: So, I tested it several times in a lab environment, and it worked as expected. However, be careful when executing it in a production environment. We’ll not be responsible for downtime or weird behavior in your environment!

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleChanging NTP Settings on ESXi Hosts
    Next Article Setting Up a DHCP Relay on VyOS
    Danilo

    Infrastructure Engineer with experience in Virtualization, Linux, Windows Server and learning automation using Python. DPC Virtual Tips was created to share practical tutorials, lab experiences and troubleshooting guides focused on enterprise infrastructure technologies.

    Related Posts

    VM Replication with vSphere Replication and Site Recovery Manager

    June 16, 2025

    Changing NTP Settings on ESXi Hosts

    May 19, 2025

    Upgrading VMware Tools on ESXi Hosts

    May 13, 2025

    Comments are closed.

    Search
    Categories
    • HPC (10)
    • Operating Systems (83)
    • PowerFlex (22)
    • Virtualization (129)
    Read More
    Operating Systems

    How to Investigate TCP Retransmissions on Linux

    By DaniloAugust 11, 20260
    HPC

    Slurm Node Is DRAINED: How to Find the Exact Reason

    By DaniloAugust 10, 20260
    HPC

    Why Is My Slurm Job Pending? How to Decode Every Common Reason

    By DaniloAugust 9, 20260
    Operating Systems

    Linux Process Resource Usage: How to Find Heavy Processes

    By DaniloAugust 6, 20260
    HPC

    Lustre Filesystem Commands: A Practical Admin Guide

    By DaniloAugust 5, 20260
    Latest Posts

    How to Investigate TCP Retransmissions on Linux

    August 11, 2026

    Slurm Node Is DRAINED: How to Find the Exact Reason

    August 10, 2026

    Why Is My Slurm Job Pending? How to Decode Every Common Reason

    August 9, 2026
    Images from Gallery
    hpc main commands
    linux commands
    install rock linux
    lustre fs
    shell scripting
    vSAN Trace Files
    Categories
    • HPC
    • Operating Systems
    • PowerFlex
    • Virtualization
    • Home
    • About Us
    • Contact
    • Cookie Policy
    • Comment Policy
    • Privacy Policy
    • Terms of Use
    • Disclaimer
    Copyright © 2026, DPC Virtual Tips. All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.

    We use cookies to ensure your best experience on our website. If you continue using our website, we'll assume you agree to our cookie policy