如何在 /etc/hosts 中为单个主机添加多个 IPv6 地址?

the*_*heB 4 linux ipv6 hosts-file

我希望应该使用多个 IPv6 地址解析名称。我无权访问 DNS 服务器,我不想为此目的运行恶魔。

我想添加条目/etc/hosts,它应该为单个名称返回两个 IPv6 地址。

San*_*ann 8

好吧,如果你想这样做,就这样做吧:-)

如果您将其添加到 /etc/hosts:

2001:db8::1 testing
2001:db8::2 testing
192.168.0.1 testing
Run Code Online (Sandbox Code Playgroud)

那么主机名将具有三个地址:

$ telnet testing
Trying 2001:db8::1...
Trying 2001:db8::2...
Trying 192.168.0.1...
telnet: Unable to connect to remote host: No route to host
Run Code Online (Sandbox Code Playgroud)

在这种情况下,地址不存在,因此连接失败,但您可以看到它有效。