BIND (or 'named' as the BIND implementation on FreeBSD is called) is a bit more difficult to set up than the other 'must have' systems for a Domain Controller. And, it is one of the most important to 'get right'. For without properly functioning DNS, your network won't recognize the machines that are running on it by name.
The following is a 'short list' of the things that need to be accomplished
using the sample files, plus some additional information. The first step, of
course, is to install the latest version of BIND on your computer. FreeBSD already
installs 'named' with the 'base' installation, so it should be no problem to
simply enable it. For other operating systems, such as Linux, you may have to
install it as a package, via an 'RPM' or one of the other package systems.
Following that, you should do each of these steps in the order specified.
Once your DNS system is running, you should verify that everything works by using 'nslookup'. The easiest way is simply to invoke 'nslookup' from the console.
The contents of the various files are shown here. You can 'clip' the text out
of the html text and paste it into the appropriately named file, modifying the
text as needed for your operating system, machine name, domain name, and
network settings.
NOTE: The 'named.root' file (aka 'root hints') was not included here. It should
be installed automatically when you install BIND on your system. If you need an updated 'root hints'
file, you should obtain one from 'ftp://ftp.internic.net/domain/named.root'.
The 'named.conf' (or bind.conf) file is the main configuration file and resides in the 'bind database' directory (typically '/etc/namedb' or '/etc/bindb' or similar). This example uses an IP address of 192.168.1.1 for the DNS server, a server name of 'FreeBSDServer', and a domain of 'WORKGROUP.local'. You will need to change these to match your own network. Also, 'directory' is one of the global options, so you should make certain that it is properly assigned as well.
// MUST CHANGE ITEMS // a) the IP address 192.168.1.1 // b) the 'forwarders' section // c) the name of the RDNS files (depends upon the subnets) // d) the name of the server and domain (FreeBSDServer and WORKGROUP.local) // e) the correct database directory '/etc/namedb' (if yours differs) // f) the correct IP addresses for the 'forwarders' section. If this server // will not connect to the internet, you should comment that section out. options { listen-on { 192.168.1.1; }; version "why are you looking here"; directory "/etc/namedb"; pid-file "/var/run/named/pid"; // things I have added hostname "FreeBSDServer.WORKGROUP.local"; notify yes; forward first; // the default fetch-glue no; // only fetches requested records, not everything // If you've got a DNS server around at your upstream provider, enter // its IP address here, and enable the line below. This will make you // benefit from its cache, thus reduce overall DNS traffic in the Internet. forwarders { x.x.x.x; // your ISP's DNS server goes here x.x.x.x; // your ISP's backup DNS server goes here }; /* * If there is a firewall between you and nameservers you want * to talk to, you might need to uncomment the query-source * directive below. Previous versions of BIND always asked * questions using port 53, but BIND 8.1 uses an unprivileged * port by default. */ // query-source address * port 53; /* * If running in a sandbox, you may have to specify a different * location for the dumpfile. */ // dump-file "s/named_dump.db"; // SORT LIST sortlist { { localhost; localnets; }; { localnets; }; }; }; // SECONDARY ZONES // If you enable a local name server, don't forget to enter 127.0.0.1 // first in your /etc/resolv.conf so this server will be queried. // Also, make sure to enable it in /etc/rc.conf. zone "." { type hint; file "named.root"; }; zone "WORKGROUP.local" { type master; allow-update { 192.168.0.0/16; }; allow-transfer { 192.168.0.0/16; }; notify yes; file "m/WORKGROUP.local"; }; zone "localhost" { type master; file "m/named.localhost"; allow-transfer { localhost; }; notify no; }; # reverse zones zone "0.0.127.IN-ADDR.ARPA" { type master; file "m/localhost.rev"; }; zone "1.168.192.in-addr.arpa" { type master; file "m/1.168.192.in-addr.arpa"; allow-update { 192.168.1.0/24; }; allow-transfer { 192.168.1.0/24; }; }; // RFC 3152 zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA" { type master; file "m/localhost-v6.rev"; }; // RFC 1886 -- deprecated zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.INT" { type master; file "m/localhost-v6.rev"; };
Getting this 'right' is the hardest part of setting up your DNS. So I hope to help you out by providing you something that 'works'.
This file is the 'master' zone file for localhost, and is typically already installed in
the database as part of the BIND installation. You should copy it to the 'm' directory
or change the reference to it in 'named.conf'. The 'm' directory is preferable, as it is
intended to always be writable by the BIND daemon, in case it is running as 'other than
root'. It is also a standard way of setting things up, where 'm' has master zone files,
and 's' has slave zone files.
This file (and others in the 'm' directory) should be 'chmod 444' and 'chown bind:wheel'.
$ORIGIN localhost. $TTL 6h @ IN SOA localhost. postmaster.localhost. ( 1 ; serial 3600 ; refresh 1800 ; retry 604800 ; expiration 3600 ) ; minimum IN NS localhost. IN A 127.0.0.1
This is your 'primary zone file' for WORKGROUP.local (change to your domain). The
entry 'root.FreeBSDServer.WORKGROUP.local' is a reference to the e-mail address
'root@FreeBSDServer.WORKGROUP.local' and can be changed appropriately. You should
modify both 'WORKGROUP.local', the alias machine names, and the IP addresses to match
your network. These addresses are 'fixed'. Dynamic updates will happen when DHCP and
Samba 3 are working together with BIND and notifying it of changes to the zones.
This file (like others in the 'm' directory) should be 'chmod 444' and 'chown bind:wheel'.
$TTL 3600 WORKGROUP.local. IN SOA FreeBSDServer.WORKGROUP.local. root.FreeBSDServer.WORKGROUP.local. ( 2004081707 ; Serial YYYYMMDDnn 10800 ; Refresh 3600 ; Retry 604800 ; Expire 86400 ) ; Minimum TTL ; DNS Servers @ IN NS FreeBSDServer.WORKGROUP.local. ; Machine Names localhost IN A 127.0.0.1 FreeBSDServer IN A 192.168.1.1 ; mail server (use this if you have a mail server running) mail IN A 192.168.1.1 @ IN A 192.168.1.1 ; Aliases (use this if you have a web server here, www.WORKGROUP.local) www IN CNAME @ ; MX Record (use this if you have a mail server running) @ IN MX 10 mail.WORKGROUP.local.
As it says in the comments, the file can be automatically generated using the
'make-localhost' script. If you have this script in your BIND implementation,
you should go ahead and run it to generate the file, and then copy it to the
'm' directory. Otherwise, you can use the example here. You must edit it to
reflect the correct server name and domain name.
This file (like others in the 'm' directory) should be 'chmod 444' and 'chown bind:wheel'.
; This file is automatically edited by the `make-localhost' script in ; the /etc/namedb directory. ; $TTL 3600 @ IN SOA FreeBSDServer.WORKGROUP.local. root.FreeBSDServer.WORKGROUP.local. ( 2004081701 ; Serial YYYYMMDDnn 3600 ; Refresh 900 ; Retry 3600000 ; Expire 3600 ) ; Minimum IN NS FreeBSDServer.WORKGROUP.local. 1 IN PTR localhost.WORKGROUP.local.
Similar to 'localhost.rev', the 'localhost-v6.rev' file handles the reverse lookups
for localhost via IPV6. It should also be updated to reflect the correct domain name
and server name.
This file (like others in the 'm' directory) should be 'chmod 444' and 'chown bind:wheel'.
; This file is automatically edited by the `make-localhost' script in ; the /etc/namedb directory. ; $TTL 3600 @ IN SOA FreeBSDServer.WORKGROUP.local. root.FreeBSDServer.WORKGROUP.local. ( 20040817 ; Serial 3600 ; Refresh 900 ; Retry 3600000 ; Expire 3600 ) ; Minimum IN NS FreeBSDServer.WORKGROUP.local. IN PTR localhost.WORKGROUP.local.
This is the 'RDNS' lookup zone file, which should contain entries for each IP address
that was mentioned in 'm/WORKGROUP.local' and that belongs in the subnet for '192.168.1/24'.
You will notice that the name corresponds to the 'reversed' numer order of the IP address range,
and the final number is left off. Entries for each of the 'final numbers' will be placed in
this file, initially with the 'fixed' values, and dynamically with the values sent during updates
and zone transfers. As with the other files, you should modify it to reflect the correct
domain name, server name, and IP address for the server. The '1' entry refers (in this case)
to the IP address '192.168.1.1'.
This file (like others in the 'm' directory) should be 'chmod 444' and 'chown bind:wheel'.
$TTL 3600 @ IN SOA FreeBSDServer.WORKGROUP.local. root.FreeBSDServer.WORKGROUP.local. ( 2004081701 ; Serial YYYYMMDDnn 3600 ; Refresh 900 ; Retry 3600000 ; Expire 3600 ) ; Minimum IN NS FreeBSDServer.WORKGROUP.local. 1 IN PTR FreeBSDServer.WORKGROUP.local.
©2004-13 by Stewart~Frazier Tools, Inc. - all rights reserved
Last Update: 6/23/2013
Back to 'Windows to UNIX®' page
Back to S.F.T. Inc. main page