Just like domain names on the Internet, hostnames within a network are unique as well. A hostname is a Fully Qualified Domain Name that uniquely and absolutely names a computer and it is used to distinguish between different computers on the same network.
How would you configure a second hostname in a “normal”/ manual way?
for example. This is useful if you’re running many services on a single VM that would ordinarily be deployed to different infrastructure. Or if you have apache virtualhosts or nginx servers etc. It’s a pretty common use case, actually.
Sure, but this is not the hostname set by hostname. It’s more like using aliases.
config.vm.hostname is the value you would see using hostname. And that is unique. You could just add additional entries to /etc/hosts using a provisioner.
Oh and for what it’s worth editing the /etc/hosts file with a provisioner is exactly what I do here. I was just reading the docs and thought that maybe I could do
Vagrant only accepts one hostname for the config.vm.hostname option. Maybe a more useful way to think of that option is "what should be returned from the guest when I run a hostname"
But, it looks like maybe this vagrant-hostmanager plugin might do what you’re after?
Cheers