# bind default A record?

## RioFL

I have a need to provide a 'default' A record so that when a hostname is requested that does not exist, the default ip address kicks in.

any clues how to do this? I have searched the bind 9 administrators manual, and googled it to death and I cannot find any references to what I am trying to do.

basically it would work  something like this:

$origin somedomain.com.

www     CNAME  somedomain.com.

mail        A         1.2.3.4

other

host

entries

*            A   2.3.4.5

so my explanation with the * would be a 'catchall' that did not meet anything above.

is this possible and if so does anyone know how it is done

----------

## erik258

yes, it's possible, there are many examples online, and what you have here appears to match up with them.  try searching for 'bind wildcard' if you want more.

----------

## RioFL

 *erik258 wrote:*   

> yes, it's possible, there are many examples online, and what you have here appears to match up with them.  try searching for 'bind wildcard' if you want more.

 

thank you! that is exactly what i was looking for. never even thought to do a search for the word wildcard. kept looking for default.

----------

## RioFL

 *RioFL wrote:*   

>  *erik258 wrote:*   yes, it's possible, there are many examples online, and what you have here appears to match up with them.  try searching for 'bind wildcard' if you want more. 
> 
> thank you! that is exactly what i was looking for. never even thought to do a search for the word wildcard. kept looking for default.

 

unfortunate side-effect however. i have done this for several domains and it works as it is supposed to so a mis-typed hostname goes to the domain main page anyway.

however, if i go to an outside domain like cnet.com it works, but if i mis-type the name, say cnett.com, i get the default page for the first domain in my web server when i have not requested that domain at all!  

is there a fix for this? i do not want to wildcard the world, just certain domains.

----------

## desultory

That is likely due to using too broad a start of authority record. Either post the full SOA declaration and the wildcard record from the zone file or review the syntax and verify that you have specified the zone file as you had intended.

----------

## RioFL

 *desultory wrote:*   

> That is likely due to using too broad a start of authority record. Either post the full SOA declaration and the wildcard record from the zone file or review the syntax and verify that you have specified the zone file as you had intended.

 

will read those references. meanwhile here is an entire zone record for one of our 'web only' domains with the name and ip changed for privacy.

```
$ORIGIN .

$TTL 86400    

domain.com             IN SOA ns1.ours.com sysadmin.ours.com. (

                                2008100201 

                                3600      

                                900       

                                259200     

                                86400      

                                )

                        NS      ns1.ours.com.

                        NS      ns.ours.com.

                        NS      ns2.ours.com.

                        NS      ns3.ours.com.

                        A       123.123.123.234

                        TXT     "v=spf1 -all"

$ORIGIN domain.com.

www                     CNAME   domain.com.

*.domain.com.          A       123.123.123.234

```

then in apache2 i have the serveralias *.domain.com under the www.domain.com serveralias which is under the virtual server servername for each of the virtual servers defined that i am testing this on.

every domain we host uses the same syntax SOA record.Last edited by RioFL on Sun Oct 05, 2008 1:08 pm; edited 1 time in total

----------

## desultory

That does appear to be correctly formed, and I have been unable to replicate that behavior locally.

----------

