I have a network, with no internet connection, with a few computers and a raspberry pi on it. I want to setup a DNS server on the raspberry pi so that the computers on the network may use it.

For example, they could go to example.com and it would go through to the server (which is on a static IP address). Other websites, like google.com, would not work because of the lack of internet connection on the network.

I would prefer to use BIND9, but any other dns server software would work.


  • Is there a tutorial for this?
  • How would I direct the traffic to the DNS server in the router settings?

1 Answer 1


In order to set up routes, you'll need to set up dhcpd, which will assign local IP addresses, as well as push routes.

In order to resolve hostnames, you need a DNS server, which BIND9 does a great job handling.

The following uses domain.tld as the domain being used, and as the GATEWAY/ROUTER's IP. Also, somename is used to represent a client to your network.


# Zone Set Up
zone domain.tld {

# Additional Information
ddns-domainname "domain.tld";
ddns-rev-domainname "in-addr.arpa.";
option domain-name "domain.tld";
option domain-name-servers;
option broadcast-address;

# Routes
option classless-static-routes
                            0,      0,0,0,0,
                            0,      10,1,0,1,
                            24,     10,1,0,         10,1,0,1;

# Push Routes to Clients
subnet netmask {
        option routers;
        zone 0.1.10.in-addr.arpa. {
        zone domain.tld. {

The above assumes that your GATEWAY/ROUTER will be You will need to select which 'domain.tld' you'd like to use. This will cause all routes to go to the gateway,

This is also where you could specify IP addresses using the client's MAC address. This gives you DHCP, with psuedo-static IPs.

host somename {
        hardware ethernet 60:XX:4c:XX:8a:XX;


$TTL    86400 ; 24 hours could have been written as 24h or 1d
;$ORIGIN 0.1.10.in-addr.arpa.
@  1D  IN    SOA domain.tld.   admin.domain.tld. (
                  2002022401 ; serial
                  3H ; refresh
                  15 ; retry
                  1w ; expire
                  3h ; minimum
; server host definitions
@      IN  NS     domain.tld.
1      IN  PTR    domain.tld.
100    IN  PTR    somename.domain.tld

This says "[email protected] is the contact for these IPs and is 'domain.tld'". You could add other IPs pointing to other subdomains.

125   IN   PTR   sub.domain.tld.

Adding this would tell reverse lookups that is sub.domain.tld.


$TTL 604800 ; 1 week
domain.tld    IN SOA  domain.tld. admin.domain.tld. (
        205        ; serial
        604800     ; refresh (1 week)
        86400      ; retry (1 day)
        2419200    ; expire (4 weeks)
        604800     ; minimum (1 week)
router         A
somename       A
*           CNAME domain.tld.

This says "[email protected] is the contact for these domains and 'domain.tld' is". You could add other domains, and even subdomains, pointing to other devices/ips.

router.domain.tld will resolve to This also redirects (CNAMES) any not-mentioned subdomain (whatever.domain.tld) to domain.tld.


This file will tell bind to load the previous db files we've created.

zone "domain.tld" {
        type master;
        file "/var/lib/bind/db.domain.tld";

zone "0.1.10.in-addr.arpa" {
        type master;
        file "/var/lib/bind/db.0.1.10";


There are plenty of tutorials on how to 'set up a gateway on Debian'.

  • So would I need to set the server as "default gateway" in the router settings? Also would I need to disable the dchp server built into the router? @earthmeLon
    – harry_p_6
    Nov 5, 2014 at 17:12
  • If your setup is Client -> Router -> Gateway, you will want to set up DHCP Forwarding on the Router (DD-WRT) or have the Router on a different subnet and hand out IPs for that subnet.
    – earthmeLon
    Nov 11, 2014 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.