Q:

How to connect to local servers by hostname?

I have a Ubuntu server and Centos server installed on VMware on my Windows 10 PC for testing. I don't have any domain names registered and using cable internet so my IP is dynamic.
Centos server's /etc/hostname contains the line centos1.local
Ubuntu server's /etc/hostname contains the line ubunto1.local
When I try ssh ubunto1.local from the Centos server it says unable to resolve hostname. How do I ping/connect to the other server by its hostname? I am able to ping by internal IP.

A:

If you don't want to (or can't) use DNS, then you need to edit /etc/hosts on each server and add an entry that maps an the IP of the other server to the expected hostname.

