## DNS and BIND ## Damon Slachter With domain names becoming the "thing to have" these days, some people are feeling left out. If you are one of those people this article just might be for you. I will be concentrating on the BIND implementation of DNS and hopefully, by the end of reading this you will have a fully functional bind server. What is BIND? BIND (Berkeley Internet Name Domain) was written by Kevin Dunlap for the 4.3BSD UNIX operating system as a implementation of the Domain Name System, or DNS. Since its early release for 4.3BSD, BIND has been ported to virtually all flavors of UNIX and Microsoft Windows NT. BIND has since been maintained by the Internet Software Consortium. Before we start I will be assuming you know basic unix commands such as ls, cd, cp, mkdir and others like it. If not, my best advise is to stick around in #FreeBSD on Undernet more often or find a basic unix tutorial. With this being said, your ready to enter the realm of DNS/Bind. Installing the bind8 server is a simple task and can be achieved by doing the following, # cd /usr/ports/net/bind8 # make # make install By executing these few commands you tell the makefile to download the source for bind8, compile it and then install it. Now that the Bind server is installed, we get into the config files themselves. # cd /etc # ls In the /etc directory you should have the file named.conf, if not lets make one, if so you must edit it anyhow. options { directory "/etc/namedb/"; // Config file directory }; zone "jagged.net" in { // Domain you control/own type master; file "db.jagged"; // the file used for domain config }; zone "159.243.207.in-addr.arpa" in { // IP address 207.243.159.x type master; file "db.207.243.159"; // Again, file that controls this }; zone "0.0.127.in-addr.arpa" in { // Local loop zone type master; file "db.127.0.0"; // file controlling this IP field }; zone "." in { // Default, root name servers type hint; file "db.cache"; // Cache file of Internic NS's }; Thats basically it for the /etc/named.conf file, here are a few pointers. Pointers for named.conf zone "159.243.207.in-addr.arpa" in { This line will be used for reverse information on the Class C IP block of 207.243.159.0/24. Do not use 159.243.207, use your actual IP address block, minus the last number. Now its time to get the actual domain database files (ie: db.jagged) setup. # cd /etc # mkdir namedb # ls You will need to ftp to rs.internic.net/domain/ and download named.root and then rename the file as db.cache and your good to go. This is where the reverse names for your IP's are created. In the /etc/namedb dir use your favorite editor, may it be vi, ee or pico and make 3 files. # pico db.127.0.0 In db.127.0.0 file you need the following: @ IN SOA ns1.jagged.net. ns2.jagged.net. ( 1 ; Serial # 10800 ; Refresh after 3 hours 3600 ; Retry after 1 hour 604800 ; Expire after 1 week 86400 ) ; Minimum TTL of 1 day IN NS ns1.jagged.net. IN NS ns2.jagged.net. 1 IN PTR localhost. The "IN NS nsX.jagged.net." lines can be replaced by your dns server's hostname such as sun.jagged.net. or hellspawn.jagged.net. You can also put your ISP's nameserver as the secondary one. ***** TIP: The serial # must be changed every time you edit the file if you want your records to be correctly updated. You can also create serial number in the YYYYMMDDTTTT format (Year, Month, Date, Time: 199901210230 or 9901210230****** Next, # pico db.207.243.159 207.243.159 would be replaced by your actual IP address, not the full address only the first 3 #'s. @ IN SOA ns1.jagged.net. ns2.jagged.net. ( 1 ; Serial 10800 ; Refresh after 3 hours 3600 ; Retry after 1 hour 604800 ; Expire after 1 week 86400 ) ; Minimum TTL of 1 day IN NS ns1.jagged.net IN NS ns2.jagged.net. 93 IN PTR jagged.net. This is the file where you will specify the reverse DNS for your internet IP address. In most cases you will not have reverse delegation over your IP (the ability to set this yourself), but you need to set it up anyways. The line 93 IN PTR jagged.net. is the actual line that specifies what this IP will reverse as, example: > nslookup 207.243.159.93 Server: jagged.net Address: 207.243.159.93 Name: jagged.net Address: 207.243.159.93 For a user with only a hostname such as sun.jagged.net you would just use 93 IN PTR sun.jagged.net. Now comes the fun part, creating your hostnames! # pico db.jagged Where jagged is the name of YOUR actual domain or the hostname your ISP has set for you, i.e.: sparcstation.jagged.net. You may still use the db.jagged file for this but you must specify sparcstation.jagged.net in the /etc/named.conf file. @ IN SOA ns1.jagged.net. ns2.jagged.net. ( 1 ; Serial 10800 ; Refresh after 3 hours 3600 ; Retry after 1 hour 604800 ; Expire after 1 week 86400 ) ; Minimum TTL of 1 day IN NS ns1.jagged.net. IN NS ns2.jagged.net. localhost IN A 127.0.0.1 jagged.net. IN A 207.243.159.93 ns1 IN CNAME jagged.net. ns2 IN CNAME jagged.net. ftp IN CNAME jagged.net. mail IN CNAME jagged.net. www IN CNAME jagged.net. jagged.net. IN MX mail.jagged.net. Here is a brief explanation of what these lines mean. jagged.net. IN A 207.243.159.93 This is the forward lookup for the jagged.net domain. www IN CNAME jagged.net. This creates a "sub domain" or hostname off the root domain jagged.net. The "IN MX" feature of BIND can only be described using a scenario like the following. Imagine you are a network admin and your company needs a separate server just for email. Sure, no problem, but now people have to send email to foobar@mail.jagged.net. This isn't a problem but foobar@jagged.net looks much better to you and your boss so you do the following: jagged.net. IN MX mail.jagged.net. Meaning the "Mail Exchange" jagged.net. points to mail.jagged.net. This command gets much more complicated so I will stop here. Now that all of your config files are ready you can now start the bind server. # /usr/local/sbin/named This starts the named server ***** TIP: If you make changes to your db files just use the command # killall -HUP named to reload your named server. ****** Now you are ready to test out your named server for the first time. You might want to change /etc/resolv.conf so it points to your name server: domain JAGGeD.net nameserver 207.243.159.93 Type nslookup and you should see something along the lines of > nslookup Default Server: jagged.net Address: 207.243.159.93 > If you don't see something close to this then something isn't configured right. Go back through the steps mentioned above and see if you typed something wrong. I hope you enjoyed the first edition of the DNS/Bind server startup guide and have found it useful. If you have ANY questions please feel free to join us in #FreeBSD on the Undernet IRC servers. My nickname is RazorZ and I would be more than happy to help you with any problems you might encounter. Good luck! -- Damon Slachter -- a.k.a. RazorZ $Id: dns.txt,v 1.1 2000/02/16 08:07:42 jim Exp $