# quick dns question

## legit

hey all,

After reading the HOWTO in the gentoo wiki i think i know how to create a domain for my home network only, but i just want to check.

So if i want to set up a domain and then only have it accessible from within my home network only i simply have to add a zone and include my local network IP's(1.0.0.*) only right?

thanks,

- legit

(I guess this is for BIND i don't know what other dns servers are out there)

----------

## Rob1n

Yes, that's right - you'll need to set up both forward and reverse mappings of course.

BIND is probably rather over the top for this though - a simpler DNS server like maradns may well be a better option.  It depends whether you're just wanting to get it working or to learn how to manage a DNS server - BIND will definitely be more useful commercially.

----------

## legit

well, i really just want something to map a local ip to a local domain, so something simpler is better.  I assume its the same concept though?  what do you mean map both directions?

----------

## Rob1n

You'll need to be able to both map a computer name to IP address, and to be able to map an IP address to a computer name (e.g. so logs can show the name of the remote system).  These are done (in BIND anyway) as two separate processes, since a single computer name can map to multiple IP addresses (and multiple computer name can map to the same IP address).  Other DNS servers (such as maradns, which I mention because it's what I'm using) allow you to shortcut this step, as in most cases you only have a 1-to-1 mapping.

----------

## legit

know of any good installation guides for maradns?

----------

## Rob1n

There's some basic installation guides at http://www.maradns.org/tutorial/tutorial.html - you'll probably want the recursive DNS server one (it includes setting up for a local domain).

----------

## legit

sweet thanks

----------

## legit

Alright, I can't get it working, could someone help me out.

I have my linux box and i want to add the domain blah.ld to my local network so i set up my /etc/mararc file to:

```

csv2 = {}

csv2["blah.ld"] = "db.blah.ld"

ipv4_bind_addresses = "127.0.0.1, 10.0.0.30"

chroot_dir = "/etc/maradns"

recursive_acl = "10.0.0.0/24"

```

and then i create the file: /etc/maradns/db.blah.ld"

and put in it:

```

blah.ld 10.0.0.30

*.blah.ld 10.0.0.30

```

I then started the dns server and used it to try to access montag.ld

but it just gave me a not accessible page.

any suggestions?

----------

## Rob1n

You're missing the trailing dot on the domain name.  Your mararc should read:

```

csv2 = {} 

csv2["blah.ld."] = "db.blah.ld" 

ipv4_bind_addresses = "127.0.0.1, 10.0.0.30" 

chroot_dir = "/etc/maradns" 

recursive_acl = "10.0.0.0/24"

```

and the /etc/maradns/db.blah.ld:

```

blah.ld. 10.0.0.30 

*.blah.ld. 10.0.0.30

```

----------

## legit

hmmm.... I tried that too, still no luck.

----------

## Rob1n

Okay, lets go through it 1 step at a time.

 Create the /etc/mararc and /etc/maradns/db.blah.ld files (as shown earlier).

 Start the maradns server (it needs restarting if you make any changes).

 Do a test lookup: "askmara Ablah.ld."

 Add the local server to your DNS lookup (edit /etc/resolv.conf and add a new server line - you'll need to edit /etc/conf.d/net to persist this entry).

 Test a DNS lookup: "dig -t A blah.ld"

----------

## legit

ok, i set up the files as shown above.  then i restarted the server, then i did askmara blah.ld and it said:

```
#Querying the server with the IP 127.0.0.1

#Hard Error: Timeout
```

shouldn't it also be looking for 10.0.0.30?  and also i have both an eth0 and eth1(but only eth1 is connected) could this be causing problems?

thanks for the help

----------

## Rob1n

No, 127.0.0.1 is okay as you've told the server to bind to that address as well.  Can you check the server is actually running (ps aux | grep maradns) and that you made the correct query: "askmara Ablah.ld." (you need the A as that tells it what sort of query you're doing, and you also need the trailing .)

----------

## legit

Oh ok, yeah i thought the A was a typo so i didn't include it.  I will test it the correct way when i get back to my machine.

----------

## legit

Ok, I can now ping blah.ld from a different computer but it doesn't show apache when i type the address into a browser.  Is this just a matter of setting up my domain name?  and also, how can i be sure that my dns server isn't accessible from outside my home network?

thanks for all the help

- legit

----------

## Rob1n

 *legit wrote:*   

> Ok, I can now ping blah.ld from a different computer but it doesn't show apache when i type the address into a browser.  Is this just a matter of setting up my domain name?

 

That depends on your apache configuration - it should work out of the box though.  But if you can ping the server by name then the DNS resolution part is working okay.

 *Quote:*   

> and also, how can i be sure that my dns server isn't accessible from outside my home network?

 

Well, there's a few things here.  Firstly you should be running a firewall of some sort - this will prevent any services not explicitly allowed from being accessed.  Secondly, if your systems are on a 10.0.0.x network then they're not addressable across the internet anyway - it's a non-routing address range (so even if someone could reach your DNS server then the answers would be useless).  Thirdly, you've bound the server only to your internal and loopback interfaces only so it isn't reachable directly from the internet interface.

With maradns there isn't any way to explicitly say which addresses are allowed to query the server - there's only the recursive functionality which can be limited (as you have done) which prevents the system being used as an intermediary.

 *Quote:*   

> thanks for all the help

 

No problem.

----------

## xbmodder

I have a redudant DNS server in my house. The primary server runs pdns with MySQL 5. The second server which is local does the same, but with MySQL replications. There is a server across town which downloads the MySQL database every 10 minutes. There ar also two servers about 20 miles away which sync up every hour. Its nifty.

----------

