pantz.org banner
Setup of BIND 9 name server on OpenBSD
Posted on 01-02-2007 23:13:00 UTC | Updated on 01-02-2007 23:13:00 UTC
Section: /software/bind/ | Permanent Link

This setup was done on OpenBSD 4.1. BIND is installed on OpenBSD 4.1 by default. The files shown below have the paths mentioned at the top. The named dir (/var/named/) has dir's in it that have the config files. Make sure all files and directories are owned by root:named. Check the /var/log/messages for errors on startup. If you dont have any localy resolvable hostnames just take out the last few lines in named.conf.

To start the server use the command argument "-4" for ipv4 only in /etc/rc.local file. The named server should start on boot.

The config below is very simple and has only one domain (domain.lan). It uses the ip block 192.168.0. It uses comcast's name servers for forwarding queries it can't answer. Run only on your internal interface. Change the ip addresses to the internal ip addresses you want to use.

The first file below is /var/named/etc/named.conf. This is the main Bind config file.


options {
        allow-query { 127.0.0.1; 192.168.0/24; };
        allow-recursion { 127.0.0.1; 192.168.0/24; };
        forwarders { 68.87.73.242; 68.87.71.226; };
        listen-on { 192.168.0.1; };
        listen-on-v6 { none; };
        version "gateway dns server";
};

controls { };

logging {
        category lame-servers { null; };
};

zone "." {
        type hint;
        file "standard/root.hint";
};

zone "localhost" {
        type master;
        file "standard/localhost";
        allow-transfer { localhost; };
};

zone "127.in-addr.arpa" {
        type master;
        file "standard/loopback";
        allow-transfer { localhost; };
};

zone "com" {
        type delegation-only;
};

zone "net" {
        type delegation-only;
};

zone "org" {
        type delegation-only;
};

zone "domain.lan" {
        type master;
        file "master/db.domain.lan";
        allow-update { none; };
};

zone "0.168.192.in-addr.arpa" {
        type master;
        file "master/db.0.168.192";
        allow-update { none; };
};

The next file below is the /var/named/standard/root.hint file. This file has the root dns servers in it.

;       $OpenBSD: root.hint,v 1.2 2004/01/30 18:59:41 jakob Exp $
;
;       This file holds the information on root name servers needed to
;       initialize cache of Internet domain name servers
;       (e.g. reference this file in the "cache  .  <file>"
;       configuration file of BIND domain name servers).
;
;       This file is made available by InterNIC
;       under anonymous FTP as
;           file                /domain/named.root
;           on server           FTP.INTERNIC.NET
;       -OR-                    RS.INTERNIC.NET
;
;       last update:    Jan 29, 2004
;       related version of root zone:   2004012900
;
;
; formerly NS.INTERNIC.NET
;
.                        3600000  IN  NS    A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET.      3600000      A     198.41.0.4
;
; formerly NS1.ISI.EDU
;
.                        3600000      NS    B.ROOT-SERVERS.NET.
B.ROOT-SERVERS.NET.      3600000      A     192.228.79.201
;
; formerly C.PSI.NET
;
.                        3600000      NS    C.ROOT-SERVERS.NET.
C.ROOT-SERVERS.NET.      3600000      A     192.33.4.12
;
; formerly TERP.UMD.EDU
;
.                        3600000      NS    D.ROOT-SERVERS.NET.
D.ROOT-SERVERS.NET.      3600000      A     128.8.10.90
;
; formerly NS.NASA.GOV
;
.                        3600000      NS    E.ROOT-SERVERS.NET.
E.ROOT-SERVERS.NET.      3600000      A     192.203.230.10
;
; formerly NS.ISC.ORG
;
.                        3600000      NS    F.ROOT-SERVERS.NET.
F.ROOT-SERVERS.NET.      3600000      A     192.5.5.241
;
; formerly NS.NIC.DDN.MIL
;
.                        3600000      NS    G.ROOT-SERVERS.NET.
G.ROOT-SERVERS.NET.      3600000      A     192.112.36.4
;
; formerly AOS.ARL.ARMY.MIL
;
.                        3600000      NS    H.ROOT-SERVERS.NET.
H.ROOT-SERVERS.NET.      3600000      A     128.63.2.53
;
; formerly NIC.NORDU.NET
;
.                        3600000      NS    I.ROOT-SERVERS.NET.
I.ROOT-SERVERS.NET.      3600000      A     192.36.148.17
;
; operated by VeriSign, Inc.
;
.                        3600000      NS    J.ROOT-SERVERS.NET.
J.ROOT-SERVERS.NET.      3600000      A     192.58.128.30
;
; operated by RIPE NCC
;
.                        3600000      NS    K.ROOT-SERVERS.NET.
K.ROOT-SERVERS.NET.      3600000      A     193.0.14.129
;
; operated by ICANN
;
.                        3600000      NS    L.ROOT-SERVERS.NET.
L.ROOT-SERVERS.NET.      3600000      A     198.32.64.12
;
; operated by WIDE
;
.                        3600000      NS    M.ROOT-SERVERS.NET.
M.ROOT-SERVERS.NET.      3600000      A     202.12.27.33
; End of File

