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 > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to understand etc and hosts, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
1the ip configuration file of the host name and host name.
Hosts---The static table lookup for host name (hostname query static table)
The / etc/hosts of linux is the file that configures the ip address and its corresponding hostname, where you can record the ip of the local or other host and its corresponding hostname.
This configuration file may be different for different versions of linux. For example, the corresponding file of Debian / etc/hostname.
2, the purpose of the configuration file
This file can configure the host IP and its corresponding hostname, and its role for server-type linux systems can not be ignored.
On a local area network or INTERNET, each host is assigned an IP address, which distinguishes each host and can communicate according to IP. But the IP address is not easy to remember, so there is a domain name. In a local area network, each machine has a hostname, which is used to distinguish between hosts and facilitate mutual access.
The configuration file for linux hostnames is / etc/hosts;. This file tells the host which domain names correspond to which ip and which hostnames correspond to which ip:
For example, there is such a definition in the file.
192.168.1.100 linumu100 test100
Assuming that 192.168.1.100 is a web server, typing http://linumu100 or http://test1000 in the page will open the page of 192.168.1.100.
Typically, this file first records the ip and hostname of the machine:
172.0.0.1 localhost.localdomain localhost
3. Description of configuration file format
The contents of general / etc/hosts are generally similar to the following:
127.0.0.1 localhost.localdomain localhost
192.168.1.100 linumu100.com linumu100
192.168.1.120 ftpserver ftp120
In general, there is a host at the end of each line of the hosts file, and each line is made up of three parts, each separated by spaces.
Part one: network IP address
Part II: hostname or domain name
Part III: host name alias
Of course, each line can also be divided into two parts, namely, the host IP address and the host name.
The difference between hostname (hostname) and domain name (domain):
The hostname is usually used in the local area network. Through the hosts file, the hostname is resolved to the corresponding IP
Domain names are usually used on INTERNET, but if you don't want to use domain name resolution on internet, you can change the hosts file to add your own domain name resolution.
4what problems can be solved by the file "4 hosts"?
4.1 slow remote login to linux host
Sometimes the client wants to log in to a linux host remotely, but it will wait a long time to enter after entering the password. This is because the linux host needs to resolve the IP when returning information. If the client's IP address is added to the hosts file of the linux host in advance, it will be very quick to log in to linux remotely from the client.
4.2 dual computer interconnection
When two hosts are only connected to each other, both hosts need to set their own ip and add their own ip and hostname to each other's hosts file.
5. Hostname modification tool hostname
Hostname---show or set the system's hostname
Show hostname:
# hostname
Display the host IP:
# hostname-I
Temporarily set the hostname:
# hostname test100
The above is how to understand etc and hosts. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
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.