Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a webserver (with static IP 192.168.1.5), and I want to have my machines on my local network to be able to access it without modifying /etc/hosts (or equivalent for Windows/OSX). My router has

Primary DNS server 192.168.1.5
Secondary DNS server 8.8.8.8 (Google's public DNS).

Nginx is set up to server websites externally as

*.example.com

Internally, I want

*.example.local

to point to the server.

My webserver has BIND9 installed, but I'm unsure of the settings. I've been through various contradicting tutorials, and so most of my settings have been clobbered. I've stripped out the lines which I'm confused about.

The tutorials I looked at are http://tech.surveypoint.com/blog/installing-a-local-dns-server-behind-a-hardware-router/ and http://ubuntuforums.org/showthread.php?t=236093 . They mostly differ on what should be put in /etc/bind/zones/db.example.local and /etc/bind/zones/db.192, so I've left the conflicting lines out below. Can someone suggest what the correct lines are to give my above behaviour (namely *.example.local pointing to 192.168.1.5)?

/etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address 192.168.1.5
    netmask 255.255.255.0
    broadcast 192.168.1.255
    gateway 192.168.1.254

/etc/hostname

avalon

/etc/resolv.conf

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

/etc/bind/named.conf.options

options {
    directory "/var/cache/bind";

    forwarders {
        8.8.8.8;
        8.8.4.4;
    };

    dnssec-validation auto;

    auth-nxdomain no;    # conform to RFC1035
    listen-on-v6 { any; };
};

/etc/bind/named.conf.local

zone "example.local" {
    type master;
    file "/etc/bind/zones/db.example.local";
};

zone "1.168.192.in-addr.arpa" {
    type master;
    file "/etc/bind/zones/db.192";
};

/etc/bind/zones/db.example.local

$TTL    604800
@   IN  SOA avalon.example.local.   webadmin.example.local. (
                  5     ; Serial, increment each edit
             604800     ; Refresh
              86400     ; Retry
            2419200     ; Expire
             604800 )   ; Negative Cache TTL

/etc/bind/zones/db.192

$TTL    604800
@   IN  SOA avalon.example.local.   webadmin.example.local. (
                  4     ; Serial, increment each edit
             604800     ; Refresh
              86400     ; Retry
            2419200     ; Expire
             604800 )   ; Negative Cache TTL
;

What do I need to add to the above files so that on a laptop on the internal network, I can type in webapp.example.local, and be served by my webserver?

EDIT

I made several changes to the above files on the webserver.

/etc/network/interfaces (end of file)

    dns-nameservers 127.0.0.1
    dns-search example.local

/etc/bind/zones/db.example.local (end of file)

@   IN  NS  avalon.example.local.
@   IN  A   192.168.1.5
avalon  IN  A   192.168.1.5
webapp  IN  A   192.168.1.5
www IN  CNAME   192.168.1.5

/etc/bind/zones/db.192 (end of file)

    IN  NS  avalon.example.local.
73  IN  PTR avalon.example.local.

As a side note, my spare Win7 machine was able to connect directly to webapp.example.local, but for a Ubuntu 13.10 machine, I had to make the following changes as well (not on the webserver, but on a separate machine):

/etc/nsswitch.conf

before

hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4

after

hosts:          files dns

/etc/NetworkManager/NetworkManager.conf

before

dns=dnsmasq

after

#dns=dnsmasq

The issue remains that its not wildcard DNS, and so I have to add entries to /etc/bind/zones/db.example.local for webapp1, webapp2, ...

share|improve this question

migrated from serverfault.com Oct 24 '13 at 18:14

This question came from our site for professional system and network administrators.

1  
Zeophlite, please don't take thie the wrong way, but you've been a member for a while. Have you, all that time, managed to miss the line in bold in serverfault.com/help/on-topic that says that SF is not for "Anything in a home or development environment"? –  MadHatter Oct 24 '13 at 7:49
    
To be honest, I've never looked there, thank you for pointing it out. My previous questions have all been for professional work. Is there a StackExchange site that is more suitable for this question? If so, I'll move it there. –  Zeophlite Oct 24 '13 at 7:53
    
@Zeophlite you could ask on SuperUser. However, if you edit out the referenced to "home networks" it's a well written, formatted question it might be OK and can stay here. –  tombull89 Oct 24 '13 at 7:55
    
I'll leave it here for now then –  Zeophlite Oct 24 '13 at 7:58
    
Fair enough - I do agree with tombull89 about it being a well-written question. Have you tried putting the single line IN A webapp 192.168.1.5 (with a leading TAB) in /etc/bind/zones/db.example.local? I understand you want wildcard DNS, reverse-resolution, and so on, but try getting a single forward host to work first, to simplify the problem. –  MadHatter Oct 24 '13 at 8:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.