Reach VMs in Virtualbox by hostname

Hello all,
I’m new to devops and started wt pre-requisites course. I have 2 VMs in Virtual box configured with bridge adapter. I’m able to ping both VMs from my host windows machines using their IPs. I’m just wondering if there is there any way i can ping these VMS from host, using their hostnames, as IPs may change on every reboot of VM(or not???). Im confused

Hi Vikram,
You can create an entry in /etc/hosts for each VM so you don’t have to remember the IP address.
You can ping the VM using the hostname as following ping virtualhost1 and note
that you have to add the IP and hostname of the both VMs as an entry in both VMs as below : virtualhost1 virtualhost2

But the IPs of VMs keeps changing in my case after every reboot

You can make it static ip. Check it on Internet how to do configure static ip addr.