DNS is the Domain Name System that maintains a database that can help user’s computer to translate domain names such as www.ehowstuff.com to IP addresses such as 184.173.214.97. DNS on CentOS and Fedora is based on the named daemon, which is built on the BIND package developed through the Internet Software Consortium. (More information is available from the BIND home page at www.isc.org/products/BIND.) However, these are RPM packages associated with DNS. But not all required to build Bind Chroot DNS Server. bind Includes the basic name server software, including /usr/sbin/named. bind-chroot Includes directories that isolate BIND in a so-called “chroot jail,” which limits access if DNS is compromised. In this post, i will guide you on how to install and configure Bind Chroot DNS server on linux Fedora 16 server.
1. Simply run this command to install Bind Chroot DNS Server :
[root@fedora16 ~]# yum install bind-chroot -y
Examples :
[root@fedora16 ~]# yum install bind-chroot -y Fedora16-Repository | 3.7 kB 00:00 ... Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package bind-chroot.i686 32:9.8.2-1.fc16 will be installed --> Processing Dependency: bind = 32:9.8.2-1.fc16 for package: 32:bind-chroot-9.8.2-1.fc16.i686 --> Running transaction check ---> Package bind.i686 32:9.8.2-1.fc16 will be installed --> Processing Dependency: bind-libs = 32:9.8.2-1.fc16 for package: 32:bind-9.8.2-1.fc16.i686 --> Processing Dependency: liblwres.so.80 for package: 32:bind-9.8.2-1.fc16.i686 --> Processing Dependency: libisccfg.so.82 for package: 32:bind-9.8.2-1.fc16.i686 --> Processing Dependency: libisccc.so.80 for package: 32:bind-9.8.2-1.fc16.i686 --> Processing Dependency: libisc.so.83 for package: 32:bind-9.8.2-1.fc16.i686 --> Processing Dependency: libdns.so.81 for package: 32:bind-9.8.2-1.fc16.i686 --> Processing Dependency: libbind9.so.80 for package: 32:bind-9.8.2-1.fc16.i686 --> Running transaction check ---> Package bind-libs.i686 32:9.8.2-1.fc16 will be installed --> Processing Dependency: bind-license = 32:9.8.2-1.fc16 for package: 32:bind-libs-9.8.2-1.fc16.i686 --> Running transaction check ---> Package bind-license.noarch 32:9.8.1-2.fc16 will be updated --> Processing Dependency: bind-license = 32:9.8.1-2.fc16 for package: 32:bind-libs-lite-9.8.1-2.fc16.i686 ---> Package bind-license.noarch 32:9.8.2-1.fc16 will be an update --> Running transaction check ---> Package bind-libs-lite.i686 32:9.8.1-2.fc16 will be updated ---> Package bind-libs-lite.i686 32:9.8.2-1.fc16 will be an update --> Finished Dependency Resolution Dependencies Resolved ==================================================================================================== Package Arch Version Repository Size ==================================================================================================== Installing: bind-chroot i686 32:9.8.2-1.fc16 updates 71 k Installing for dependencies: bind i686 32:9.8.2-1.fc16 updates 2.0 M bind-libs i686 32:9.8.2-1.fc16 updates 860 k Updating for dependencies: bind-libs-lite i686 32:9.8.2-1.fc16 updates 621 k bind-license noarch 32:9.8.2-1.fc16 updates 72 k Transaction Summary ==================================================================================================== Install 3 Packages Upgrade 2 Packages Total download size: 3.6 M Downloading Packages: (1/5): bind-9.8.2-1.fc16.i686.rpm | 2.0 MB 00:18 (2/5): bind-chroot-9.8.2-1.fc16.i686.rpm | 71 kB 00:00 (3/5): bind-libs-9.8.2-1.fc16.i686.rpm | 860 kB 00:07 (4/5): bind-libs-lite-9.8.2-1.fc16.i686.rpm | 621 kB 00:04 (5/5): bind-license-9.8.2-1.fc16.noarch.rpm | 72 kB 00:00 ---------------------------------------------------------------------------------------------------- Total 113 kB/s | 3.6 MB 00:32 Running Transaction Check Running Transaction Test Transaction Test Succeeded Running Transaction Updating : 32:bind-license-9.8.2-1.fc16.noarch 1/7 Installing : 32:bind-libs-9.8.2-1.fc16.i686 2/7 Installing : 32:bind-9.8.2-1.fc16.i686 3/7 Installing : 32:bind-chroot-9.8.2-1.fc16.i686 4/7 Updating : 32:bind-libs-lite-9.8.2-1.fc16.i686 5/7 Cleanup : 32:bind-libs-lite-9.8.1-2.fc16.i686 6/7 Cleanup : 32:bind-license-9.8.1-2.fc16.noarch 7/7 Installed: bind-chroot.i686 32:9.8.2-1.fc16 Dependency Installed: bind.i686 32:9.8.2-1.fc16 bind-libs.i686 32:9.8.2-1.fc16 Dependency Updated: bind-libs-lite.i686 32:9.8.2-1.fc16 bind-license.noarch 32:9.8.2-1.fc16 Complete!
2. Create a file /var/named/chroot/var/named/fedora16.local with the following configuration:
[root@fedora16 ~]# vi /var/named/chroot/var/named/fedora16.local
Examples :
; ; Addresses and other host information. ; @ IN SOA fedora16.local. hostmaster.fedora16.local. ( 2012051901 ; Serial 43200 ; Refresh 3600 ; Retry 3600000 ; Expire 2592000 ) ; Minimum ; Define the nameservers and the mail servers IN NS ns.fedora16.local. IN A 192.168.1.47 IN MX 10 mail.fedora16.local. mail IN A 192.168.1.51 ns IN A 192.168.1.47
3. Generate an RNDC key :
The rndc tool is used to managed the named daemon. We need to generate a keyfile called /etc/rndc.key which is referenced both by /etc/rndc.conf and /etc/named.conf To do this we use the following command :
[root@fedora16 ~]# rndc-confgen -a -c /etc/rndc.key wrote key file "/etc/rndc.key"
View the content of the RNDC key :
[root@fedora16 ~]# cat /etc/rndc.key
key "rndc-key" { algorithm hmac-md5; secret "B2rQEFnrdcAzAt2BiUmBug=="; };
4. Edit the /var/named/chroot/etc/named.conf file for fedora16.local
[root@fedora16 ~]# vi /var/named/chroot/etc/named.conf
options { directory "/var/named"; dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt"; forwarders { 8.8.8.8; }; }; include "/etc/rndc.key"; // We are the master server for fedora16.local zone "fedora16.local" { type master; file "fedora16.local"; };
5. Start the DNS service using the following command :
[root@fedora16 ~]# /etc/init.d/named start Starting named (via systemctl): [ OK ]
6. Make named daemon auto start during boot :
[root@fedora16 ~]# chkconfig named on
7. Before testing, make sure your pc or server using the Bind Chroot DNS Server that has been set up :
Test DNS using host command :
[root@fedora16 ~]# host -t mx fedora16.local fedora16.local mail is handled by 10 mail.fedora16.local.
Test DNS using nslookup command :
[root@fedora16 ~]# nslookup > ns.fedora16.local Server: 127.0.0.1 Address: 127.0.0.1#53 Name: ns.fedora16.local Address: 192.168.1.47 > mail.fedora16.local Server: 127.0.0.1 Address: 127.0.0.1#53 Name: mail.fedora16.local Address: 192.168.1.51