Summary
Needed to change DNS servers from one to the other within my lab on ESXi 6.7. Needed to do this because I’ve been isolating network resolution to my local network as opposed to pushing that traffic to the Internet itself.
Before I was using Cloudflare’s DNS resolvers for name resolution. To add another layer DNS resolution is now done through local caches and resolvers. Traffic for name resolution is also blocked from going out to the Internet for every host on the network except for the local DNS resolver.
There is no set command for the DNS server list in the esxcli command. So in order to configure a new DNS server you must either add it first or remove it before adding it.
Checking Current DNS Server List
The following command will check the list of DNS servers configured on the system currently.
esxcli network dns server list
Below is the current output before moving on to the next section.
DNSServers: 1.1.1.1
Removing DNS Server
The command below will remove the 1.1.1.1 Cloudflare address from the DNS server list. Running the server list command would show an empty list of DNS servers.
esxcli network ip dns server remove --server="1.1.1.1"
Adding DNS Server
This command will add the new INF server to the DNS server list.
esxcli network ip dns server add --server="192.168.0.50"
Listing New DNS Server List
Time to list and see the new server list.
esxcli network ip dns server list
Looks like the new DNS server list is showing the name server that I configured. Now it’s time to test. Don’t need to do anything extensive. Just basic name resolution and call it a day.
DNSServers: 192.168.0.50
Testing
Just to make sure name resolution is successful and it’s querying the correct servers for it. This is done through the CLI on the ESXi server where the changes were made.
nslookup lab-inf-01.lab.example.org
Below is the output. Looks like it’s doing so without an issue. The server resolved the IP address of the INF server within the lab network.
Server: 192.168.0.50
Address: 192.168.0.50:53
Non-authoritative answer:
Name: lab-inf-01.lab.example.org
Address: 192.168.0.50
Non-authoritative answer: