A long time I wondered why I saw ESXi systems on my local network have two entries in their /etc/hosts
file:
[root@ESXi-X10SRH-CF:~] cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost ::1 localhost.localdomain localhost 192.168.71.91 ESXi-X10SRH-CF ESXi-X10SRH-CF
Then I bumped into someone who had a different setup:
[root@ESXi-X10SRH-CF:~] cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost ::1 localhost.localdomain localhost 192.168.0.23 esxi.dynamic.ziggo.nl esxi
So now I knew that the first entry can have a domain resolving it (it still makes be wonder why ziggo is using a top-level domain to resolve local stuff; but searching for dynamic.ziggo.nl did not get me further on that).
So I installed a quick ESXi machine on that local network, and got the same.
When back home the machine still thought it was esxi.dynamic.ziggo.nl
, though clearly I was outside a Ziggo network
I wanted to get rid of it, but that was hard.
Since I forgot to take screenshots beforehand, I can only provide the ones without a search domain bellow.
Reminder to self: visit someone within the Ziggo network, then retry.
Normally you can edit things like these in the default TCP/IP stack. There are two places to change this:
- Web interface, at 192.168.71.91/ui/#/host/networking/netstacks/defaultTcpipStack:
- The fields “Domain name” and “Search domains” are mandatory.
- DCUI, under “Configure Management Network”
Neither of these allowed me to change it to a situation like this, but luckily the console did.
In the below files, I had to remove the bold parts, then restart the management network (I did keep a text dump, lucky me):
[root@esxi:/etc] grep -inr ziggo . ./vmware/esx.conf:116:/adv/Misc/HostName = "esxi.dynamic.ziggo.nl" ./resolv.conf:2:search dynamic.ziggo.nl ./hosts:5:192.168.71.194 esxi.dynamic.ziggo.nl esxi [root@esxi:/etc] cat /etc/resolv.conf nameserver 192.168.71.3 search dynamic.ziggo.nl [root@esxi:/etc] cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost ::1 localhost.localdomain localhost 192.168.71.194 esxi.dynamic.ziggo.nl esxi
Future steps
- Read more on local domains, search domains and related topics
- Configure a local domain on my local network, so DHCP hands it out, and DHCP handed out host names are put in the local DNS
- Test if all services on all machines still work properly
Reading list
- Zero-configuration networking – Wikipedia
- Multicast DNS – Wikipedia
- .localhost – Wikipedia
- .local – Wikipedia
- “esxi 6.7” dhcp configuration – Google Search
- esxi 6.7 dns settings – Google Search
- esxi edit “search domain” – Google Search
- [WayBack] Setting the DNS Configuration with ESXCLI
The
esxcli network ip dns
namespace includes two namespaces.esxcli network ip dns search
includes commands for DNS search domain configuration.esxcli network ip dns server
includes commands for DNS server configuration.
- [Archive.is] vSphere Documentation Center: You can set the DNS configuration with ESXCLI or with vicfg-dns.
- [WayBack] Setting the DNS Configuration with ESXCLI
- “dynamic.ziggo.nl” – Google Search
- VMotion fails if source and target ESX Hosts cannot resolve the other’s hostname (7985808)
- [WayBack] Add an Entry to ESXi /etc/hosts using PowerShell – vHersey – VCDX Two to the Seventh Power (#128)
I could use vCLI, and that would be easy enough, but I wanted to figure out a way to do with PowerShell. In the article @lamw mentions the file management interface can be accessed with standard GET/PUT operations. The file management interface can be accessed with a Web Browser without enabling SSH on the ESXi host.
- ESXi 6.5: change the host name in the “new” vSphere HTML5 Web Client, or using DHCP option 12
- [WayBack] Setting static DNS record for each DHCP lease – MikroTik Wiki
- mikrotik dhcp server set dns search domain – Google Search
–jeroen