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.

1) I was following a guide to setup bind again after I formatted to Ubuntu 10.04.2 LTS. http://doc.ubuntu.com/ubuntu/serverguide/C/dns-configuration.html#dns-primarymaster-configuration

I can get my domain example.com to resolve but I want "www.example.com" to resolve to the actual domain on the web.

I don't have a webserver setup on my domain at the moment so I would rather it resolve properly.

So "ping example.com" works and resolves to my local address but "ping www.example.com" gives "ping: unknown host www.example.com".

Here is the file db.example.com,

;
; BIND data file for example.com
;
$TTL    604800
@       IN      SOA     ns.example.com. root.example.com. (
                              9         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      ns.example.com.
@       IN      A       10.11.12.1
;www    IN      A       10.11.12.1
ns      IN      A       10.11.12.1

I tried adding in a www entry but it only resolves to the same local ip as example.com so I commented it out.

2) I am planning on adding all of the urls from the ad block site http://winhelp2002.mvps.org/hosts.txt to bind so as to block them on my network.

So how would I add this list to bind?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

I tried adding in a www entry but it only resolves to the same local ip as example.com so I commented it out.

Well, that's why it doesn't work. Create a proper A resource record for www, increase the serial number of your zone file and reload the zone.

You should also read up on the basics of DNS e. g. in DNS for Rocket Scientists.

I am planning on adding all of the urls from the ad block site http://winhelp2002.mvps.org/hosts.txt to bind so as to block them on my network.

BIND is not really meant for this kind of manipulation. This said you can create a static-stub zone in newer versions of BIND to manipulate DNS entries. See http://ftp.isc.org/isc/bind9/cur/9.8/doc/arm/Bv9ARM.ch06.html#id2591396 for details.

share|improve this answer
    
"Create a proper A resource record for www", not sure what you mean, could you explain further or give an example –  user618036 Sep 11 '11 at 18:14
    
Uncomment the line www IN A 10.11.12.1 and read up on it in DNS for Rocket Scientists. –  joschi Sep 11 '11 at 18:22
    
Ok I can hardcode it to the IP of www.example.com while remaining the master for example.com. Secondly, what do you mean bind wasn't meant for blocking urls. Its a domain name server, what else am I supposed to use? I browse with chrome and its adblock isn't as good as ff. Using hosts file slows down windows. –  user618036 Sep 11 '11 at 19:28
    
BIND was built to be an auhtoritative name server and caching resolver. Manipulating DNS entries, e. g. overwriting zone-data of the forwarders (the name servers the caching resolver will get its data from) was not a primary concern. That's why getting that list to use with BIND is rather tedious. –  joschi Sep 11 '11 at 21:00
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.