The next file below is the localhost zone file /var/named/standard/localhost.

; $OpenBSD: db.localhost,v 1.2 2005/02/07 06:08:10 david Exp $

$ORIGIN localhost.
$TTL 6h

@       IN      SOA     localhost. root.localhost. (
                        1       ; serial
                        1h      ; refresh
                        30m     ; retry
                        7d      ; expiration
                        1h )    ; minimum

                NS      localhost.
                A       127.0.0.1
                AAAA    ::1

The next file below is the file for our only zone the domain.lan zone. The path for it is /var/named/master/db.domain.lan.

domain.lan.     86400   IN SOA  gateway.domain.lan. root.gateway.domain.lan. ( 1 10800 3600 6044800 86400 )
                86400   IN NS   gateway.domain.lan.

gateway.domain.lan. 	86400   IN   A    192.168.0.1
machine1.domain.lan.   	86400   IN   A    192.168.0.2
machine2.domain.lan.  	86400   IN   A    192.168.0.3
dhcp4.domain.lan.   	86400   IN   A    192.168.0.4
dhcp5.domain.lan.   	86400   IN   A    192.168.0.5
dhcp6.domain.lan.   	86400   IN   A    192.168.0.6

The next file below is the file for the in-addr.arpa domain. Inverse (reverse) dns records. The path for it is /var/named/master/db.0.168.192.

0.168.192.in-addr.arpa. 86400   IN SOA  gateway.domain.lan. root.gateway.domain.lan. ( 1 10800 3600 6044800 86400 )
                86400   IN NS   gateway.domain.lan.

1.0.168.192.in-addr.arpa.   86400   IN   PTR   gateway.domain.sys.
2.0.168.192.in-addr.arpa.   86400   IN   PTR   machine1.domain.sys.
3.0.168.192.in-addr.arpa.   86400   IN   PTR   machine2.domain.sys.
4.0.168.192.in-addr.arpa.   86400   IN   PTR   dhcp4.domain.sys.
5.0.168.192.in-addr.arpa.   86400   IN   PTR   dhcp5.domain.sys.
6.0.168.192.in-addr.arpa.   86400   IN   PTR   dhcp6.domain.sys.

Reboot after all your files are in place and configured. Bind should start on boot.

Notes: "rndc reload" will force a zone transfer in bind9.

Del.icio.us! | Digg Me! | Reddit!

Related stories


RSS Feed RSS feed logo
About


3com
3ware
alsa
alsactl
alsamixer
amd
android
apache
areca
arm
ati
auditd
awk
badblocks
bash
bind
bios
bonnie
cable
carp
cat5
cdrom
cellphone
centos
chart
chrome
cifs
cisco
cloudera
comcast
commands
comodo
compiz-fusion
corsair
cpufreq
cpufrequtils
cpuspeed
cron
crontab
crossover
cu
cups
cvs
database
dbus
dd
dd_rescue
ddclient
debian
decimal
dhclient
dhcp
diagnostic
diskexplorer
disks
dkim
dns
dos
dovecot
drac
dsniff
dvdauthor
e-mail
echo
editor
emerald
ethernet
expect
ext3
ext4
fat32
fedora
fetchmail
fiber
filesystems
firefox
firewall
flac
flexlm
floppy
flowtools
fonts
format
freebsd
ftp
gdm
gmail
gnome
greasemonkey
greylisting
growisofs
grub
hacking
hadoop
harddrive
hba
hex
hfsc
html
html5
http
https
idl
ie
ilo
intel
ios
iperf
ipmi
iptables
ipv6
irix
javascript
kde
kernel
kickstart
kmail
kprinter
krecord
kubuntu
kvm
lame
ldap
linux
logfile
lp
lpq
lpr
maradns
matlab
memory
mencoder
mhdd
mkinitrd
mkisofs
moinmoin
motherboard
mouse
movemail
mplayer
multitail
mutt
myodbc
mysql
mythtv
nagios
nameserver
netflix
netflow
nginx
nic
ntfs
ntp
nvidia
odbc
openbsd
openntpd
openoffice
openssh
openssl
opteron
parted
partimage
patch
perl
pf
pfflowd
pfsync
photorec
php
pop3
pop3s
ports
postfix
power
procmail
proftpd
proxy
pulseaudio
putty
pxe
python
qemu
r-studio
raid
recovery
redhat
router
rpc
rsync
ruby
saltstack
samba
schedule
screen
scsi
seagate
seatools
sed
sendmail
sgi
shell
siw
smtp
snort
solaris
soundcard
sox
spam
spamd
spf
sql
sqlite
squid
srs
ssh
ssh.com
ssl
su
subnet
subversion
sudo
sun
supermicro
switches
symbols
syslinux
syslog
systemrescuecd
t1
tcpip
tcpwrappers
telnet
terminal
testdisk
tftp
thttpd
thunderbird
timezone
ting
tls
tools
tr
trac
tuning
tunnel
ubuntu
unbound
vi
vpn
wget
wiki
windows
windowsxp
wireless
wpa_supplicant
x
xauth
xfree86
xfs
xinearama
xmms
youtube
zdump
zeromq
zic
zlib