Module 3 · 3.1
A and AAAA records
Module 3: Records for your website · Reading time: 7 minutes
Learning objective: After this lesson, you'll be able to point a name to an IPv4 and an IPv6 address, and you'll know what goes wrong if you forget the AAAA record.
Key concepts: A record, AAAA record, IPv4, IPv6, multiple A records, documentation addresses
The most commonly used record
If someone wants to visit your website, the browser needs to know the address of the server. That address is an IP address, and the record that links a name to that address is called the A record (A for address). It's the oldest and most commonly used record in DNS.
An A record looks like this in a zone:
example.com. 3600 IN A 192.0.2.10
www.example.com. 3600 IN A 192.0.2.10Read it from left to right: the name example.com., may be cached for 3600 seconds, in the internet class (IN, you'll almost never see anything else), type A, value 192.0.2.10.
An A record always points to an IPv4 address: four numbers from 0 to 255, separated by dots. There are roughly 4.3 billion of these addresses, which isn't enough for every device on earth. That's why IPv6 exists.
AAAA: the same, but for IPv6
An IPv6 address is much longer: eight groups of four hexadecimal characters, separated by colons. You may replace one sequence of consecutive all-zero groups with ::. The record that links a name to an IPv6 address is called the AAAA record, pronounced "quad-A". The name comes from the fact that an IPv6 address is four times as long as an IPv4 address (128 bits versus 32).
example.com. 3600 IN AAAA 2001:db8::10
www.example.com. 3600 IN AAAA 2001:db8::10A name can have both: an A record and an AAAA record. That's actually the normal situation with modern hosting. A visitor with an IPv6 connection (an increasing number of home networks, and almost all mobile networks) will typically use the AAAA record, while a visitor without IPv6 uses the A record.
In this course, we use the addresses 192.0.2.x, 198.51.100.x and 203.0.113.x for IPv4, and 2001:db8:: for IPv6. These are specially reserved for documentation (RFC 5737 and RFC 3849): they're never assigned to a real server, so an example can never accidentally point to someone's actual server.
The pitfall: the forgotten AAAA record
This often goes wrong in practice. You move your website to a new server, or connect your domain to an online shop platform. You neatly update the A record to the new address. But there was also an AAAA record pointing to the old server, and you leave it as is.
The result: visitors without IPv6 see the new site, visitors with IPv6 (often everyone on 4G or 5G) see the old site, or an error message if the old server is already gone. And because you might not have IPv6 at home, you won't notice anything odd. "It works on my laptop, but not on my phone" is a classic symptom.
So the rule is: if you change the A record, always check the AAAA record too. There are three possibilities:
- The new server also has an IPv6 address: point the AAAA record to that new address.
- The new server has no IPv6: remove the old AAAA record.
- There was no AAAA record: then you don't need to do anything.
Multiple A records for one name
A name can have more than one A record:
example.com. 300 IN A 192.0.2.10
example.com. 300 IN A 192.0.2.11DNS then returns both addresses, and the browser picks one. Large sites use this to spread visitors across multiple servers or to keep running if one fails. For an ordinary website, you usually don't want this: if one of the two addresses is an old server, half your visitors will get the wrong site. Platforms such as online shop builders therefore often explicitly ask: "make sure there's only one A record on your domain".
What is and isn't allowed in an A record
- The value is always an IP address, never a name. If you want a name to point to another name, you need a CNAME (lesson 3.2).
- Don't put a dot after an IP address. A trailing dot only belongs to names (lesson 2.2).
- An A record doesn't contain a port or a path.
192.0.2.10:8080or192.0.2.10/shopwon't work. DNS only knows where a server is, not which page you want to see (lesson 3.4). - For the domain name itself, most panels use
@or you leave the name field empty. For a subdomain, you only fill in the first part, such aswwworshop.
In practice: what it looks like in a panel
As an example, we use DirectAdmin, a widely used hosting panel. Other panels (cPanel, Plesk, Cloudflare and the DNS screens of most registrars) label the buttons differently, but the fields are the same everywhere: type, name, TTL and value.
- Open DNS Administration and select the right domain.
- Click Add Record.
- For the type, choose A (or AAAA for IPv6).
- Under Name, fill in only the first part, for example
shopforshop.example.com. For the domain itself, leave it empty or type@. - Leave the TTL at its default value, for example 3600.
- Under Value, fill in the IP address, for example
203.0.113.10. - Save.
You can change an existing record using the pencil icon next to it. Afterwards, check the same list to see whether there's still an AAAA record for the same name.
Summary
- An A record links a name to an IPv4 address, an AAAA record to an IPv6 address.
- A name can have both; that's normal with modern hosting.
- If you change the A record, always check the AAAA record too: otherwise IPv6 visitors will see the old server.
- The value is always an IP address, without a dot, port or path.
- Multiple A records for one name are possible, but are usually a mistake for an ordinary website.
Quiz
Exercise
Exercise Z3.1: Look up A and AAAA. Look up the IPv4 address (A) and the IPv6 address (AAAA) of wikipedia.org. Fill in both addresses. If wikipedia.org has more than one, a single one is enough.
Exercise O3.1: Set it up yourself in your practice zone. In your practice zone, create two records for the name web:
- an A record with the value
192.0.2.10 - an AAAA record with the value
2001:db8::10
Then click Check.
Exercise O3.1
You'll do this exercise in your own practice zone: a real DNS zone on WebOké's nameservers, just for you. Sign up with your email address. You'll get a login link by email and then come back to this lesson. We only use your address for the course.
Further reading
These articles describe the steps in WebOké's panels; in other panels, the process works similarly.
