Use:
Associating host names and IP addresses
At the start of the machine, before the DNS works, you need to know some of the host name and IP address mapping, the mapping relationship is stored in the/etc/hosts file, the DNS does not work properly, all network programs in the system will view the file to determine the IP address corresponding to the host name.
Format:
One IP address per line
IP_Address Canonical_hostname [aliases ...]
Comments:
From #开始, to the end of a line.
Example one:
127.0.0.1 localhost.localdomain localhost
:: 1localhost6.localdomain6localhost6
Example two:
# The following lines is desirable for IPV4 capable hosts 127.0.0.1 localhost # 127.0.1.1 was often used for t He FQDN of the machine 127.0.1.1 thishost.mydomain.org thishost 192.168.1.10 foo.mydomain.org foo 192.168.1.13 bar.mydomain.org bar 146.82.138.7 master.debian.org Master 209.237.226.90 www.opensource.org # The following lines is desirable for IPV6 capable hosts :: 1< C19/>localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters
Linux/etc/hosts