144

I have the following data in my DNS zone file for my domain:

$ORIGIN mydomain.com.
@       IN      A       208.X.Y.Z
mail    IN      A       208.X.Y.Z
... etc..

What does the @ line mean? I know what an A record is.. but a host with an ampersand at sign?

Daniel Serodio
  • 249
  • 3
  • 10
Pure.Krome
  • 6,508
  • 18
  • 73
  • 87
  • 14
    A little nitpicky perhaps but @ is not an ampersand. ;) – John Gardeniers Nov 12 '09 at 06:40
  • 3
    HAHAH oooops :) That's so true .... time to fix that up.. (donno why i said it's an ampersand / & ) .. .... – Pure.Krome Nov 12 '09 at 22:42
  • 5
    @ is not an ampersand, but 85,000 people have arrived here across 9 years because they made the same mistake. =) So thanks for this accident, I was one of those people. – Slam May 03 '19 at 19:23

3 Answers3

103

RFC 1035 defines the format of a DNS zone file.

... on page 35 you'll find:

@ A free standing @ is used to denote the current origin.

This means that @ is a shortcut for the name defined with $ORIGIN.

You can find more information on $ORIGIN here, which is an excerpt from Pro DNS and BIND, published by Apress.

Gravis
  • 103
  • 4
Anonymous
  • 1,573
  • 1
  • 12
  • 4
70

It's the root, or in your example it's mydomain.com.

Scott Forsyth
  • 16,449
  • 3
  • 37
  • 56
  • 1
    It doesn't seem to be equivalent when I try it out. I made an `A` record for `mydomain.com.` pointing to my host's IP. This makes a DNS lookup fail with the error that it couldn't resolve the hostname. If I change the `mydomain.com.` to `@`, the domain resolves and my website becomes reachable. What is the difference between the two? I assume the zone isn't `mydomain.com`? (I'm setting these records in the Namecheap control panel). – Daniel Saner Oct 11 '15 at 19:16
  • 1
    @DanielSaner The part to put before the IN is the prefix before mydomain.com. So if you put mydomain.com, that really means mydomain.com.mydomain.com. So that's why the @ is an important character which translates simple to mydomain.com. – Scott Forsyth Oct 12 '15 at 03:47
  • My understanding was that the trailing `.` designates the name as fully qualified, so the origin shouldn't be appended. That would be according to RFC 1535, and it's in fact the way my registrar uses it in their examples: https://www.namecheap.com/support/knowledgebase/article.aspx/9256/29/how-to-edit-dns-zone-in-cpanel But such a configuration doesn't work when I try it. Maybe the control panel does something else than just add the information to the zone as-is? – Daniel Saner Oct 12 '15 at 10:07
  • 1
    Yeah, much of that is up to the implementation of the DNS tool. You'll see the @ when you work with the DNS files directly, but you'll rarely see it in the various DNS tools. The DNS tools try to simplify the UI. From your messages it sounds like you have it working one way but not another so I recommend going with the way that it does work. DNS tools are really up to the implementation of the tool, and even DNS servers may not implement this the same way according to specs. – Scott Forsyth Oct 12 '15 at 15:29
  • So to summarise, for a properly working DNS server, `@` and `domain.com.` should be equivalent? – CMCDragonkai Dec 23 '16 at 12:38
  • @CMCDragonkai That's entirely up to the DNS server how it's implemented (whether or not it supports entering domain.com, or @), but in concept you're exactly right. – Scott Forsyth Dec 23 '16 at 17:34
7

It's an alias for the zone name itself. In this case, it indicates that the zone name has that address (or mx record, or ...)

chris
  • 11,944
  • 6
  • 42
  • 51