23

I'm using both IPv6 and IPv4 in a LAN network containing Slackware 13.0 boxes. How can I set IPv4 as preferred protocol on the workstations in this network? I want to use IPv6 either explicitly or when there are only AAAA records available. For example, if I try to open http://ipv6.org/ from Firefox, I will always connect via IPv6. The situation is the same with other applications. I tried creating /etc/gai.conf and adding the following to it:

precedence ::ffff:0:0/96  100

This should control the behavior of getaddrinfo(3) at least in Debian, but it didn't help on Slackware.

Any ideas will be appreciated. Thanks in advance!

Georgi Hristozov
  • 702
  • 1
  • 4
  • 13
  • 1
    Thank you very much for pointing at `/etc/gai.conf`! I was searching forr it for about half a year! :) – kolypto Dec 12 '09 at 18:00

2 Answers2

22

According to the man page, inserting a precedence value in gai.conf disables the all the other default rules. Try setting all the rules as listed in RFC 3484 (10.3):

  Prefix        Precedence Label
  ::1/128               50     0
  ::/0                  40     1
  2002::/16             30     2
  ::/96                 20     3
  ::ffff:0:0/96        100     4
Luca Tettamanti
  • 846
  • 8
  • 11
  • 1
    Adding just the last one seems to be enough. That is `precedence ::ffff:0:0/96 100`. – Ale Apr 29 '22 at 09:28
1

ipv6 isn't really my area of expertise, but on the man page for resolver(5) there seems to be a few options in /etc/resolv.conf that could be related:

options inet6 sets RES_USE_INET6 in _res.options. This has the effect of trying a AAAA query before an A query inside the gethostbyname(3) function, and of mapping IPv4 responses in IPv6 "tunneled form" if no AAAA records are found but an A record set exists.

Maybe your clients have that option set?

Anders Lindahl
  • 1,011
  • 1
  • 9
  • 12