Can a domain name have both IP addresses (IPv6 and IPv4)?

23,110

Solution 1

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.

Solution 2

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.

Share:
23,110

Related videos on Youtube

Niks
Author by

Niks

iOS Application Developer.

Updated on September 18, 2022

Comments

  • Niks
    Niks over 1 year

    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.

    • Matt Nordhoff
      Matt Nordhoff over 8 years
      example.com is, in fact, such a domain. example.com has address 93.184.216.34 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'.)
    • Isvara
      Isvara over 8 years
      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.
  • Niks
    Niks over 8 years
    Thanks for the ans. so each hostname must have both ip right? There won't be any case that any hostname can have only ipv4 and not ipv6. Thanks again.
  • Thalys
    Thalys over 8 years
    Sure you could. Sadly most hosts on the internet are probably ipv4 only
  • Niks
    Niks over 8 years
    ohh okay. can we identify with any way from hostname that is it of ipv4 or ipv6?
  • Thalys
    Thalys over 8 years
    Run Ping with -v4 and -v6 and see what happens
  • user1686
    user1686 over 8 years
    Use host … or nslookup -q=AAAA … to check whether DNS records of that type exist.
  • Thomas Weller
    Thomas Weller over 8 years
    We can even have multiple A and multiple AAAA records, right?
  • Thalys
    Thalys over 8 years
    Yup. Its used for poor mans load balancing/round robin connections
  • qasdfdsaq
    qasdfdsaq over 8 years
    @JourneymanGeek: Plenty of rich men use it too (Google, Facebook, Apple)
  • atk
    atk over 8 years
    In addition, every ipv4 address is an ipv6 address. isc.sans.edu//tools/ipv6.html
  • Thalys
    Thalys over 8 years
    I'm pretty sure rich folk use multicasting and stuff like that.