HowTo invite applications to use IPv4 or IPv6
Introduction
IPv6 is not really news, but unfortunately there may still be situations where an application tries to make a particular connection using IPv6 although only IPv4 is set up usuable.
The following config snippets should help to enforce a particular IP variant in dual-stack setups or situations.
IPv4/IPv6 priorities of operating systems
Be aware that applications may ignore the following settings, or only respect them when the application is restarted.
Linux
To have most applications use IPv4 connections, uncomment the following line in /etc/gai.conf:
precedence ::ffff:0:0/96 100
MacOS, Windows
TBD.
IPv4/IPv6 priorities of applications
Application | Command line options | Config file options | Config file names, Remarks |
---|---|---|---|
apt-* |
| Acquire::ForceIPv4 "true"; Acquire::ForceIPv6 "true"; | Suggestion:
|
Java JVMs |
-Djava.net.preferIPv6Addresses=[true|false] |
java.net.preferIPv6Addresses = [ true | false ] |
|
OpenSSH |
|
| /etc/ssh/ssh*_config , ~/.ssh/config |
Postfix | inet_protocols = all | inet4 | inet6 | /etc/postfix/main.cf |
Probably obsolete, from 2009: Java in Ubuntu/Debian: Sometimes these JVM parameters are not enough. As documented in Ubuntu bug 486215 and Eclipse bug 298515 it may also be required to set net.ipv6.bindv6only
to 0
using /sbin/sysctl net.ipv6.bindv6only=0
respectively editing /etc/sysctl.d/bindv6only.conf
TBC ...