How does vastool join determine what the computer name will be.
How vastool join determines computer name.
At vastool joins to the domain it wants a fully qualified domain name, an fqdn. <shortname>.<domain>.
It starts with -n <name> if set, otherwise it calls gethostname() (similar to running /bin/hostname).
If the name so far is an fqdn, done. If not, it now has a <shortname>.
If it only has a shortname it makes a second call, gethostbyname(<shortname>). If that returns, then it queries the name and aliases for any fqdn name. If found, done.
This means if you have an /etc/hosts entry as so:
192.168.1.1 host1.example.com host1 alias1
And run the join as vastool ... join -n alias1 ....
Then it will find host1.example.com as a valid fqdn for the given name, and use that.
( If it is desired to use the alias1 name, specify it using -n with an fqdn. ) And if the gethostbyname doesn't return anything, then it generates a fqdn as so: <shortname>.<joined domain name>
As a final catch-all method of getting an FQDN. This is only computed at join time, then that result is stored in the misc cache, host.keytab, and on the servicePrincipalName of the host/ object in AD. If the machine's hostname or dns realm of their hostname changes after join VAS will continue to use what was set at join time.