Image

Knowledge base → File mapping names to IP addresses in operating systems (hosts)

[Virtual servers]
Date of publication: 09.08.2024

The hosts file is present in every operating system and serves to map IP addresses to names. In a sense, it performs a similar role as a DNS server, only locally on a configured server or workstation.

You can specify the desired IP address for any domain name, and when accessing it from this device through a browser, it will refer to the IP address you specified, ignoring the root DNS servers of the Internet.

1. Windows

C:\Windows\System32\drivers\etc\hosts
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 m.megafonpro.ru
127.0.0.1 mobilebanner.ru

The file is system and requires administrator rights to make changes. The operating system will issue this request when saving.

2. Linux

/etc/hosts
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 m.megafonpro.ru
127.0.0.1 mobilebanner.ru

In our examples, we remove the banner of the mobile operator when accessing via mobile Internet.

The lines starting with the # sign are disabled. The settings take effect immediately after saving the file and do not require a reboot.





No Comments Yet