diff --git a/docs/guides/src/main/server/configuration-production.adoc b/docs/guides/src/main/server/configuration-production.adoc index 2cbeeefdb63..8f260bd20b7 100644 --- a/docs/guides/src/main/server/configuration-production.adoc +++ b/docs/guides/src/main/server/configuration-production.adoc @@ -36,4 +36,19 @@ Keycloak runs on top of JGroups and Infinispan, which provide a reliable, high-a To find out more about using multiple nodes, the different caches and an appropriate stack for your environment, see the <@links.server id="caching"/> guide. +== Configure Keycloak Server with IPv6 or IPv4 + +The system properties `java.net.preferIPv4Stack` and `java.net.preferIPv6Addresses` are used to configure the JVM for use with IPv4 or IPv6 addresses. + +By default, Keycloak is configured to prefer IPv4 addresses. In order to run with IPv6 addresses, +you need to specify `java.net.preferIPv4Stack=false` (the JVM default) and `java.net.preferIPv6Addresses=true`. +The latter ensures that any hostname to IP address conversions always return IPv6 address variants. + +These system properties are conveniently set by the `JAVA_OPTS_APPEND` environment variable. For example, to change the IP stack preference from its default of IPv4 to IPv6, set an environment variable as follows: + +[source, bash] +---- +export JAVA_OPTS_APPEND="-Djava.net.preferIPv4Stack=false -Djava.net.preferIPv6Addresses=true" +---- +