# Guide for Setting Up BIND or DNS Server

## ahuacatlan

Hi,

I'm new to Gentoo and am trying to setup BIND (or any DNS server). Can anyone direct me to a good guide for doing this? I found a result on Google for a Gentoo Wiki but it's no longer accessible... and the cached version is incomplete.

Thanks

----------

## minor_prophets

Are you set on BIND?  I found DJBDNS much easier/user friendly, secure, small, fast...  Rock solid for me and plenty of others and doesn't seem to suffer from some of the design flaws(flamebait, I know) as BIND.

http://www.djbdnsrocks.org/

Seems like a pretty good guide.  I used the Gentoo wiki guide personally, however, most of those are being recreated(hopefully) since the lockdown of the old co-lo that housed the wiki servers.  Crying shame, that.

Take a look.  It is laughably simple compared to BIND and quite scalable.

More on djbdns:

http://tinydns.org/

Author Daniel J. Bernstein's home:

http://cr.yp.to/djbdns.html

Hope that helps

----------

## vaguy02

I currently use BIND, never had any issues with it. 

I can't vouch for this since the crash, but it might be useful.

http://en.gentoo-wiki.com/wiki/BIND

----------

## PaulBredbury

Here's example files which are still relevant, appropriate & correct.

----------

## neysx

if you look for a simple DNS server, try dnsmasq (it also does DHCP btw)

----------

## cyrillic

I second that.

dnsmasq is easy to setup, and works great on my home network.

----------

## ahuacatlan

Thanks very much. I decided to stick with BIND for now and used Paul's post at:

https://forums.gentoo.org/viewtopic-t-402251.html

Now that I have configured BIND, is there any way to test that it's working before I take down the current server and replace it with this new one?

In other words, I haven't yet changed the IP with my domain registrar to make effective the new DNS server. Before doing this, is there anyway to test out the config?

----------

## richard.scott

you can use the "dig" command if you've installed bind-tools:

```
# dig @[server ip] www.domain.com a
```

IP = your DNS servers IP as set in the "listen" section in named.conf

The hostname is from one of the domains your hosting.

and the "a" is to return an A record.

See this also for more information on BIND:

http://www.zytrax.com/books/dns/

You'll find BIND really easy to use. I've been using it since 2002!

Rich

----------

## ahuacatlan

Thanks Richard.

I'm assuming something is wrong...

```

www ~ # dig @99.166.12.62 www.empco.org a

; <<>> DiG 9.4.2-P2 <<>> @99.166.12.62 www.empco.org a

; (1 server found)

;; global options:  printcmd

;; connection timed out; no servers could be reached

www ~ #  

```

Does anyone know how I can troubleshoot this?

Thanks

----------

## ahuacatlan

Also,

note the following:

```

www ~ # dig @localhost www.empco.org

; <<>> DiG 9.4.2-P2 <<>> @localhost www.empco.org

; (2 servers found)

;; global options:  printcmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11775

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 1

;; QUESTION SECTION:

;www.empco.org.         IN   A

;; ANSWER SECTION:

www.empco.org.      259200   IN   A   99.166.12.62

;; AUTHORITY SECTION:

empco.org.      259200   IN   NS   ns.empco.org.

empco.org.      259200   IN   NS   68.94.157.1.

empco.org.      259200   IN   NS   68.94.156.1.

;; ADDITIONAL SECTION:

ns.empco.org.      259200   IN   A   99.166.12.62

;; Query time: 0 msec

;; SERVER: 127.0.0.1#53(127.0.0.1)

;; WHEN: Fri Jan  2 07:13:14 2009

;; MSG SIZE  rcvd: 129

www ~ # 

```

----------

## ahuacatlan

Fixed it;

In /etc/bind/named.conf:

I changed:

```
        listen-on { 127.0.0.1; }; 

```

to:

```
        listen-on { 127.0.0.1; 10.1.1.100; }; 

```

10.1.1.100 being the local IP of the server

----------

