Parsing the hosts file in the Unix system

  
About /etc/host, hostname and IP configuration file:
Hosts - The static table lookup for host name
Linux /etc/hosts is configured The ip address and its corresponding host name file, here you can record the ip of the local or other host and its corresponding host name. This configuration file may be different for different linux versions. For example, the corresponding file for Debian is /etc/hostname.
Configuration file:
This file can be configured with the host ip and the corresponding host name. For the server type linux system
its role can not be ignored. On a LAN or INTERNET, each host has an IP address that separates each host and can communicate based on ip. But the IP address is not convenient to remember, so there is a domain name. In a local area network, each machine has a host name that is used to distinguish hosts and facilitate mutual access.
The configuration file of the Linux host name is /etc/hosts; this file tells the host which domain names correspond to those ips, 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, entering http://linumu100 or http://test100 on the web page will open the 192.168.1.100 web page.
Normally this file first records the ip and host name of the machine:
127.0.0.1 localhost.localdomain localhost
Configuration file format description:
The contents of general /etc/hosts are generally as follows Similar content:
127.0.0.1 localhost.localdomain localhost
192.168.1.100 linmu100.com linmu100
192.168.1.120 ftpserver ftp120
Under normal circumstances, each host file is a host, each line consists of three Composition, each part is separated by a space. The line at the beginning of ## is used for explanation and is not explained by the system.
Part 1: Network IP Address;
Part 2: Host Name or Domain Name;
Part 3: Host Name Alias;
Of course, each line can also be two parts. That is, the host IP address and host name; for example, 192.168.1.100 linmu100.
Here you can slightly explain the difference between the hostname (hostname) and the domain name (Domain): the hostname is usually used in the LAN, through the hosts file, the hostname is resolved to the corresponding ip; the domain name is usually used on the internet, but If the machine does not want to use the domain name resolution on the internet, then you can change the hosts file and add your own domain name resolution.
Copyright © Windows knowledge All Rights Reserved