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

I created zone file

zone "example.com" {
    type master;
    file "/etc/bind/db.example.com";
    forwarders{};
};

db.example.com

$TTL    604800
@ IN SOA pgdebian.example.com. contact.example.com.
(20881122 604800 86400 2419200 604800 )

                NS      pgdebian.xxx.com.
pgdebian        A       192.168.0.49        
pgdebian        HINFO   "PII 233 :-)" "Debian Testing"
*               A       127.0.0.1

Now, when I request http://lol.example.com, BIND9 answers 127.0.0.1 But if I try nslookup example.com, nslookup says SERVER FAILED.

How can I redirect example.com to 127.0.0.1?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

The wildcard is matching children of example.com but not example.com proper.

Add this record:

@ A 127.0.0.1

to add 127.0.0.1 as an address for example.com itself.

The Wikipedia article on wildcard DNS is pretty good.

share|improve this answer
    
thanks it works :) –  red eyes dev Jun 15 '11 at 15:50
add comment

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.