1

I am trying to set up a BIND configuration with an Apache webserver. What I am trying to achieve is to by using the URL www.exampler.net access the content that can be found on my Apache webserver's /var/www/html folder. I am doing this on one machine which has the IP address 192.168.1.4. When I dig www.exampler.net while my Wired connection is on, it will only find Google's nameservers, but why I turn off my Wired connection it will instantly find my ns1.exampler.net. Why is that? Furthermore by writing www.exampler.net into the browser it won't redirect me to my local website which can be found in /var/www/html but by writing 192.168.1.4 i it will.

/etc/bind/named.conf.local

zone "exampler.net"{
        type master;
        file "/etc/bind/zones/db.exampler.net";
};

/etc/bind/zones/db.exampler.net

;
; exampler.net = domain name
;
$TTL    604800
exampler.net.   IN      SOA     ns1.exampler.net. admin.localhost. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
; name servers
exampler.net.   IN      NS      ns1.exampler.net.

; ip addresses
ns1     IN      A       192.168.1.4
www     IN      A       192.168.1.4

/etc/apache2/sites-available/000-default.conf

<VirtualHost *:80>
        ServerName exampler.net:80
        ServerAlias www.exampler.net

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

I am using Ubuntu 14.04.1. I want to do this only locally, so that the hosts on my LAN server can use the given domain name to access the website that can be found on my Apache/NS server. Thanks in advance!

1

Once the DNS resolver finds a successful match, it stops looking for one. Turning off the wired connection probably makes your regular DNS servers inaccessible so Ubuntu keeps looking until it hits your local DNS server.

It looks like www.exampler.net is already a registered domain that resolves to 64.233.171.121. Looking at it in chrome it looks like some guy's blog. You may want to use something more unique.

Alternatively, you could set BIND up as a forwarder and then specify on the hosts that it's the only name server they should be using. named won't query upstream servers for zones it thinks it's authoritative for.

Probably easier just to pick a different name, though.

  • I've changed the domain name to kvalami.net but it is still not working. drive.google.com/file/d/0BxIPwhUZEMkWbTBVRUNHS2NDZUE/… – masm64 Jan 7 '15 at 20:39
  • Can you try to modify your dig so that you're querying your nameserver directly? It looks like it's going out to the root servers there so it's still not hitting your local DNS server. An example would be dig @127.0.0.1 kvalami.net – Bratchley Jan 7 '15 at 20:49
  • Also, since we're using a known TLD, it's probably better to use host or nslookup so it uses the DNS resolver (which is what your web browser will also try to do) whereas dig tries to resolve the names itself. – Bratchley Jan 7 '15 at 20:49
  • I think kvalami.net is not defined, but www.kvalami.net should be drive.google.com/file/d/0BxIPwhUZEMkWamxXNl9PVGhKYzA/… .............. drive.google.com/file/d/0BxIPwhUZEMkWMUVIMUQ2Q1pWaGs/… – masm64 Jan 7 '15 at 20:55
  • Alright, the commands in the first one are outputting as I would expect. If you're wanting kvalami.net to resolve to 192.168.1.4 As well you need to update your zone file. You would basically add another A record identical to your one for www except you would just leave the hostname portion ("www") blank so that it only applies to the domain itself. – Bratchley Jan 7 '15 at 21:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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