In Linux with IPv6 and IPv4 (dualstack), IPv6 address have preference.
This can be easily changed in file /etc/gai.conf, add lines
# /etc/gai.conf precedence ::ffff:0:0/96 100 precedence ::/0 40
How this work?
The number indicates priority (higher = higher priority). ::ffff:0:0/96 represents IPv4 addresses mapped into IPv6.
This affects all applications that use standard getaddrinfo() calls.
Test by command
getent ahosts google.com # IPv4 should appear first.