Stoppt die Vorratsdatenspeicherung! Jetzt klicken &handeln! Willst du auch an der Aktion teilnehmen? Hier findest du alle relevanten Infos
und Materialien:

Java DNS Caching breaks…or not?

Java DNS queries sometime turn out a bit tricky. The following feat was one example: consider you are using a round-robin dns system. Every query of the dns record returns all possible ip addresses, mixed up:

Oh, God! You Devil video kleinhenz@mklein-nb:~$ host x.blubb.blubb x.blubb.blubb has address 172.16.4.2 x.blubb.blubb has address 172.16.4.1 x.blubb.blubb has address 172.16.4.3

Seven Signs of the Apocalypse rip Wishmaster video

Applications usually use the first entry, resulting in a per-query association of host and ip address. If the actual DNS query is not cached, it works as a continuing distribution of querys over the listed ips.

Turning off the DNS caching in Java is easy: set the “networkaddress.cache.ttl” property to “0″ disables it. But here comes the problem: if you have mixed IPv4 and IPv6 hosts in your DNS, Java will prefer the v6 hosts, listing them on top on the v4 addresses. This results in a bizarre behaviour: the list of ips in the returned list are mixed up – but in two groups: the mixed IPv6 host group appears on top of the mixed IPv6 group!

The solution is rather simple: just add “java.net.preferIPv4Stack=true” to the properties environment and the round robin works as espected.

20 Years After movies

Kommentar abgeben