Bind
From Cheatsheet
I'm FINALLY switching over to BIND, not because djbdns isn't good, it is, but the guy who wrote it won't open it up, and so now hardly anyone supports it, so there you go :)
Likely the first thing you want to do is install it so run
apt-get install bind9
this will install it in the normal /etc/bind9 folder, if you want to chroot it elsewhere for security, you can try it using this howto
after you get it installed, you have to modify the config file /etc/bind9/named.conf
you need 6 files to run bind, the named.conf references them all through includes: I'm FINALLY switching over to BIND, not because djbdns isn't good, it is, but the guy who wrote it won't open it up, and so now hardly anyone supports it, so there you go :)
BIND server is a big hairy complex package that does DNS, sometimes well. You can do some pretty complex routing stuff with it, but my guess is you're not, you probably just need the basics. So here's my version of what those might be:
- you have you yourdomain.com on your server that you want to set up as a nameserver, so it'd be ns1.yourdomain.com or similar
- you want to point other domains to your nameserver and have them know where to go to find their site, often times it might be on the same server. BIND doesn't really care if it is or isn't, it treats everything the same. This is why things get soooo confusing
- Your nameserver grabs periodic snapshots (or DNS cache) of things it has found on the internet, so it doesn't have to go looking for them again and again. You don't need to care about this, but it's why when you make a DNS change, nothing happens for awhile, because all the other DNS servers do the same thing, to avoid swamping the internet.
Likely the first thing you want to do is install it so run
apt-get install bind9
this will install it in the normal /etc/bind9 folder, if you want to chroot it elsewhere for security, you can try it using this howto
config files
you need 6 files to run bind, the named.conf references them all through includes:
| named.conf | tells people where to find info if you don't have it and points to db.root, where the root nameservers are listed | zone "." { type hint; file "/etc/bind/db.root"; |
| tells about localhost, and defines this bind as master | zone "localhost" { type master; file "/etc/bind/db.local"; | |
| sets up local 127 network | zone "127.in-addr.arpa" { type master; file "/etc/bind/db.127"; | |
| named.root or db.root | defines all the root nameservers to bind knows where the internet is (top part only shown -->) | ; formerly NS.INTERNIC.NET
A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4
|
| named.conf.local | where you put all the includes to the zone files you want people to find like db.mydomain.com | zone "mydomain.com" { type master; file "/etc/bind/db.mydomain.com"; }; |
| db.local | zone file for localhost so bind knows who localhost is | $TTL 604800 @ IN SOA localhost. root.localhost. ( @ IN NS localhost. |
| db.127 | reverse of db.local, so bind knows 127.0.0.1 belongs to localhost | |
| db.mydomain.com | here's where the real data goes (cut/paste example below table) | |
| $TTL 80 | ||
| Statement of Authority, what nameserver determines what happens with mydomain.com | @ IN SOA ns2.logicalwebhost.com. root.mydomain.com. ( | |
| serial #, increments somehow | 2006051300 ;serial | |
| how often (in seconds here) it refreshes | 7200 ;refresh | |
| how often it retries | 3600 ; retry | |
| how long it takes to expire | 1209600 ; expires | |
| minimum time | 86400 ) | |
| defines 1st nameserver | mydomain.com. 14400 IN NS ns1.logicalwebhost.com. | |
| defines 2nd nameserver | mydomain.com. 14400 IN NS ns2.logicalwebhost.com. | |
| MX record, where to go looking for mail | IN MX 10 mail.mydomain.com. | |
| where is localhost | localhost 80 IN A 127.0.0.1 | |
| the MX record points to this IP of the mailserver | mail 80 IN A 1.2.3.4 | |
| the A record points to where the website is | mydomain.com. 80 IN A 5.6.7.8 | |
| another A record for www.mydomain.com | www 14400 IN A 5.6.7.8 | |
| another A record for webmail (probably should be a CNAME) | webmail 80 IN A 5.6.7.8 |
example zone file
db.mydomain.com
$TTL 80
@ IN SOA ns1.logicalwebhost.com. root.mydomain.com. (
2006051300
7200
3600
1209600
86400 )
mydomain.com. 14400 IN NS ns1.logicalwebhost.com.
mydomain.com. 14400 IN NS ns2.logicalwebhost.com.
IN MX 10 mail.mydomain.com.
localhost 80 IN A 127.0.0.1
mail 80 IN A 1.2.3.4
mydomain.com. 80 IN A 5.6.7.8
www 14400 IN A 5.6.7.8
webmail 80 IN A 1.2.3.4
