Troubleshoot ESXi Host DNS and Routing Related Issues

It is important that name resolution is configured correctly on your ESXi hosts, as it is important for many vSphere features. Your hosts and vCenter servers should be able to do lookups against their configured DNS servers, and there should be both forward and reverse DNS records created for vCenter and each of the hosts. Using the vSphere client, the DNS settings can be found under the host’s Configuration tab, in the DNS and Routing section:

You can also list the configured DNS servers using the CLI. Do to so, use the ‘esxcli network ip dns’ namespace. For example:

~ # esxcli network ip dns server list
   DNSServers: 192.168.0.238

You can also add and remove name servers using commands under this namespace. To list, and modify, the host’s search domains, you can use:

~ # esxcli network ip dns search list
   DNSSearch Domains: vmlab.loc

Of course, having these parameters set correctly will only be of use if you can communicate with the configured DNS servers. You can use Netcat to test connectivity:

~ # nc -z 192.168.0.238 53
Connection to 192.168.0.238 53 port [tcp/domain] succeeded!

And you can use NSLOOKUP to confirm that you can perform queries against the DNS server:

~ # nslookup esxi1.vmlab.loc
Server:    192.168.0.238
Address 1: 192.168.0.238 dc01.vmlab.loc

Name:      esxi1.vmlab.loc
Address 1: 192.168.0.240 esxi1.vmlab.loc

As an alternative to esxcli, you can also use the vicfg-dns command from the vMA or vSphere CLI. Running the command without any parameters will display a host’s DNS configuration:

vi-admin@vma:~> vifptarget --set 192.168.88.134
vi-admin@vma:~[192.168.88.134]> vicfg-dns
DNS Configuration

Host Name      esxi1
Domain Name    vmlab.local
DHCP           false
DNS Servers
               10.0.0.1

You can use vicfg-dns to change a hosts DNS configuration. Running ‘vicfg-dns –help’ will display the available options. As an example here, to change the DNS server(s) that a host will use you can run:

vi-admin@vma:~[192.168.88.134]> vicfg-dns -D 10.0.0.10,10.0.0.11
Updated Host DNS network configuration successfully.

Checking the configuration again, there are now two DNS servers configured:

vi-admin@vma:~[192.168.88.134]> vicfg-dns
DNS Configuration

Host Name      esxi1
Domain Name    vmlab.local
DHCP           false
DNS Servers
               10.0.0.10
               10.0.0.11

Troubleshooting ESXi Routing Configuration

There are a number of ways to display and configure a host’s routing configuration. As I ended the last section talking about vicfg-dns, I’ll start this one by looking at vicfg-route.

To display the host’s routing table, use:

vi-admin@vma:~[192.168.88.134]> vicfg-route -l
VMkernel Routes:
Network             Netmask             Gateway             Interface
default             0.0.0.0             10.0.0.1            vmk3
10.0.0.0            255.255.255.0       Local Subnet        vmk3
10.10.20.0          255.255.255.0       Local Subnet        vmk1
192.168.88.0        255.255.255.0       Local Subnet        vmk0

The vicfg-route command can be used to add and remove static routes. To set the default vmkernel gateway:

vi-admin@vma:~[192.168.88.134]> vicfg-route 10.0.0.2
vi-admin@vma:~[192.168.88.134]> vicfg-route -l
VMkernel Routes:
Network             Netmask             Gateway             Interface
default             0.0.0.0             10.0.0.2            vmk3
10.0.0.0            255.255.255.0       Local Subnet        vmk3
10.10.20.0          255.255.255.0       Local Subnet        vmk1
192.168.88.0        255.255.255.0       Local Subnet        vmk0

As mentioned in my previous post, there are various ways for testing connectivity to external IPs and gateway addresses using CLI tools such as ESXCLI, vmkping and the DCUI.

Related posts

VMware vSphere Virtual Machine Snapshots Explained

How to Enable SSH on All ESXi Hosts using PowerCLI

How to Install VMware Tools on Debian 11

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Read More