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 111.111.111.111 with the hostname www.example.name.com you should add a new line to the hosts file so it will resemble the following:
1
2
3
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
111.111.111.111 www.example.name.com