Fedora 20 question.
I have noticed that the Host command is always returning first IPv4 addresses, and then IPv6 addresses. So I asked on the BIND list can got the following:
================================================
/ Does bind order address class on queries? That is does it, say, group
/>/ IPv4 addresses then IPv6? / If the query is for A records the response will contain only IPv4 addresses, if the query is for AAAA records it will be IPv6. Only if the client performs an ANY query will the response contain both. ANY records are not generally used by applications, because they only return what's in the resolver's cache, which may not be all the records associated with the name; ANY queries are usually only useful when querying authoritative servers (unless what you're trying to find out is what's currently in the resolver's cache).
================================================
It seems that if I change the content of my zone file, I get the new results so it does not appear to be working from cache. Is Host making separate A then AAAA requests? Is there a way to put priority on IPv6 addresses for all applications?
Once upon a time, Robert Moskowitz rgm@htt-consult.com said:
I have noticed that the Host command is always returning first IPv4 addresses, and then IPv6 addresses. So I asked on the BIND list can got the following:
You asked the BIND list a different question than you are asking here. BIND returns the record type requested, in random order when there is more than one (e.g. multiple A records). To get multiple types, you have to send multiple queries (ANY is special). The "host" command-line tool does not duplicate the way an application does lookups. "host" (per the man page) specifically by default looks up A, AAAA, and MX, in that order.
Applications on the other hand use a few different library calls to convert names to addresses, most commonly gethostbyname() (old, IPv4-only) or getaddrinfo() (new, can handle multiple address families). For modern applications that use getaddrinfo(), the default is to follow the ordering rules defined in RFC 3484 that (in general) put IPv6 addresses ahead of IPv4 addresses.
You can control some of the ordering with /etc/gai.conf; see "man gai.conf" for more info.
Chris,
Thank you for the detailed reply. This is what I was striving to learn and did not now enough to ask it right.
On 04/23/2014 01:31 PM, Chris Adams wrote:
Once upon a time, Robert Moskowitz rgm@htt-consult.com said:
I have noticed that the Host command is always returning first IPv4 addresses, and then IPv6 addresses. So I asked on the BIND list can got the following:
You asked the BIND list a different question than you are asking here. BIND returns the record type requested, in random order when there is more than one (e.g. multiple A records). To get multiple types, you have to send multiple queries (ANY is special). The "host" command-line tool does not duplicate the way an application does lookups. "host" (per the man page) specifically by default looks up A, AAAA, and MX, in that order.
Applications on the other hand use a few different library calls to convert names to addresses, most commonly gethostbyname() (old, IPv4-only) or getaddrinfo() (new, can handle multiple address families). For modern applications that use getaddrinfo(), the default is to follow the ordering rules defined in RFC 3484 that (in general) put IPv6 addresses ahead of IPv4 addresses.
You can control some of the ordering with /etc/gai.conf; see "man gai.conf" for more info.
On 04/23/2014 01:31 PM, Chris Adams wrote:
Once upon a time, Robert Moskowitz rgm@htt-consult.com said:
I have noticed that the Host command is always returning first IPv4 addresses, and then IPv6 addresses. So I asked on the BIND list can got the following:
You asked the BIND list a different question than you are asking here. BIND returns the record type requested, in random order when there is more than one (e.g. multiple A records). To get multiple types, you have to send multiple queries (ANY is special). The "host" command-line tool does not duplicate the way an application does lookups. "host" (per the man page) specifically by default looks up A, AAAA, and MX, in that order.
Applications on the other hand use a few different library calls to convert names to addresses, most commonly gethostbyname() (old, IPv4-only) or getaddrinfo() (new, can handle multiple address families). For modern applications that use getaddrinfo(), the default is to follow the ordering rules defined in RFC 3484 that (in general) put IPv6 addresses ahead of IPv4 addresses.
Is there a command line that will 'just use' getaddrinfo taking a fqdn as input and return the results? My attempt to find such has come up empty; my search foo is typically weak...
You can control some of the ordering with /etc/gai.conf; see "man gai.conf" for more info.
There is a sample one, to show you what the defaults are. I bit of a learning experience here.
On 24 Apr 2014 16:10, "Robert Moskowitz" rgm@htt-consult.com wrote:
Is there a command line that will 'just use' getaddrinfo taking a fqdn as
input and return the results? My attempt to find such has come up empty; my search foo is typically weak...
getent hosts <hostname>
That should use the standard glibc (system) resolver with a getaddrinfo call if memory serves.
On Thu, Apr 24, 2014 at 11:03 AM, Robert Moskowitz rgm@htt-consult.com wrote:
Is there a command line that will 'just use' getaddrinfo taking a fqdn as input and return the results? My attempt to find such has come up empty; my search foo is typically weak...
You can get getaddrinfo.c from the page below (it's neither my site nor do I know the dude; and I haven't looked at the code or compiled it)