While this tutorial concentration on the host file in Linux, the host file is accessible in all operating units, including Home windows and Mac OS.
How the Host File Is effective
The host file functions as a nearby DNS document, but it can take better precedence than a DNS server. The moment a client queries for a domain title this sort of as http://linuxhint.com, the area title requirements to translate to its corresponding IP deal with.
The system will initially search the host file for the entry that factors to linuxhint.com. If it does not exist, the technique moves on to query the DNS servers this kind of as Google servers, CloudFlare, or a person offered by your World wide web Provider.
The host file is helpful when you are operating on nearby or internal networks, and you will need your device to acknowledge the regional domains. The host file also makes it possible for you to block numerous domains by including entries pointing to invalid or neighborhood addresses.
Permit us examine how to modify the Linux host file.
How to Edit the Linux Host File
Editing the Linux host file is extremely simple as it is a uncomplicated text file. On the other hand, it does stick to a particular structure:
IP Address Domain Title ALIAS
Below is an illustration of an entry in the Linux host file:
10.10.10.213 interior.linuxhint internal.net.area
To edit the host file positioned in:
Use your favorite text editor:
The 1st section permits you to include IPv4 addresses and their corresponding domain names. In the 2nd area, you can insert IPV6 addresses.
You can add any area and its corresponding IP to the host file or even an invalid 1 if you would like to block a site.