The /etc/hosts file defines the Internet Protocol (IP) name and address of the local host and specifies the names and addresses of remote hosts.
The /etc/hosts file contains the Internet Protocol (IP) host names and addresses for the local host and other hosts in the Internet network. This file is used to resolve a name into an address (that is, to translate a host name into its Internet address). When your system is using a name server, the file is accessed only if the name server cannot resolve the host name.
Address is an IP address specified in either dotted decimal or octal format, and HostName is the name of a host specified in either relative or absolute domain name format.
How to edit the /etc/hosts file
You have to change the permissions.
sudo chmod 777 /etc/hosts
The default file permissions for /etc/hosts
If you changed the permissions you can switch it back.
sudo chmod 644 /etc/hosts