Can a domain name (example.com) have both the IP addresses, IPv6 and IPv4?

Which IP address does a domain name have? IPv6 or IPv4? But I am not sure that it has both or any one at a time.

  • 5
    example.com is, in fact, such a domain. example.com has address example.com has IPv6 address 2606:2800:220:1:248:1893:25c8:1946 (They run a website on it that says little more than 'this is the example domain'.) Oct 29 '15 at 9:36
  • 1
    Other people have answered you direct question, but I want to emphasize the fact that a domain name can have any combination of resource records except for CNAME, which must stand alone (because giving a domain records and saying it has a different canonical name at the same time doesn't make sense). There's nothing particularly special about a domain name having an address, be it IPv4 or IPv6. They're just records, and some domains even only have non-address records.
    – Isvara
    Oct 29 '15 at 16:08

Sure. You have an A record (for IPv4) and an AAAA record (for IPv6). Typically the AAAA record gets resolved first, then the A record.

You can either have just an A name (for an IPv4-only host), AAAA name (IPv6-only host) or both. You could even have different servers for both.

You could even have multiple A and AAAA names (for different dual-stack or mix of ipv4 and 6) servers.

  • 1
    Sure you could. Sadly most hosts on the internet are probably ipv4 only
    – Journeyman Geek
    Oct 29 '15 at 5:47
  • 5
    Run Ping with -v4 and -v6 and see what happens
    – Journeyman Geek
    Oct 29 '15 at 5:50
  • 4
    Use host … or nslookup -q=AAAA … to check whether DNS records of that type exist.
    – user1686
    Oct 29 '15 at 6:47
  • 4
    @JourneymanGeek: Plenty of rich men use it too (Google, Facebook, Apple)
    – qasdfdsaq
    Oct 29 '15 at 11:37
  • 2
    I'm pretty sure rich folk use multicasting and stuff like that.
    – Journeyman Geek
    Oct 30 '15 at 8:51

Yes you can have both IPv4 and IPv6 addresses associated with the same dns name.

As a general rule services should be made available over both ipv4 and ipv6 and the same public facing DNS name used for both. That way both IPv4 only clients (still way too common) and IPv6 only clients (not very common yet) will be able to access it using the same name. In general dual stack clients will try IPv6 first before falling back to IPv4 though there is no hard and fast rule.

It is often useful to have additional dns names that only offer one protocol so that you can test your server works correctly on both protocols but these names should not generally be promoted to users.

If you only offer IPv4 then pretty much everyone will be able to access your site but as the IPv4 crises bites deeper an increasing proportion of users will be connecting via some form of ISP level NAT service (be it conventional v4 NAT, NAT64 or ds-lite). ISP level NAT services make tracking/blocking/reporting abuse much harder.

If you only offer IPv6 then a substantial proportion of users will not be able to access your server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.