Posted by: fdpower October 16, 2017
To linux and devops gurus
Login in to Rate this Post:     0       ?        
Little late here but I suggest you to look into what DNS is and how it works. After you know what DNS is and how it works, you will find it easy to google because you will know what you are looking for. DNS is the backbone of internet so it is very very important concept if you are trying to get into IT.

Basically, in layman's term, DNS is just an infrastructure that is able to convert hostnames to IP address and vice versa. The infrastructure part is actually very interesting and complex and I wouldn't to justice trying to explain it to you here but. Google (TLD , and explore DNS RFC )

What i can explain you is how DNS is used. Internet address is numbers(IP address) and subnets(network segments). DNS give it a meaningful name so that you can write google.com vs an ip address.

In your case, you are running on VM. The VM software assigns a virtual network interface and all the guest hosts are assigned an IP address under that network interface by default. Since your host machine cannot talk to the guest machine because they are in different NETWORK by default. However most of the VM software also adds a bridge so that those two networks can talk to each other.
Now the DNS part, when you ping a hostname such as myguesthostname , Microsoft looks into its TCP / IP stack order which goes like this
-- check if it's querying for itself.
-- check on the local hostfile
-- send a query to its configured DNS server
-- And finally netbois as a backup.

Since the first logical place is to checks is hostfile , you edit the host file to map the hostname to the IP address as the simplest soution. all the host file says is hey if my computer asks for this hostname it actually this IP address.

You can also add an A record for that VM in your DNS server as a workaround but who has a local DNS server at home right ? (actually I do lol). Obviously, you can't add the A record in the public DNS(unless you own the domain) so the easiest solution for you is to add it to the local host file.

----



Last edited: 16-Oct-17 03:36 PM
Read Full Discussion Thread for this article