Forcing DNS lookups to use IPv4 instead of IPv6

Issues related to configuring your network
Post Reply
optize
Posts: 11
Joined: 2010/08/25 18:41:46

Forcing DNS lookups to use IPv4 instead of IPv6

Post by optize » 2012/04/19 03:28:02

This may sound silly, however:

I need a box to have iPv6 enabled, however by default I want it to use A records, instead of AAAA. By default, when you enable IPv6, it also prefers IPv6 IPs instead of IPv4, which is understandable.

Is there a way to turn this "feature" off without disabling IPv6?

User avatar
TrevorH
Forum Moderator
Posts: 26583
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Forcing DNS lookups to use IPv4 instead of IPv6

Post by TrevorH » 2012/04/27 08:00:03

You can add an options line to /etc/resolv.conf to turn [u]on[/u] ipv6 lookups like

[code]
options inet6
[/code]

I know this is not what you want to do but it's the only option listed in `man resolv.conf`. I wonder if it also allows `options no-inet6` or `options noinet6`?

Hmm, google seems to say that there is no option to turn it off, only one to turn it on and it should be off by default :-(

hawkmage
Posts: 162
Joined: 2011/12/17 00:00:11

Re: Forcing DNS lookups to use IPv4 instead of IPv6

Post by hawkmage » 2012/04/28 00:35:24

Unfortunately there is little you can do to set the name resolution to return an IPv4 address.

When an application calls for a name resolution it has control of what type of address to return. It can specify IPv4, IPv6 or any.

As TrevorH said you can make the default preference for the OS to return IPv6 addresses but not to prefer IPv4 addresses.

What is the reason you want get IPv4 address instead of IPv6?

Post Reply

Return to “CentOS 5 - Networking Support”