May 20, 2024

Bind9 Howto

Bind is a DNS server – a sort of phone book for the Internet, so when you type ‘google.com’ it takes you to the IP of their webserver, instead of trying to remember a bunch of different IP’s for the sites you visit.

To make this happen, Bind9 SERVER makes a sort of small phonebook that you can look up numbers with. You only need a server if you want to create your own “phonebook”, otherwise your computer just has a tiny CLIENT that only tells you where to look to find a “phonebook” DNS server.

There are lots of ways to configure Bind9, this is just a down-and-dirty cut/paste that will get you a working DNS server. You can add security stuff as you go, or later after you get it working. You don’t have to install much to make Bind9 work, it’s just the configuration that can be daunting, especially if you’re not quite sure what’s really happening.

This tutorial is done on Debian Wheezy, but it will work on lots of other OS’es with minor modifications. CHANGE THE IP’s to whatever you use, instead of the fictional 1.2.3.4/24, use your real public IP. You have to have a public IP to make a DNS server (or a plan if you have your server NAT’ed behind a firewall), so make sure you have one of those and change the 1.2.3.4 to your real one.

Set up Bind9

apt-get install bind9 dnsutils
cd /etc/bind/
mkdir archive
cp named.conf archive
cp named.conf.local archive
cp named.conf.options archive
mkdir zones

Now set yourself up as a nameserver by changing the /etc/resolv.conf, because you want to go looking for DNS on your own server first, then it sends requests elsewhere if you don’t find it on your own server first. You just need one line, delete all the rest.

vi /etc/resolv.conf
  nameserver 127.0.0.1

Now edit your named.conf and add these lines so the whole thing looks like:

vi named.conf
 // This is the primary configuration file for the BIND DNS server named.
 //
 // Please read /usr/share/doc/bind9/README.Debian.gz for information on the 
 // structure of BIND configuration files in Debian, *BEFORE* you customize 
 // this configuration file.
 //
 // If you are just adding zones, please do that in /etc/bind/named.conf.local
 include "/etc/bind/named.conf.options";
 include "/etc/bind/named.conf.local";
 include "/etc/bind/named.conf.default-zones";
 include "/etc/bind/named.conf.log";

Now create a named.conf.log to set up more useable logging like:

vi named.conf.log
 logging {
        channel update_debug {
                file "/var/log/bind/update_debug.log" versions 3 size 100k;
                severity debug;
                print-severity  yes;
                print-time      yes;
        };
        channel security_info {
                file "/var/log/bind/security_info.log" versions 1 size 100k;
                severity info;
                print-severity  yes;
                print-time      yes;
        };
        channel bind_log {
                file "/var/log/bind/bind.log" versions 3 size 1m;
                severity info;
                print-category  yes;
                print-severity  yes;
                print-time      yes;
        };
 
        category default { bind_log; };
        category lame-servers { null; };
        category update { update_debug; };
        category update-security { update_debug; };
        category security { security_info; };
};

Now set up your log files to receive the new logs you just defined:

mkdir /var/log/bind
touch /var/log/bind/bind.log /var/log/bind/security_info.log /var/log/bind/update_debug.log
chown -R bind.bind /var/log/bind

Now create your actual DNS entries for your sites, which are done by creating “zone” files, which we’ll do by editing named.conf.local like:

vi named.conf.local
//
// Do any local configuration here
//
// Consider adding the 1918 zones here, if they are not used in your
// organization
include "/etc/bind/zones.rfc1918"; <- uncomment this line
 
zone "example.com" {
        type master;
        file "/etc/bind/zones/db.example.com";
        allow-update { key rndc-key; };
};
 
zone "site1.com" {
        type master;
        file "/etc/bind/zones/db.site1.com";
        allow-update { key rndc-key; };
};
 
zone "site2.com" {
        type master;
        file "/etc/bind/zone/db.site2.com";
        allow-update { key rndc-key; };
};

now set up your options like:

vi /etc/bind/named.conf.options
acl internals { 127.0.0.0/8; 192.168.1.0/24; };
 
