/etc/hosts is/was the precursor to the DNS system from when the Internet was in it's infancy. It's still used today for situation such as when you want to resolve a small number of local systems or in a development setup where you haven't set up DNS.
You place all hostnames that you want to resolve to an IP address in it. You can allocate multiple names to one IP address as the
localhost line in most distros have:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
If you want to add
220.127.116.11 to be your webserver, which is called
www.example.com and also access it via a shorter
www then add:
18.104.22.168 www www.example.com
In your instance, you can place all the names on one line:
22.214.171.124 www.example.com smtp.example.com pop.example.com
The order in which your system resolves these names (
/etc/hosts or DNS first) can be configured in the
hosts: line of
/etc/hosts only works from your machine. If you have a few systems, editing
/etc/hosts on each can become unwieldly.