Diferença entre 127.0.0.1 e 127.0.1.1? [duplicado]

4

No meu arquivo / etc / hosts, tenho duas linhas:

127.0.0.1 localhost
127.0.1.1 hostname

Qual é a diferença entre as duas linhas, onde encontro o nome do host?

    
por user482004 06.08.2018 / 18:08

2 respostas

2

A outra resposta cita uma referência falsa obsoleta que não corresponde ao link e não parece que será corrigida. Aqui está a citação correta do Manual de referência Debian de hoje:

5.1.1. The hostname resolution

For example, "/etc/hosts" looks like the following.

127.0.0.1 localhost
127.0.1.1 <host_name>

[...]
Each line starts with a IP address and it is followed by the associated hostname.

The IP address 127.0.1.1 in the second line of this example may not be found on some other Unix-like systems. The Debian Installer creates this entry for a system without a permanent IP address as a workaround for some software (e.g., GNOME) as documented in the bug #719621.

The <host_name> matches the hostname defined in the "/etc/hostname".

For a system with a permanent IP address, that permanent IP address should be used here instead of 127.0.1.1.

For a system with a permanent IP address and a fully qualified domain name (FQDN) provided by the Domain Name System (DNS), that canonical
<host_name>.<domain_name> should be used instead of just <host_name>.

Para os curiosos no bug # 719621 há um link para uma lista de discussão discutindo sobre o mesmo assunto" 127.0.0.1 vs. 127.0.1.1 ". Ele também menciona que o Fedora usa 127.0.0.2 para o mesmo propósito. De fato, parece que um mecanismo ligeiramente diferente está sendo usado no Fedora para isso.

    
por 13.08.2018 / 08:33
1

Por exemplo, na Seção 10.5 do Manual de Referência Debian:

Some software (e.g., GNOME) expects the system hostname to be resolvable to an IP address with a canonical fully qualified domain name. This is really improper because system hostnames and domain names are two very different things; but there you have it. In order to support that software, it is necessary to ensure that the system hostname can be resolved. Most often this is done by putting a line in /etc/hosts containing some IP address and the system hostname. If your system has a permanent IP address then use that; otherwise use the address 127.0.1.1.​

link

    
por 06.08.2018 / 18:44