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.

I recently setup bind on CentOS and want to redirect the non-www to www part of the site.

Currently the www works, but when I try the bare domain from Safari I get: Can't open http://mydomain.com because the server can't find mydomain.com.

My zone file looks like this: (without the $TTL part below)

                IN NS         ns1.mydomain.com.
                IN A          [ip here]

      ns1       IN A          [ip here]

      @         IN MX 10      aspmx.l.google.com.
      @         IN MX 20      alt2.aspmx.l.google.com.

      *         IN CNAME      [ip here]

IntoDNS reports at "WWW A Record" section:

ERROR: I could not get any A records for mydomain.com!

When I try * IN A [ip] I get the following error:

      Stopping named:                                            [  OK  ]
      Starting named: 
      Error in named configuration:
      zone localhost/IN: loaded serial 42
      dns_master_load: /var/named/mydomain.com.zone:19: *.mydomain.com: CNAME and other data
      zone mydomain.com/IN: loading from master file /var/named/mydomain.com.zone failed: CNAME and other data
      zone mydomain.com/IN: not loaded due to errors.
      _default/mydomain.com/IN: CNAME and other data

But IN A [ip] - without * - works (as it was above).

share|improve this question
I'm neither a Bind expert nor did I work with wildcards before, but CNAME to [ip here] looks wrong, CNAMES don't point to IPs, try 'A' instead of 'CNAME' ? –  Gryphius Aug 5 '12 at 7:14
@Gryphius: Thanks, tried that but doesn't seem to work. –  Max Aug 5 '12 at 7:54
"It doesn't work at all" is not a very good problem description. What happens when you try to resolve? Do you get an IP address? –  David Schwartz Aug 5 '12 at 8:02
@DavidSchwartz Thanks. I've tried what you've suggested and updated my post. Safari simply doesn't load the non-www of the domain, while with www works. (also added in my post now) –  Max Aug 5 '12 at 8:18
@Max: Your post said you had a CNAME. We are suggesting using an A record. "dns_master_load: /var/named/mydomain.com.zone:19: *.mydomain.com: CNAME and other data" You shouldn't be using a CNAME. –  David Schwartz Aug 5 '12 at 8:22

2 Answers 2

up vote 0 down vote accepted

To make example.com resolve to an IP address, add an A record for @.

@               IN      A
share|improve this answer
Yep, did that eventually and after propagating properly it worked. Thanks! –  Max Aug 5 '12 at 17:15

DNS doesn't work like that. CNAMEs map names to other names, not addresses; A records map names to addresses.

share|improve this answer
Also tried with * IN CNAME mydomain.com, mydomain.com IN A [ip]. Nothing seemed to work. –  Max Aug 5 '12 at 7:51
Try * IN A [ip]. If that doesn't work, please explain precisely what goes wrong when you do it. (Don't forget to bump the serial number and tell your name server that you've changed the zone.) –  David Schwartz Aug 5 '12 at 8:01
I think you mean @, not *. I doubt he wants a catch-all. –  Michael Hampton Aug 5 '12 at 16:20

Your Answer


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.