Summary

/etc/hosts provides local hostname-to-IP mappings. It can override DNS resolution depending on the system’s /etc/nsswitch.conf.
This file is very useful when DNS is unavailable or when you need to resolve internal hosts manually which you often need to do in boxes.

Format

IP_ADDRESS    FQDN    HOSTNAME    # COMMENT

10.10.10.10 - IP address
dc01.example.com - fully qualified domain name
dc01 - short hostname
# - comment

Example:

10.10.10.10    dc01.example.com    dc01
10.10.10.20    files.example.com   files