Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

this seems really simple, but I can't figure it out. I'm using xname.org since it's free and I own a bunch of domains spread over a few different registrars.

The setup I desire is very simple: one A record that points the bare domain name to my server, plus a wildcard CNAME record pointing all subdomains to the same server.

So if the user goes to domain.com it will point them to 285.24.435.75, if they go to www.domain, blah.domain.com, or any other sub domain, they'll get sent to 285.24.435.75.

All the examples I read on the internet about setting up A records all have the A record set to a subdomain such as www. WWW is deprecated so I want to have noting to do with it. Currently my xname.org zone looks like this:

$TTL 86400 ; Default TTL
domain.com.     IN  SOA ns0.xname.org.  nbvfour.gmail.com. (
            2010052503  ; serial
            10800   ; Refresh period
            3600    ; Retry interval
            604800  ; Expire time
            10800   ; Negative caching TTL
        )

$ORIGIN domain.com.
                    IN      NS      ns2.xname.org.
                    IN      NS      ns0.xname.org.
                    IN      NS      ns1.xname.org.
@                   IN      A       65.49.73.148




*                   IN      CNAME       domain.com

The '@' symbol is something that the godaddy domain interface uses to mean "this root domain', but that may have been specefic to that interface and has no meaning here.

Before I had a 'www' entry in the A rcords and it worked in the sense that I could ping 'www.domain.com' and it returned a response, but pinging the root domain 'domain.com' returned "no host found".

share|improve this question
4  
Since when was the 'www' hostname deprecated? You may choose to use it or not, but no standards body that I am aware of has officially deprecated its use. It's a de-facto standard for millions of people and millions of websites. For the sake of your users, I generally suggest picking one to be your preference and 301 redirecting the other to your preferred name to ensure people get to the right place regardless of which they type in. –  Justin Scott May 25 '10 at 20:13
    
+1 Justin. Just because it's falling out of use (if it is in fact falling out of use) doesn't mean it's deprecated. Just because the sysadmin of domain X doesn't use it doesn't mean that all domains should stop using it. Like my Dad always asked "If your buddy jumps off of a bridge are you going to do it too". –  joeqwerty May 25 '10 at 20:53
    
@Justin while I appreciate your sentiment, nor did any standards body officially sanction its use - like you say it's a "de-facto" standard. FWIW, I would put the real site on the 'www' address, and have the un-adorned address do the 301 redirect. Doing otherwise leads to problems with cookies, etc. –  Alnitak May 26 '10 at 7:01

2 Answers 2

up vote 3 down vote accepted

First: @ is a standard "master file format" thing. It means "the current zone."

Your problem is simple. Add a '.' to the last line. that is, you want:

* IN CNAME domain.com.

The tailing '.' at the end of the name means "do not append the current origin name to this"

If you leave it off, you get (in this case) "domain.com.domain.com."

share|improve this answer

Notwithstanding the trailing dot error pointed out by Michael, my personal preference is not to CNAME a record pointing back at the domain itself.

The reason for this is that it (unintentionally) exposes any MX, NS or SOA (etc) records for all of those new entries which could potentially have unintended consequences.

Therefore, I would write your last two lines simply as:

@   IN A 65.49.73.148
*   IN A 65.49.73.148
share|improve this answer
    
I generally don't like CNAMEs either, but instead use a pre-processor to fill in IP addresses, and assign both IPv4 and IPv6 addresses. It's faster too. –  Michael Graff Jan 29 at 22:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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