You were never here, you didn't see anything..

Gentoo and caching DNS server

I recently moved my server from Slackware to Gentoo. There were several reasons for this move to which I may write something up later, however I am pleased with the results so far. Of the services my server provided, DNS for the local network was among them. I ran a caching DNS server which on Slackware is the default configuration for BIND. On Gentoo it is close to the same, only needing a few minor edits to fill the task.

The steps to get things going were rather simple. First, install BIND:

emerge -aq bind

With BIND installed a few edits tot he config file:

vim /etc/bind/named.conf

I only made two edits to the default file. Edit 1:

In the section for ‘acl “trusted”‘ I added a line for the local network:

And in the section for ‘options’ I told it to listen on the local network interface by adding the following right under the localhost ip:

listen-on {; };

Start up the name server:

/etc/init.d/named start

Then confirm it works with a query. I used dig, which had to be installed first and is part of the “bind-tools” port:

emerge -aq bind-tools

andarius@photon : dig

; <<>> DiG 9.8.1 <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5976
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 4, ADDITIONAL: 0

;                    IN      A

;; ANSWER SECTION:             300     IN      A             300     IN      A             300     IN      A             300     IN      A             300     IN      A             300     IN      A

;; AUTHORITY SECTION:             172153  IN      NS             172153  IN      NS             172153  IN      NS             172153  IN      NS

;; Query time: 13 msec
;; WHEN: Mon Jan  2 00:59:56 2012
;; MSG SIZE  rcvd: 196

The key line to check is ";; SERVER:" which is the IP (localhost in this case of course) which answered our query. As the test was successful named is added to the default run-level:

rc-update add named default

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *


This blog is kept spam free by WP-SpamFree.

Most who fail…

Most who fail have yet to really try!