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

30

5

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.

Niks

Posted 2015-10-29T05:27:17.943

Reputation: 741

4example.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'.) – Matt Nordhoff – 2015-10-29T09:36:24.097

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 – 2015-10-29T16:08:20.767

Answers

49

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.

Journeyman Geek

Posted 2015-10-29T05:27:17.943

Reputation: 119 122

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. – Niks – 2015-10-29T05:45:44.303

1Sure you could. Sadly most hosts on the internet are probably ipv4 only – Journeyman Geek – 2015-10-29T05:47:16.280

1ohh okay. can we identify with any way from hostname that is it of ipv4 or ipv6? – Niks – 2015-10-29T05:49:44.853

5Run Ping with -v4 and -v6 and see what happens – Journeyman Geek – 2015-10-29T05:50:15.943

4Use host … or nslookup -q=AAAA … to check whether DNS records of that type exist. – user1686 – 2015-10-29T06:47:53.510

We can even have multiple A and multiple AAAA records, right? – Thomas Weller – 2015-10-29T09:35:44.507

Yup. Its used for poor mans load balancing/round robin connections – Journeyman Geek – 2015-10-29T09:36:22.057

4@JourneymanGeek: Plenty of rich men use it too (Google, Facebook, Apple) – qasdfdsaq – 2015-10-29T11:37:33.047

1

In addition, every ipv4 address is an ipv6 address. https://isc.sans.edu//tools/ipv6.html

– atk – 2015-10-30T02:33:25.480

2I'm pretty sure rich folk use multicasting and stuff like that. – Journeyman Geek – 2015-10-30T08:51:16.150

11

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.

plugwash

Posted 2015-10-29T05:27:17.943

Reputation: 4 587