options {
        directory "/etc/bind";
 
        // Exchange port between DNS servers
        //query-source address * port *;
 
        // Transmit requests to 8.8.8.8 if
        // this server doesn't know how to resolve them
        forward only;
        forwarders { 8.8.8.8; };
 
        auth-nxdomain no;    # conform to RFC1035
 
        // Listen on local interfaces only(IPV4)
        //listen-on-v6 { none; };
        // listen-on { 127.0.0.1; 10.1.10.0/24; };
        listen-on { any; };
 
        // Do not transfer the zone information to the secondary DNS
        allow-transfer { none; };
 
        // Accept requests for internal network only
        // allow-query { internals; };
        allow-query { any; };
 
        // Allow recursive queries to the local hosts
        // recursion yes;
        allow-recursion { internals; };
 
        // Do not make public version of BIND
        version none;
};
 
// Configure the communication channel for Administrative BIND9 with rndc
// By default, they key is in the rndc.key file and is used by rndc and bind9
// on the localhost
controls {
        inet 127.0.0.1 port 953 allow { 127.0.0.1; };
};

now create a zone file for the nameserver itself, which should look like (change to meet your actual domain name):

vi /etc/bind/zones/db.example.com
$TTL    3600
@       IN      SOA     ns3.example.com. root.example.com. (
                   2007010401           ; Serial
                         3600           ; Refresh [1h]
                          600           ; Retry   [10m]
                        86400           ; Expire  [1d]
                          600 )         ; Negative Cache TTL [1h]
;
@       IN      NS      ns1.example.com.
@       IN      MX      10 www.example.com.
 
ns1     IN      A       1.2.3.4
www     IN      A       1.2.3.4
mail    IN      A       5.6.7.8
 
mail    IN      CNAME   mail.example.com

Now create a zone file for whatever other domain you want to use this as a nameserver for like:

vi /etc/bind/zones/db.site1.com
$TTL    3600
@       IN      SOA     ns1.example.com. root.site1.com. (
                   2007010401           ; Serial
                         3600           ; Refresh [1h]
                          600           ; Retry   [10m]
                        86400           ; Expire  [1d]
                          600 )         ; Negative Cache TTL [1h]
@       IN      NS      ns1.example.com.
@       IN      MX      10 mail.site1.com.
        IN      A       1.2.3.4
 
www     IN      A       1.2.3.4
mail    IN      A       5.6.7.8
 
mail    IN      CNAME   mail

Now start bind like:

/etc/init.d/bind9 start
[ ok ] Starting domain name service...: bind9.

If you get an error, start by looking at the last lines of the daemon.log like:

cat /var/log/daemon.log

