What is hosts file and how does it differ from DNS?

The hosts file is an elementary tool of a network protocol and converts host names into numeric IP addresses. The network can only work with these addresses.

The hosts file is created in all common operating systems for PC, Mac, and mobile devices, and can be changed by system administrators. Each time you visit a website, your device first checks the hosts file for a corresponding entry or rule for the website. First of all, the hosts file is a relic of the past. In the early days of the internet, the file was used to link domain names to certain IP addresses i.

For example, the hosts file made sure that the computer knew what IP address was meant by www. Therefore, the hosts file used to contain a long list of these hosts and their special addresses. The influence of the term 'host' is still noticeable today when you speak of 'hosting a website'. For the resolution of web addresses, the domain name system DNS is used. For surfing the internet, the file is useful for blocking malicious websites , among other things. The hosts file is a very simple text file that can be opened and edited in Windows with the pre-installed editor , for example.

Firstly, you see the Windows description of the file.

How to Reset/Restore Hosts file to its Original Version in Mac/Windows

Below this you can define IP addresses and corresponding host names. The defined IP address is in a common line with the corresponding host name. It is important that the two pieces of information are separated by at least one space. You can also add comments by prefixing them with ' '. Blank lines in the text file are ignored.

What is a Mac Hosts File?

You can also edit the hosts file with a tool. For Windows, there is the free software HostsMan. The data can then be read out from the network. Otherwise it can lead to increased loading times on weak systems.

Editing Mac hosts file: What does this mean?

In order to protect your privacy, the video will not load until you click on it. Unfortunately, the hosts file is also a popular target for malware , which infiltrates the system and can change the file by itself. This can lead to users being directed to dangerous sites as well as certain addresses being blocked e.

However, with a good firewall and an active virus scanner, you can usually prevent unauthorized access to the file. It can also do no harm to check the file for unwanted entries from time to time. If you define the hosts file as read-only , you will be protecting it from unauthorized access. What do you need a localhost for? Sometimes it can be useful to communicate with yourself.

How to Edit Hosts File on Your Mac Computer

This is known as a loopback in network technology: instead of feeding a request to the network — e. We will explain how the connection to The hostname is part of the fully qualified domain name, which can be used for example to find and access websites on the internet.

A fully qualified domain name FQDN is a domain name that specifies the unique and complete address of a website. It consists of several name parts called labels, each separated by a dot. The mandatory parts of an FQDN are the host name, domain name, and top level domain of the internet presence. Without the Domain Name System, the internet as we know it today would be inconceivable. This is can be useful for blocking sites you suspect may be malicious or for locally testing websites whilst remaining offline.


  • recuperar hd externo samsung mac.
  • phone clean free for mac;
  • Editing Mac hosts file: What does this mean?.
  • Why would you modify the hosts file?;

Editing your hosts file requires using Terminal , and incorrectly editing the hosts file can have significant effects on how your Mac connects to the internet. So make sure you have a good idea of why you need to edit the hosts file before following this guide. Open Terminal.

How to Edit Hosts File on Mac

To open the hosts file use the command below you can Copy and Paste it directly into the terminal window :. Press the return key. Terminal will ask you for a password.

Enter the Administrator password for your Mac. Use the arrow keys to navigate below the last entry. Ignore the comments separated by marks and any existing entries. At this point you could use the hosts file to block sites that serve adverts, to resolve your own website to a local IP address, or for any other function.

Now you just need to save the changes.

Your Answer

You can now exit this screen and return to the main Terminal window by pressing ctrl-x. You can do this from the main Terminal window you currently have open. You have now opened , edited and saved the hosts file on your Mac.