How to add multiple IPv6 address for single host in /etc/hosts?

16,010

Well, if you want to do that, just do so :-)

If you add this to /etc/hosts:

2001:db8::1 testing
2001:db8::2 testing
192.168.0.1 testing

then the hostname will have three addresses:

$ 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

In this case the addresses don't exist so the connection fails, but you can see that it works.

Share:
16,010

Related videos on Youtube

theB
Author by

theB

Updated on September 18, 2022

Comments

  • theB
    theB over 1 year

    I want that a name should be resolved with multiple IPv6 addresses. I don't have access to a DNS server and I don't want to run a demon for that purpose.

    I want to add the entry in /etc/hosts and it should return two IPv6 addresses for a single name.

  • mr148
    mr148 almost 12 years
    I did the same. I gave link local address. I tried to ping them. Only the first address gets pinging. Acutally I want to check whether my machine is doing address select. So it is necessary to receive multiple A values for a particular name.
  • Sander Steffann
    Sander Steffann almost 12 years
    Ping does get multiple addresses. It just chooses to always use the first one. If you want a different order then you will have to reorder /etc/hosts, or use something that does automatic shuffling like DNS
  • mr148
    mr148 almost 12 years
    No. I want to ping to perform Default address selection (RFC3484) among all the addreses it receives before sending ICMP_REQUEST to the host.
  • Sander Steffann
    Sander Steffann almost 12 years
    Then talk to the developers of ping
  • mr148
    mr148 almost 12 years
    I am talking about ping6. Its already doing things correct. I don't know whether it is done by ping6 or the linux filters correct address from the list. But things works fine other than link local case. If destination has link local and global and source having link local and site local, my kernel prefers link locla dest with site local src. But accroding to RFC3484 it is wrong.
  • Sander Steffann
    Sander Steffann almost 12 years
    Then you should file a bug report...