By default ESXi is expecting to get its hostname from DHCP, and with Ubiquiti, the DCHP server is expecting the client to provide a hostname. So to fix it, you need to get on the ESXi host and use the commands esxcli system hostname set --host=hostname
and esxcli system hostname set --fqdn=fqdn
to set the hostname, and then edit /etc/dhclient-vmk0.conf
and add the line:
send host-name = concat(gethostname(), "dynamic-value");
to have ESXi send its hostname. You can hardcode the hostname here instead of the gethostbyname, but this way it lets you have a generic modification that should follow even if you rename the host.
Possible dhclient options:
send host-name "static-value";
send host-name = concat(gethostname(), "dynamic-value");
Run these commands to change the hostname in ESXi 5.x, ESXi 6.x,ESXi 7.x, using the command line:
esxcli system hostname set --host=hostname
esxcli system hostname set --fqdn=fqdn