What is a loopback address

Localhost (127.0.0.1)

Localhost also plays a role in the Hosts file. In principle, this file represents a predecessor of the Domain Name System (DNS): In it, IP addresses can be assigned to the corresponding domains. If you enter the address of a website in the browser, the domain has to be translated into an IP address. In the past, the hosts file was used for this. Nowadays, however, the global DNS is usually used. The file is still present in most operating systems. You can find this under Windows \ system32 \ drivers \ etc \ hosts; on macOS and other Unix systems under / etc / hosts.

If you haven't made any changes to the file yourself, you will likely only find two entries there:

127.0.0.1 localhost

:: 1 localhost

This ensures that the name resolution for localhost does not have to run over the internet. You can also use the file to block certain websites. To do this, enter the website to be blocked in the list and assign the domain the IP address 127.0.0.1. If you - or a malicious script, for example - try to access the blocked domain, the browser will first look in the hosts file and find an entry there. Another possibility is to use the IP address 0.0.0.0.

The browser then tries to access the corresponding document (the website) on the server at 127.0.0.1. However, it will most likely not find it because the requested file is not there. However, if you have set up your own test server, it is possible that the browser will use a home.html finds what is your own file. If you have not set up a test server, a error message appear. This technology can also be used to switch off advertisements throughout the system. So that you do not have to make every entry by hand, you can find ready-made and regularly expanded hosts files on the Internet.