Hosts File

The hosts file is what maps hostnames to IP addresses.

The file is located at /etc/hosts

Adding a new hostname

  • To add the IP address with the hostname you should add a new line to the hosts file so it will resemble the following:
3   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6