In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the hosts file example analysis, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
In both linux and windows systems, there is a file called hosts. It is a text format file that can be edited manually.
The purpose of the hosts file is simple: to speed up domain name resolution. It holds some of the most frequently used domain names and IP correspondence, or infrequently used but IP never changes the domain name or host address. For example, if the IP of cnblogs.com never changes, you can write it into the hosts file. When you need to access cnblogs.com in the future, you no longer need to parse DNS first, but you can find its IP address directly from the hosts file and access it directly.
From the purpose of the hosts file, we can see that the hosts file can have other functions. For example, if you want to prevent local users from accessing www.deniedwebsite.com, you can map it to an invalid IP address in the hosts file, or to a secure address such as cnblogs.com 's IP, or even directly to local IP127.0.0.1. In this way, when you visit that website in the future, because the system detects that there is already its mapping in the hosts file, the system will no longer let DNS resolve the address, but directly select the IP specified in the hosts file to access.
The following describes the format of the hosts file.
Hosts files are text files, with each address mapping on a line. The format of each line is as follows:
IP address host or domain name [alias of host] [alias of host].
The IP address and host are required. It can be followed by one or more aliases. Different fields are separated by one or more spaces (or TAB).
There can be comments in the hosts file, and the content after each line # will be ignored as comments by the system.
In a general system hosts file, there should be at least the following:
127.0.0.1 localhost localhost.localdomain
It means to map localhost to the native machine.
If there is no such line of content, there will be the phenomenon that the system does not recognize localhost. Even if it is ping localhost, it will fail. If the application calls the system function gethostbyname ("localhost"), it will get a NOT_FOUND error. This is of course. Because there is no localhost in the hosts file, the system will ask DNS to parse the localhost, and the answer should be: the host does not exist.
Thank you for reading this article carefully. I hope the article "sample Analysis of hosts documents" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.