390 thoughts on “Bind9 Howto

  1. Pingback: 2centres
  2. [url=http://diflucanfl.com/]diflucan fluconazole[/url] [url=http://orlistattabs.shop/]cheap xenical 120 mg[/url] [url=http://albendazole.fun/]albenza 200 mg[/url] [url=http://dapoxetinepriligy.online/]dapoxetine 30mg[/url] [url=http://cipro.pics/]ciprofloxacin 127[/url] [url=http://lasix.foundation/]lasix 20mg[/url]

  3. [url=http://buycytotec.monster/]how to buy cytotec online[/url] [url=http://jjpharmacynj.com/]top online pharmacy india[/url] [url=http://lyricatabs.online/]cheapest price for lyrica[/url] [url=http://cialisip.com/]where can i buy cialis tablets[/url]

  4. [url=http://abilifytab.shop/]abilify 30 mg price[/url] [url=http://finpecia.ink/]propecia discount online[/url] [url=http://levitra2023.com/]generic levitra[/url] [url=http://seroquel.pics/]seroquel 400 pill[/url]

  5. [url=https://toradoltab.online/]toradol pill 10 mg[/url] [url=https://neurontinpill.com/]gabapentin in india[/url] [url=https://ataraxd.online/]buy atarax 10mg[/url] [url=https://diflucantbs.online/]diflucan 300 mg[/url]

  6. [url=http://cipro.charity/]ciprofloxacin usa[/url] [url=http://nexiumtab.com/]can i buy nexium over the counter in uk[/url] [url=http://amreddypharmacy.com/]reliable canadian online pharmacy[/url] [url=http://tetracycline.directory/]tetracycline 500 mg tablet[/url] [url=http://cephalexine.online/]cephalexin tablets 500mg[/url] [url=http://advairtabs.com/]advair prescription price[/url]

  7. [url=https://augmentinp.com/]amoxil coupon[/url] [url=https://thebarepharmacy.com/]secure medical online pharmacy[/url] [url=https://wellbutrin.directory/]buy zyban without prescription[/url] [url=https://dexamethasone.pics/]dexamethasone india[/url] [url=https://fluoxetines.com/]buying prozac in mexico[/url] [url=https://nationalpharmacygroup.net/]best canadian online pharmacy[/url] [url=https://gabapentin.men/]drug gabapentin 600 mg[/url]

  8. [url=https://lioresalbaclofen.shop/]10mg baclofen tablet[/url] [url=https://dynamicpharmacyhealth.com/]order pharmacy online egypt[/url] [url=https://dexamethasone.pics/]dexamethasone tablets uk[/url] [url=https://baclofentabs.quest/]over the counter baclofen[/url] [url=https://finpecia.company/]propecia for sale[/url] [url=https://nationalpharmacygroup.net/]canadian pharmacy 1 internet online drugstore[/url]

  9. [url=https://sildenafilkamagra.shop/]generic viagra india[/url] [url=https://gabapentin.men/]medicine gabapentin 100mg[/url] [url=https://tamoxifen247.com/]price of tamoxifen 20 mg[/url] [url=https://singulair.cyou/]singulair price usa[/url] [url=https://artofpharmacy.com/]mexican pharmacy weight loss[/url] [url=https://ulasix.online/]purchase lasix online[/url] [url=https://dexamethasone.pics/]dexamethasone 10[/url] [url=https://synthroid.pics/]175 mg synthroid[/url]

  10. [url=https://cafergot.directory/]cafergot[/url] [url=https://mex-pharmacy.com/]cheapest pharmacy for prescriptions[/url] [url=https://paxil.company/]paxil 100mg[/url] [url=https://sildenafilkamagra.shop/]buy sildenafil online canada[/url]

  11. [url=http://dynamicpharmacyhealth.com/]reliable canadian online pharmacy[/url] [url=http://furosemide.pics/]lasix 40[/url] [url=http://fluoxetine.company/]no prescription fluoxetine[/url] [url=http://lioresalbaclofen.shop/]baclofen 10mg pill[/url] [url=http://cymbalta.digital/]buy generic cymbalta[/url]

  12. The potential role of buy ivermectin in managing COVID-19 has been a subject of intense debate and scrutiny within the scientific community and among healthcare professionals. While some observational studies and small-scale trials have reported favorable outcomes with ivermectin treatment, others have raised concerns about methodological limitations and conflicting results. Regulatory agencies and professional medical organizations have emphasized the need for well-designed randomized controlled trials to evaluate the efficacy and safety of stromectol in COVID-19 patients.

  13. As researchers continue to investigate the therapeutic potential of ivermectin horse wormer, it is essential to consider the broader implications of its use in public health interventions. Beyond its direct effects on parasites and viruses, stromectol may exert indirect effects on host immune responses, microbiota, and ecological systems. Understanding these complex interactions is critical for optimizing treatment strategies, minimizing unintended consequences, and promoting the responsible use of the drug.

  14. mexican pharmaceuticals online [url=http://mexicoph24.life/#]mexican pharmacy[/url] purple pharmacy mexico price list

  15. nolvadex pills [url=http://nolvadex.life/#]low dose tamoxifen[/url] does tamoxifen cause bone loss

  16. order cytotec online [url=http://cytotec.club/#]Misoprostol 200 mg buy online[/url] buy cytotec online

  17. buy ciprofloxacin [url=https://ciprofloxacin.tech/#]ciprofloxacin 500mg buy online[/url] buy cipro online

  18. purchase cytotec [url=https://cytotec.club/#]cytotec online[/url] Cytotec 200mcg price

  19. 25 mg lisinopril [url=http://lisinopril.network/#]zestril lisinopril[/url] lisinopril 40 mg prices

  20. lisinopril 25 mg [url=http://lisinopril.network/#]lisinopril 4 mg[/url] lisinopril 40 mg pill

  21. cipro online no prescription in the usa [url=https://ciprofloxacin.tech/#]cipro pharmacy[/url] ciprofloxacin 500mg buy online

  22. buying cheap propecia without dr prescription [url=https://finasteride.store/#]get cheap propecia tablets[/url] cost of cheap propecia prices

  23. lisinopril 20mg 37.5mg [url=http://lisinopril.network/#]lisinopril 20 mg tablet price[/url] lisinopril pills for sale

  24. propecia otc [url=https://finasteride.store/#]get generic propecia online[/url] rx propecia

  25. buy cipro online canada [url=https://ciprofloxacin.tech/#]cipro 500mg best prices[/url] purchase cipro

  26. tamoxifen bone pain [url=http://nolvadex.life/#]does tamoxifen cause weight loss[/url] tamoxifen for men

  27. buy cytotec pills online cheap [url=http://cytotec.club/#]cytotec abortion pill[/url] buy cytotec online fast delivery

  28. Buy Cialis online [url=https://cialist.pro/#]buy cialis online[/url] Buy Tadalafil 20mg

  29. Viagra online price [url=http://viagras.online/#]Buy generic 100mg Viagra online[/url] п»їBuy generic 100mg Viagra online

  30. Cialis over the counter [url=https://cialist.pro/#]buy cialis pill[/url] Generic Tadalafil 20mg price

  31. indian pharmacies safe [url=https://pharmindia.online/#]mail order pharmacy india[/url] indian pharmacies safe

  32. canadian pharmacy coupon [url=https://pharmworld.store/#]canadian pharmacy coupon[/url] canadian pharmacy without prescription

  33. best no prescription online pharmacies [url=http://pharmnoprescription.icu/#]best online pharmacies without prescription[/url] best no prescription online pharmacies

  34. lisinopril prescription cost [url=https://lisinopril.club/#]average cost of lisinopril[/url] compare zestril prices

  35. generic propecia without dr prescription [url=http://propeciaf.online/#]cost generic propecia prices[/url] cost of cheap propecia

  36. buy lisinopril 10 mg online [url=https://lisinopril.club/#]can i buy lisinopril over the counter in mexico[/url] lisinopril 10 12.5 mg tablets

  37. can you buy lisinopril online [url=http://lisinopril.club/#]prinivil drug cost[/url] lisinopril mexico

  38. indian pharmacy [url=https://cheapestindia.shop/#]п»їlegitimate online pharmacies india[/url] indian pharmacy online

  39. canada drug pharmacy [url=https://cheapestcanada.shop/#]cheapestcanada.com[/url] canadapharmacyonline com

  40. pharmacies in mexico that ship to usa [url=https://cheapestmexico.shop/#]reputable mexican pharmacies online[/url] medication from mexico pharmacy

  41. http://cheapestandfast.com/# order prescription drugs online without doctor
    reputable mexican pharmacies online [url=https://cheapestmexico.shop/#]п»їbest mexican online pharmacies[/url] mexican pharmaceuticals online

  42. https://cheapestmexico.com/# buying prescription drugs in mexico online
    buying prescription drugs in mexico online [url=https://cheapestmexico.com/#]п»їbest mexican online pharmacies[/url] buying from online mexican pharmacy

  43. indian pharmacy paypal [url=http://cheapestindia.com/#]pharmacy website india[/url] buy medicines online in india

  44. pharmacie en ligne france pas cher [url=https://eumedicamentenligne.shop/#]vente de mГ©dicament en ligne[/url] pharmacie en ligne sans ordonnance

  45. farmaci senza ricetta elenco [url=https://eufarmacieonline.shop/#]comprare farmaci online all’estero[/url] farmacie online sicure

  46. Farmacie on line spedizione gratuita [url=https://eufarmacieonline.shop/#]Farmacia online miglior prezzo[/url] farmaci senza ricetta elenco

  47. pharmacie en ligne france pas cher [url=https://eumedicamentenligne.shop/#]pharmacies en ligne certifiГ©es[/url] pharmacies en ligne certifiГ©es

Leave a Reply

Your email address will not be published. Required fields are marked *