In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "what is the use of hosts files under the Linux system". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Hosts file
Hosts-- the static table lookup for host name (hostname query static table).
The hosts file is a file responsible for the rapid resolution of ip addresses and domain names on the Linux system, which is saved in the / etc/ directory in ascii format. The hosts file contains the mapping between the ip address and the host name, as well as the alias of the host. In the absence of a domain name resolution server, all network programs on the system resolve the ip address corresponding to a host name by querying the file, otherwise they need to use dns service programs to solve the problem. Through the commonly used domain name and ip address mapping can be added to the hosts file to achieve fast and convenient access.
Priority: dns cache > hosts > dns service
Hosts format configuration
The hosts file can configure the host ip and the corresponding hostname. On the local area network or the World wide Web, each host has an ip address, which distinguishes each host and can communicate according to the ip. But the Ip address does not conform to the memory rule of the human brain, so there are domain names, such as www.baidu.com. In a local area network, each machine has a hostname, which is used to distinguish between hosts and facilitate mutual access.
Hosts file format
Ip address hostname / domain name (host alias)
The difference between a hostname and a domain name is:
The host name is usually used in the local area network, and the host name is resolved to the corresponding ip through the hosts file.
Domain names are usually used on internet, but their priority is lower than those in hosts files, so if you don't want to use domain name resolution on internet, you can change your hosts file and add your own domain name resolution.
The function of hosts file
One of the main functions is: offline environment simulation, if the two sides of communication want to access each other through the domain name on internet in the same local area network, they only need to modify their own / etc/hosts file content.
For example, modify the ip of www.baidu.com to 127.0.0.1:
After modifying / etc/hosts, the effect of ping Baidu is as follows:
This is the end of the content of "what is the use of hosts files under the Linux system"? thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.